fstests: check if the scratch device is an lv device for certain tests
[xfstests-dev.git] / tests / generic / 081
index 5dff079852d330804308ea1703c33e8542f6c337..22ac94de538304b44aebd235115e48289754181f 100755 (executable)
@@ -6,17 +6,13 @@
 #
 # Test I/O error path by fully filling an dm snapshot.
 #
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1       # failure is the default!
-trap "_cleanup; exit \$status" 0 1 2 3 15
+. ./common/preamble
+_begin_fstest auto quick
 
+# Override the default cleanup function.
 _cleanup()
 {
+       local pv_ret
        cd /
        rm -f $tmp.*
 
@@ -37,26 +33,28 @@ _cleanup()
        while test -e /dev/mapper/$vgname-$snapname || \
              test -e /dev/mapper/$vgname-$lvname; do
                $UMOUNT_PROG $mnt >> $seqres.full 2>&1
+               $LVM_PROG lvremove -f $vgname/$snapname >>$seqres.full 2>&1
+               $LVM_PROG lvremove -f $vgname/$lvname >>$seqres.full 2>&1
                $LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1
                $LVM_PROG pvremove -f $SCRATCH_DEV >>$seqres.full 2>&1
-               test $? -eq 0 && break
+               pv_ret=$?
+               $UDEV_SETTLE_PROG
+               test $pv_ret -eq 0 && break
                sleep 2
        done
 }
 
-# get standard environment, filters and checks
-. ./common/rc
+# Import common functions.
 . ./common/filter
 
 # real QA test starts here
 _supported_fs generic
 _require_test
-_require_scratch_nocheck
+_require_scratch_nolvm
 _require_dm_target snapshot
 _require_command $LVM_PROG lvm
 
 echo "Silence is golden"
-rm -f $seqres.full
 
 vgname=vg_$seq
 lvname=base_$seq