@@ -2115,8 +2115,8 @@ The 'tst_mount' mounts '$TST_DEVICE' of '$TST_FS_TYPE' (optional) to
'$TST_MNT_PARAMS'. The '$TST_MNTPOINT' directory is created if it didn't
exist prior to the function call.
-If the path passed to the 'tst_umount' is not mounted (present in '/proc/mounts')
-it's noop.
+If the path passed (optional, defaults to '$TST_DEVICE') to the 'tst_umount' is
+not mounted (present in '/proc/mounts') it's noop.
Otherwise it retries to umount the filesystem a few times on a failure, which
is a workaround since there are a daemons dumb enough to probe all newly
mounted filesystems, which prevents them from umounting shortly after they
@@ -18,7 +18,7 @@
TST_CNT=12
TST_SETUP=setup
-TST_CLEANUP=cleanup
+TST_CLEANUP=tst_umount
TST_TESTFUNC=test
TST_OPTS="f:"
TST_USAGE=usage
@@ -54,11 +54,6 @@ setup()
DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk '{print $5}')
}
-cleanup()
-{
- tst_umount $TST_DEVICE
-}
-
df_test()
{
local cmd="$1 -P"
@@ -71,7 +71,7 @@ mkfs_verify_size()
{
tst_mount
local blocknum=`df -P -B 1k mntpoint | tail -n1 | awk '{print $2}'`
- tst_umount "$TST_DEVICE"
+ tst_umount
if [ $blocknum -gt "$2" ]; then
return 1
@@ -105,7 +105,7 @@ ima_cleanup()
if [ "$TST_NEEDS_DEVICE" = 1 ]; then
cd $TST_TMPDIR
- tst_umount $TST_DEVICE
+ tst_umount
fi
}
@@ -259,7 +259,7 @@ tst_mount()
tst_umount()
{
- local device="$1"
+ local device="${1:-$TST_DEVICE}"
local i=0
if ! grep -q "$device" /proc/mounts; then
+ use it directly as a cleanup function in df01.sh Signed-off-by: Petr Vorel <pvorel@suse.cz> --- doc/test-writing-guidelines.txt | 4 ++-- testcases/commands/df/df01.sh | 7 +------ testcases/commands/mkfs/mkfs01.sh | 2 +- testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 2 +- testcases/lib/tst_test.sh | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-)