[LTP] [PATCH 1/3] tst_test.sh: cd to $LTPROOT before umount
Petr Vorel
pvorel@suse.cz
Fri Sep 23 12:55:52 CEST 2022
It's safer not to expect tests go away from the mountpoint
before trying to unmount it, because tests can cd to $TST_MNTPOINT
if they use TST_MOUNT_DEVICE=1. Also better to handle it in the library
than in all tests which may need it.
This fix ima_keys.sh and other following IMA/EVM tests which fail on
systems with tmpfs on $TMPDIR since 1f6bd6e66:
ima_keys 1 TCONF: IMA policy does not specify '^measure.*func=KEY_CHECK'
tst_device.c:255: TWARN: ioctl(/dev/loop0, LOOP_CLR_FD, 0) no ENXIO for too long
Usage:
tst_device acquire [size [filename]]
tst_device release /path/to/device
tst_device clear /path/to/device
ima_keys 1 TWARN: Failed to release device '/dev/loop0'
rm: cannot remove '/tmp/LTP_ima_keys.YArl935DCg/mntpoint': Device or resource busy
Fixme: 1f6bd6e66 ("tst_test.sh: Add $TST_ALL_FILESYSTEMS")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/lib/tst_test.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 01c01b79b..7ec744cac 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -29,6 +29,7 @@ _tst_do_exit()
local ret=0
TST_DO_EXIT=1
+ cd "$LTPROOT"
[ "$TST_MOUNT_FLAG" = 1 ] && tst_umount
if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then
@@ -38,7 +39,6 @@ _tst_do_exit()
fi
if [ "$TST_NEEDS_TMPDIR" = 1 -a -n "$TST_TMPDIR" ]; then
- cd "$LTPROOT"
rm -r "$TST_TMPDIR"
[ "$TST_TMPDIR_RHOST" = 1 ] && tst_cleanup_rhost
fi
@@ -794,6 +794,7 @@ _tst_run_iterations()
fi
if [ "$TST_MOUNT_FLAG" = 1 ]; then
+ cd "$LTPROOT"
tst_umount
TST_MOUNT_FLAG=
fi
--
2.37.3
More information about the ltp
mailing list