]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs/818: fix some design issues
authorDarrick J. Wong <djwong@kernel.org>
Fri, 21 Mar 2025 21:28:26 +0000 (14:28 -0700)
committerZorro Lang <zlang@kernel.org>
Fri, 28 Mar 2025 01:05:05 +0000 (09:05 +0800)
While QA'ing zoned filesystem support, I discovered some design errors
in this test:

1) Since we're test formatting a sparse file on an xfs filesystem,
there's no need to play games with optimal device size; we can create
a totally sparse file that's the same size as SCRATCH_DEV.

2) mkfs.xfs cannot create realtime files, so if it fails with that,
there's no need to continue the test.

3) If mkfs -p fails for none of the proscribed reasons, it should exit
the test.  The final cat $tmp.mkfs will take care of tweaking the golden
output to register the test failure for further investigation.

Cc: fstests@vger.kernel.org # v2025.03.09
Fixes: 6d39dc34e61e11 ("xfs: test filesystem creation with xfs_protofile")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/xfs/818

index aeb462353df7e9e6883c813000ab611d467bfbd3..bc809390b9e340e0aaef4d6ae4d94afc3c033671 100755 (executable)
@@ -75,9 +75,8 @@ _run_fsstress -n 1000 -d $SCRATCH_MNT/newfiles
 make_stat $SCRATCH_MNT before
 make_md5 $SCRATCH_MNT before
 
-kb_needed=$(du -k -s $SCRATCH_MNT | awk '{print $1}')
-img_size=$((kb_needed * 2))
-test "$img_size" -lt $((300 * 1024)) && img_size=$((300 * 1024))
+scratch_sectors="$(blockdev --getsz $SCRATCH_DEV)"
+img_size=$((scratch_sectors * 512 / 1024))
 
 echo "Clone image with protofile"
 $XFS_PROTOFILE_PROG $SCRATCH_MNT > $testfiles/protofile
@@ -99,7 +98,21 @@ if ! _try_mkfs_dev -p $testfiles/protofile $testfiles/image &> $tmp.mkfs; then
        if grep -q 'No space left on device' $tmp.mkfs; then
                _notrun "not enough space in filesystem"
        fi
+
+       # mkfs cannot create realtime files.
+       #
+       # If zoned=1 is in MKFS_OPTIONS, mkfs will create an internal realtime
+       # volume with rtinherit=1 and fail, so we need to _notrun that case.
+       #
+       # If zoned=1 is /not/ in MKFS_OPTIONS, we didn't pass a realtime device
+       # to mkfs so it will not create realtime files.  The format should work
+       # just fine.
+       if grep -q 'creating realtime files from proto file not supported' $tmp.mkfs; then
+               _notrun "mkfs cannot create realtime files"
+       fi
+
        cat $tmp.mkfs
+       exit
 fi
 
 _mount $testfiles/image $testfiles/mount