All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/3 v2] tst_test.sh: Fix filesystem support detection
Date: Thu, 22 Sep 2022 23:09:31 +0200	[thread overview]
Message-ID: <20220922210931.23982-4-pvorel@suse.cz> (raw)
In-Reply-To: <20220922210931.23982-1-pvorel@suse.cz>

Filesystem detection of locally used filesystem was broken on tests
which did not use TST_ALL_FILESYSTEMS as it 1) expected used filesystem
is $TST_FS_TYPE 2) this variable was not yet set.

Also this check makes sense only if test defines TST_SKIP_FILESYSTEMS
(to align with the condition in do_test_setup() in C API).

Move filesystem check after (optional) cd "$TST_TMPDIR" (TMPDIR can have
different filesystem).

Remove tst_skip_filesystems_skip.sh test, as filesystem on tmpfs would
have to be detected before.

Fixes: 1f6bd6e66 ("tst_test.sh: Add $TST_ALL_FILESYSTEMS")

Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../shell/tst_skip_filesystems_skip.sh          | 17 -----------------
 testcases/lib/tst_test.sh                       | 14 ++++++++------
 2 files changed, 8 insertions(+), 23 deletions(-)
 delete mode 100755 lib/newlib_tests/shell/tst_skip_filesystems_skip.sh

diff --git a/lib/newlib_tests/shell/tst_skip_filesystems_skip.sh b/lib/newlib_tests/shell/tst_skip_filesystems_skip.sh
deleted file mode 100755
index 6748d021d..000000000
--- a/lib/newlib_tests/shell/tst_skip_filesystems_skip.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
-
-TST_MOUNT_DEVICE=1
-TST_NEEDS_ROOT=1
-TST_FS_TYPE=ext4
-TST_TESTFUNC=test
-TST_SKIP_FILESYSTEMS="ext4"
-
-test()
-{
-	tst_res TFAIL "test should be skipped with TCONF"
-}
-
-. tst_test.sh
-tst_run
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 33aadea91..01c01b79b 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -702,12 +702,6 @@ 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_ALL_FILESYSTEMS" != 1 ]; then
-		if ! tst_supported_fs -s "$TST_SKIP_FILESYSTEMS" $TST_FS_TYPE > /dev/null; then
-			tst_brk TCONF "$TST_FS_TYPE is skipped by the test"
-		fi
-	fi
-
 	if [ "$TST_NEEDS_DEVICE" = 1 ]; then
 		TST_DEVICE=$(tst_device acquire)
 
@@ -735,6 +729,14 @@ tst_run()
 		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"
+		fi
+
+		tst_res TINFO "filesystem is supported by the test"
+	fi
+
 	[ -n "$TST_NEEDS_CHECKPOINTS" ] && _tst_init_checkpoints
 
 	TST_MNTPOINT="${TST_MNTPOINT:-$PWD/mntpoint}"
-- 
2.37.3


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

  parent reply	other threads:[~2022-09-22 21:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 21:09 [LTP] [PATCH 0/3 v2] tst_test.sh: Fix filesystem support detection Petr Vorel
2022-09-22 21:09 ` [LTP] [PATCH 1/3 v2] tst_supported_fs: Unify messaging Petr Vorel
2022-09-23  2:43   ` Li Wang
2022-09-23  6:05     ` Petr Vorel
2022-09-23 15:23   ` Cyril Hrubis
2022-09-23 16:31     ` Petr Vorel
2022-09-22 21:09 ` [LTP] [PATCH 2/3 v2] tst_supported_fs: Fix return codes Petr Vorel
2022-09-22 21:09 ` Petr Vorel [this message]
2022-09-23 15:29   ` [LTP] [PATCH 3/3 v2] tst_test.sh: Fix filesystem support detection Cyril Hrubis
2022-09-23 16:36     ` Petr Vorel
2022-09-26  9:13       ` Cyril Hrubis
2022-09-26  9:34         ` Petr Vorel
2022-09-26  9:45         ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220922210931.23982-4-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.