public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR
@ 2022-10-10  8:59 Petr Vorel
  2022-10-11  2:55 ` Li Wang
  2022-10-11  9:58 ` Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2022-10-10  8:59 UTC (permalink / raw)
  To: ltp

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(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 033491b08..5af345938 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -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"
-- 
2.37.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR
  2022-10-10  8:59 [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR Petr Vorel
@ 2022-10-11  2:55 ` Li Wang
  2022-10-11  9:58 ` Cyril Hrubis
  1 sibling, 0 replies; 4+ messages in thread
From: Li Wang @ 2022-10-11  2:55 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp


[-- Attachment #1.1: Type: text/plain, Size: 63 bytes --]

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 315 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR
  2022-10-10  8:59 [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR Petr Vorel
  2022-10-11  2:55 ` Li Wang
@ 2022-10-11  9:58 ` Cyril Hrubis
  2022-10-11 12:17   ` Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2022-10-11  9:58 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR
  2022-10-11  9:58 ` Cyril Hrubis
@ 2022-10-11 12:17   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-10-11 12:17 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi all,

thanks for your review, merged.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-11 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10  8:59 [LTP] [PATCH 1/1] tst_test.sh: Create (again) loop device in $TST_TMPDIR Petr Vorel
2022-10-11  2:55 ` Li Wang
2022-10-11  9:58 ` Cyril Hrubis
2022-10-11 12:17   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox