Re: [PATCH] xfstests: Add first statx test

Eryu Guan
2017-03-31T12:13:46Z

On Fri, Mar 31, 2017 at 01:05:43PM +0100, David Howells wrote:
> Eryu Guan <eguan@redhat.com> wrote:
>
> > _require_scratch is not called, but in the test $SCRATCH_MNT is used. So
> > you need to either call "_require_scratch" here or use $TEST_DIR in the
> > test. For this statx(2) test, I think test in $TEST_DIR would be
> > sufficient.
>
> SCRATCH is cleaned between runs of ./check, but not this isn't so for TEST,
> right?
>
> David

Yes, TEST_DEV is supposed to be aging across tests, while SCRATCH_DEV is
re-created in tests. But you need to clean it explicitly in the test by
calling _scratch_mkfs, then mount it beforing writing anything to
$SCRATCH_MNT.

So the usual steps to use SCRATCH_DEV/SCRATCH_MNT is:

# this makes sure we have SCRATCH_DEV/MNT configured and unmounts it
# if SCRATCH_DEV is still mounted, so you don't need to unmount it
_require_scratch

# create filesystem on SCRATCH_DEV and mount it at SCRATCH_MNT
_scratch_mkfs
_scratch_mount
...
# then you can write to SCRATCH_MNT
$XFS_IO_PROG -fc "pwrite 0 1M" $SCRATCH_MNT/testfile

Thanks,
Eryu