]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/500: skip this test if formatting fails
authorDarrick J. Wong <djwong@kernel.org>
Wed, 1 Feb 2023 00:51:40 +0000 (16:51 -0800)
committerZorro Lang <zlang@kernel.org>
Fri, 3 Feb 2023 09:51:37 +0000 (17:51 +0800)
This testcase exercises what happens when we race a filesystem
perforing discard operations against a thin provisioning device that has
run out of space.  To constrain runtime, it creates a 128M thinp volume
and formats it.

However, if that initial format fails because (say) the 128M volume is
too small, then the test fails.  This is really a case of test
preconditions not being satisfied, so let's make the test _notrun when
this happens.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/dmthin
common/rc
tests/generic/500

index 91147e47ac34a51a6ea1a745ba05ae070ea50b2d..7107d50804896ee008cfd3ac0e25b488dbf05bb2 100644 (file)
@@ -234,5 +234,10 @@ _dmthin_mount()
 _dmthin_mkfs()
 {
        _scratch_options mkfs
-       _mkfs_dev $SCRATCH_OPTIONS $@ $DMTHIN_VOL_DEV
+       _mkfs_dev $SCRATCH_OPTIONS "$@" $DMTHIN_VOL_DEV
+}
+_dmthin_try_mkfs()
+{
+       _scratch_options mkfs
+       _try_mkfs_dev $SCRATCH_OPTIONS "$@" $DMTHIN_VOL_DEV
 }
index 36eb90e1f1cc2d4656da919fecc2222c6154f139..376a0138b4bca8f798407dbf5b89090e53f68d9c 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -604,9 +604,8 @@ _test_mkfs()
     esac
 }
 
-_mkfs_dev()
+_try_mkfs_dev()
 {
-    local tmp=`mktemp -u`
     case $FSTYP in
     nfs*)
        # do nothing for nfs
@@ -627,26 +626,27 @@ _mkfs_dev()
        # do nothing for pvfs2
        ;;
     udf)
-        $MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd
+        $MKFS_UDF_PROG $MKFS_OPTIONS $*
        ;;
     btrfs)
-        $MKFS_BTRFS_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd
+        $MKFS_BTRFS_PROG $MKFS_OPTIONS $*
        ;;
     ext2|ext3|ext4)
-       $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* \
-               2>$tmp.mkfserr 1>$tmp.mkfsstd
+       $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*
        ;;
     xfs)
-       $MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $* \
-               2>$tmp.mkfserr 1>$tmp.mkfsstd
+       $MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $*
        ;;
     *)
-       yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* \
-               2>$tmp.mkfserr 1>$tmp.mkfsstd
+       yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $*
        ;;
     esac
+}
 
-    if [ $? -ne 0 ]; then
+_mkfs_dev()
+{
+    local tmp=`mktemp -u`
+    if ! _try_mkfs_dev "$@" 2>$tmp.mkfserr 1>$tmp.mkfsstd; then
        # output stored mkfs output
        cat $tmp.mkfserr >&2
        cat $tmp.mkfsstd
index bc84d219fa66d12be43f3bf4f33d0f20d038f64f..1151c8f2346e48183c67d50cd0a41313da256ca9 100755 (executable)
@@ -58,7 +58,8 @@ CLUSTER_SIZE=$((64 * 1024 / 512))             # 64K
 
 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE $CLUSTER_SIZE 0
 _dmthin_set_fail
-_dmthin_mkfs
+_dmthin_try_mkfs >> $seqres.full 2>&1 || \
+       _notrun "Could not format small thinp filesystem for test"
 _dmthin_mount
 
 # There're two bugs at here, one is dm-thin bug, the other is filesystem