@@ -716,6 +716,20 @@ tst_run()
[ "$TST_FORMAT_DEVICE" = 1 -o "$TST_ALL_FILESYSTEMS" = 1 ] && TST_NEEDS_DEVICE=1
[ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1
+ if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
+ if [ -z "$TMPDIR" ]; then
+ export TMPDIR="/tmp"
+ fi
+
+ TST_TMPDIR=$(mktemp -d "$TMPDIR/LTP_$TST_ID.XXXXXXXXXX")
+
+ chmod 777 "$TST_TMPDIR"
+
+ TST_STARTWD=$(pwd)
+ cd "$TST_TMPDIR"
+ fi
+
+ # needs to be after cd $TST_TMPDIR to keep test_dev.img under $TST_TMPDIR
if [ "$TST_NEEDS_DEVICE" = 1 ]; then
TST_DEVICE=$(tst_device acquire)
@@ -730,19 +744,6 @@ tst_run()
fi
fi
- if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
- if [ -z "$TMPDIR" ]; then
- export TMPDIR="/tmp"
- fi
-
- TST_TMPDIR=$(mktemp -d "$TMPDIR/LTP_$TST_ID.XXXXXXXXXX")
-
- chmod 777 "$TST_TMPDIR"
-
- TST_STARTWD=$(pwd)
- cd "$TST_TMPDIR"
- fi
-
if [ "$TST_ALL_FILESYSTEMS" != 1 -a "$TST_SKIP_FILESYSTEMS" ]; then
if ! tst_supported_fs -s "$TST_SKIP_FILESYSTEMS" -d . > /dev/null; then
tst_brk TCONF "filesystem is not supported by the test"
Before 1f6bd6e66 loop device for testing test_dev.img was created in shell API after cd to $TST_TMPDIR, therefore automatically removed during the cleanup in _tst_do_exit(). This got broken in 1f6bd6e66, fix it. Although it'd be good not relying on this order (full path could be kept and then pass to rm), it's better to have all LTP temporary files under $TST_TMPDIR, thus just restore the order. Fixes: 1f6bd6e66 ("tst_test.sh: Add $TST_ALL_FILESYSTEMS") Signed-off-by: Petr Vorel <pvorel@suse.cz> --- Hi, I'm sorry for introducing yet another regression in $TST_ALL_FILESYSTEMS. Kind regards, Petr testcases/lib/tst_test.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)