mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: use mount/umount helpers everywhere
Replace every explicit mount/umount of scratch or test devices with helper functions. This allows the next patch to add in hooks to these functions in order to set up & tear down overlayfs on every mount/umount (also adds _test_unmount(), which didn't exist prior) [Eryu Guan rebased the patch agains latest master and replaced more mount/umount with helpers] Signed-off-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eric Sandeen <esandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
4545386ca0
commit
27d077ec0b
+2
-2
@@ -32,7 +32,7 @@ status=0
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
rm -f $tmp.*
|
||||
exit $status
|
||||
}
|
||||
@@ -48,7 +48,7 @@ _populate_scratch()
|
||||
dd if=/dev/zero of=$SCRATCH_MNT/goo count=400 bs=4096 >/dev/null 2>&1 &
|
||||
dd if=/dev/zero of=$SCRATCH_MNT/moo count=800 bs=4096 >/dev/null 2>&1 &
|
||||
wait
|
||||
umount $SCRATCH_MNT # flush everything
|
||||
_scratch_unmount # flush everything
|
||||
_scratch_mount # and then remount
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ _scratch_mount | _filter_scratch
|
||||
|
||||
mkdir $SCRATCH_MNT/x
|
||||
$here/src/dirhash_collide -d -n 10000 $SCRATCH_MNT/x
|
||||
umount $SCRATCH_MNT 2>&1 | _filter_scratch
|
||||
_scratch_unmount 2>&1 | _filter_scratch
|
||||
|
||||
_scratch_xfs_repair 2>&1 | _filter_repair
|
||||
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ do_test()
|
||||
off_opts=$3
|
||||
|
||||
echo "*** umount"
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
QINO_1=`xfs_db -c "sb 0" -c "p" $SCRATCH_DEV | \
|
||||
grep $qino_1 | awk '{print $NF}'`
|
||||
@@ -76,7 +76,7 @@ do_test()
|
||||
xfs_quota -x -c "off -$off_opts" $SCRATCH_MNT
|
||||
xfs_quota -x -c "remove -$off_opts" $SCRATCH_MNT
|
||||
echo "*** umount"
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
echo "*** Usage after quotarm ***"
|
||||
xfs_db -c "inode $QINO_1" -c "p core.nblocks" $SCRATCH_DEV
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ bsize=4096
|
||||
_cleanup()
|
||||
{
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
}
|
||||
|
||||
_block_filter()
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ status=1 # failure is the default!
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -114,7 +114,7 @@ _scratch_mkfs_xfs "-m crc=1,finobt=1 -d agcount=2" | _filter_mkfs 2>$seqres.full
|
||||
# sparsely populate the fs such that we create records with free inodes
|
||||
_scratch_mount
|
||||
_sparse_inode_populate $SCRATCH_MNT 999
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
# corrupt some finobt records
|
||||
_corrupt_finobt_records $SCRATCH_DEV
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ _cleanup()
|
||||
killall -9 fsstress 2>/dev/null
|
||||
wait
|
||||
cd /
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -109,7 +109,7 @@ done
|
||||
killall $FSSTRESS_PROG
|
||||
wait
|
||||
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
status=0
|
||||
exit
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ _cleanup()
|
||||
killall -9 fsstress 2>/dev/null
|
||||
wait
|
||||
cd /
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -149,7 +149,7 @@ wait
|
||||
rm -rf $SCRATCH_MNT/fsstress
|
||||
rm -rf $SCRATCH_MNT/dir*
|
||||
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
status=0
|
||||
exit
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ _cleanup()
|
||||
{
|
||||
cd /
|
||||
umount $LOOP_MNT 2>/dev/null
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -193,7 +193,7 @@ umount $LOOP_MNT
|
||||
|
||||
echo $orig_sp_time > /proc/sys/fs/xfs/speculative_prealloc_lifetime
|
||||
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
status=0
|
||||
exit
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ _cleanup()
|
||||
cd /
|
||||
rm -f $tmp.*
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
}
|
||||
|
||||
_block_filter()
|
||||
@@ -116,7 +116,7 @@ _log_traffic()
|
||||
done
|
||||
|
||||
echo " *** unmount"
|
||||
if ! umount $SCRATCH_DEV
|
||||
if ! _scratch_unmount
|
||||
then
|
||||
echo "failed to unmount $SCRATCH_DEV"
|
||||
exit 1
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -54,7 +54,7 @@ _require_no_large_scratch_dev
|
||||
echo "*** init FS"
|
||||
|
||||
rm -f $seqres.full
|
||||
umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
_scratch_unmount >/dev/null 2>&1
|
||||
echo "*** MKFS ***" >>$seqres.full
|
||||
echo "" >>$seqres.full
|
||||
_scratch_mkfs_xfs >>$seqres.full 2>&1 \
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ _cleanup()
|
||||
cd /
|
||||
_cleanup_logfiles
|
||||
rm -f $tmp.*
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
@@ -57,7 +57,7 @@ _require_v2log
|
||||
_link_out_file_named $seqfull.op $(_get_os_name)
|
||||
|
||||
echo "*** init FS"
|
||||
umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
_scratch_unmount >/dev/null 2>&1
|
||||
|
||||
cat >$tmp.seq.params <<EOF
|
||||
# mkfs-opt mount-opt
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ status=1 # failure is the default!
|
||||
_cleanup()
|
||||
{
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -111,7 +111,7 @@ _verify_fs()
|
||||
VERSION="-n version=$1"
|
||||
|
||||
rm -f $seqfull
|
||||
umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
_scratch_unmount >/dev/null 2>&1
|
||||
|
||||
_full "mkfs"
|
||||
_scratch_mkfs_xfs $VERSION -p $protofile >>$seqfull 2>&1 \
|
||||
@@ -134,7 +134,7 @@ _verify_fs()
|
||||
|
||||
echo "*** unmount FS"
|
||||
_full "umount"
|
||||
umount $SCRATCH_DEV >>$seqfull 2>&1 \
|
||||
_scratch_unmount >>$seqfull 2>&1 \
|
||||
|| _fail "umount failed"
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ status=0 # success is the default!
|
||||
_cleanup()
|
||||
{
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -80,7 +80,7 @@ _require_scratch
|
||||
_require_attrs
|
||||
|
||||
rm -f $seqres.full
|
||||
umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
_scratch_unmount >/dev/null 2>&1
|
||||
|
||||
echo "*** mkfs"
|
||||
_scratch_mkfs_xfs >/dev/null \
|
||||
@@ -125,7 +125,7 @@ echo ""
|
||||
inum_2=`ls -li $testfile.2 | $AWK_PROG '{ print $1 }'`
|
||||
|
||||
echo "*** unmount FS"
|
||||
umount $SCRATCH_DEV >>$seqres.full 2>&1 \
|
||||
_scratch_unmount >>$seqres.full 2>&1 \
|
||||
|| _fail "umount failed"
|
||||
|
||||
echo "*** dump attributes (1)"
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ status=1 # failure is the default!
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ else
|
||||
_notrun "GQuota are enabled, test needs controlled sb recovery"
|
||||
src/feature -P $SCRATCH_DEV && \
|
||||
_notrun "PQuota are enabled, test needs controlled sb recovery"
|
||||
umount $SCRATCH_DEV
|
||||
_scratch_unmount
|
||||
fi
|
||||
clear=""
|
||||
eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_DEV | perl -ne '
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ status=1 # failure is the default!
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ src/feature -G $SCRATCH_DEV && \
|
||||
_notrun "GQuota are enabled, test needs controlled sb recovery"
|
||||
src/feature -P $SCRATCH_DEV && \
|
||||
_notrun "PQuota are enabled, test needs controlled sb recovery"
|
||||
umount $SCRATCH_DEV
|
||||
_scratch_unmount
|
||||
|
||||
# rootino, rbmino, and rsumino are now set (lets blow em away!)
|
||||
_check_root_inos 0
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ _cleanup()
|
||||
cd /
|
||||
rm -f $tmp.*
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
@@ -52,7 +52,7 @@ _require_scratch
|
||||
echo "*** init FS"
|
||||
|
||||
rm -f $seqres.full
|
||||
umount $SCRATCH_DEV >/dev/null 2>&1
|
||||
_scratch_unmount >/dev/null 2>&1
|
||||
echo "*** MKFS ***" >>$seqres.full
|
||||
echo "" >>$seqres.full
|
||||
_scratch_mkfs_xfs >>$seqres.full 2>&1 \
|
||||
|
||||
+3
-3
@@ -35,7 +35,7 @@ status=1 # failure is the default!
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup ; exit \$status" 0 1 2 3 15
|
||||
@@ -50,7 +50,7 @@ _supported_os IRIX Linux
|
||||
|
||||
_require_scratch
|
||||
_require_no_large_scratch_dev
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
|
||||
_fill()
|
||||
{
|
||||
@@ -80,7 +80,7 @@ do
|
||||
_fill $SCRATCH_MNT/fill_$size
|
||||
_do "Grow filesystem to ${size}m" "xfs_growfs -D $grow_size $SCRATCH_MNT"
|
||||
echo -n "Flush filesystem... "
|
||||
_do "umount $SCRATCH_MNT"
|
||||
_do "_scratch_unmount"
|
||||
_do "_scratch_mount"
|
||||
echo "done"
|
||||
echo -n "Check files... "
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ status=1 # failure is the default!
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup ; exit \$status" 0 1 2 3 15
|
||||
@@ -96,7 +96,7 @@ done
|
||||
_do "xfs_bmap -vp $SCRATCH_MNT/fill"
|
||||
echo "done"
|
||||
# flush the filesystem - make sure there is no space "lost" to pre-allocation
|
||||
_do "umount $SCRATCH_MNT"
|
||||
_do "_scratch_unmount"
|
||||
_do "_scratch_mount"
|
||||
echo -n "Use up any further available space... "
|
||||
_do "$XFS_IO_PROG -f -c \"falloc 0 1m\" $SCRATCH_MNT/pad"
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ _check_mount()
|
||||
fi
|
||||
|
||||
echo " *** umount"
|
||||
if ! umount $SCRATCH_DEV
|
||||
if ! _scratch_unmount
|
||||
then
|
||||
echo " !!! umount failed (expecting success)"
|
||||
status=1
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ status=1 # failure is the default!
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount $SCRATCH_MNT 2>/dev/null
|
||||
_scratch_unmount 2>/dev/null
|
||||
rm -f $tmp.*
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
@@ -197,7 +197,7 @@ _exercise()
|
||||
|
||||
echo
|
||||
echo "*** unmount"
|
||||
umount $SCRATCH_MNT
|
||||
_scratch_unmount
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user