From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 3/4] lib: Apply the skip_filesystems to rest of test as well
Date: Thu, 11 Mar 2021 11:55:08 +0100 [thread overview]
Message-ID: <20210311105509.2701-4-chrubis@suse.cz> (raw)
In-Reply-To: <20210311105509.2701-1-chrubis@suse.cz>
There is no reason to use the newly introduced .skip_filesystems only
for .all_filesystems tests.
So if .all_filesystems is not enabled and .skip_filesystems is set we
check if test temporary directory filesystem type is in the list of
supported filesystem types.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
lib/tst_test.c | 12 ++++++++++++
testcases/kernel/syscalls/fcntl/fcntl33.c | 19 +++++++------------
.../kernel/syscalls/ioctl/ioctl_loop05.c | 11 +++++------
.../kernel/syscalls/vmsplice/vmsplice01.c | 9 ++++-----
.../kernel/syscalls/vmsplice/vmsplice02.c | 9 ++++-----
5 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 639e21727..2f728de28 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1051,6 +1051,18 @@ static void do_test_setup(void)
{
main_pid = getpid();
+ if (!tst_test->all_filesystems && tst_test->skip_filesystems) {
+ long fs_type = tst_fs_type(".");
+ const char *fs_name = tst_fs_type_name(fs_type);
+
+ if (tst_fs_in_skiplist(fs_name, tst_test->skip_filesystems)) {
+ tst_brk(TCONF, "Skipping %s as requested by the test",
+ fs_name);
+ } else {
+ tst_res(TINFO, "%s is supported by the test", fs_name);
+ }
+ }
+
if (tst_test->caps)
tst_cap_setup(tst_test->caps, TST_CAP_REQ);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl33.c b/testcases/kernel/syscalls/fcntl/fcntl33.c
index 70d5ec5ff..8d0d1a5a1 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl33.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl33.c
@@ -81,17 +81,6 @@ static void setup(void)
SAFE_FILE_SCANF(PATH_LS_BRK_T, "%d", &ls_brk_t);
SAFE_FILE_PRINTF(PATH_LS_BRK_T, "%d", 45);
- switch ((type = tst_fs_type("."))) {
- case TST_NFS_MAGIC:
- case TST_RAMFS_MAGIC:
- case TST_TMPFS_MAGIC:
- tst_brk(TCONF,
- "Cannot do fcntl(F_SETLEASE, F_WRLCK) on %s filesystem",
- tst_fs_type_name(type));
- default:
- break;
- }
-
SAFE_TOUCH("file", FILE_MODE, NULL);
sigemptyset(&newset);
@@ -230,5 +219,11 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(test_cases),
.setup = setup,
.test = do_test,
- .cleanup = cleanup
+ .cleanup = cleanup,
+ .skip_filesystems = (const char *const []) {
+ "tmpfs",
+ "ramfs",
+ "nfs",
+ NULL
+ },
};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
index f8fa413a9..58aa6f0d8 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
@@ -98,12 +98,6 @@ static void setup(void)
{
char bd_path[100];
- if (tst_fs_type(".") == TST_TMPFS_MAGIC)
- tst_brk(TCONF, "tmpfd doesn't support O_DIRECT flag");
-
- if (tst_fs_type(".") == TST_OVERLAYFS_MAGIC)
- tst_brk(TCONF, "device isn't properly detected in overlay fs");
-
dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
if (dev_num < 0)
tst_brk(TBROK, "Failed to find free loop device");
@@ -151,6 +145,11 @@ static struct tst_test test = {
.test_all = verify_ioctl_loop,
.needs_root = 1,
.needs_tmpdir = 1,
+ .skip_filesystems = (const char *const []) {
+ "tmpfs",
+ "overlayfs",
+ NULL
+ },
.needs_drivers = (const char *const []) {
"loop",
NULL
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice01.c b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
index 833af239f..1d1b66d12 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice01.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
@@ -103,11 +103,6 @@ static void setup(void)
{
int i;
- if (tst_fs_type(".") == TST_NFS_MAGIC) {
- tst_brk(TCONF, "Cannot do splice() "
- "on a file located on an NFS filesystem");
- }
-
for (i = 0; i < TEST_BLOCK_SIZE; i++)
buffer[i] = i & 0xff;
}
@@ -123,5 +118,9 @@ static struct tst_test test = {
.cleanup = cleanup,
.test_all = vmsplice_test,
.needs_tmpdir = 1,
+ .skip_filesystems = (const char *const []) {
+ "nfs",
+ NULL
+ },
.min_kver = "2.6.17",
};
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice02.c b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
index 978633d31..39c407cb8 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice02.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
@@ -52,11 +52,6 @@ static struct tcase {
static void setup(void)
{
- if (tst_fs_type(".") == TST_NFS_MAGIC) {
- tst_brk(TCONF, "Cannot do splice() "
- "on a file located on an NFS filesystem");
- }
-
filefd = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, 0644);
SAFE_PIPE(pipes);
@@ -106,5 +101,9 @@ static struct tst_test test = {
.test = vmsplice_verify,
.tcnt = ARRAY_SIZE(tcases),
.needs_tmpdir = 1,
+ .skip_filesystems = (const char *const []) {
+ "nfs",
+ NULL
+ },
.min_kver = "2.6.17",
};
--
2.26.2
next prev parent reply other threads:[~2021-03-11 10:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 10:55 [LTP] [PATCH v2 0/4] Add proper filesystem skiplist Cyril Hrubis
2021-03-11 10:55 ` [LTP] [PATCH v2 1/4] lib: " Cyril Hrubis
2021-03-12 11:06 ` [LTP] [PATCH v3] " Martin Doucha
2021-03-12 14:05 ` Cyril Hrubis
2021-03-12 17:00 ` Martin Doucha
2021-03-11 10:55 ` [LTP] [PATCH v2 2/4] lib: tst_fs_type change fs names to lowercase Cyril Hrubis
2021-03-11 10:55 ` Cyril Hrubis [this message]
2021-03-11 10:55 ` [LTP] [PATCH v2 4/4] doc: Update docs on filesystem detection Cyril Hrubis
2021-03-11 11:34 ` Petr Vorel
2021-03-11 12:46 ` [LTP] [PATCH v2 0/4] Add proper filesystem skiplist Li Wang
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=20210311105509.2701-4-chrubis@suse.cz \
--to=chrubis@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox