From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Richard Palethorpe <rpalethorpe@suse.com>
Subject: Re: [LTP] [PATCH v6 0/8] shell: df01.sh: $TST_ALL_FILESYSTEMS
Date: Fri, 16 Sep 2022 23:22:08 +0200 [thread overview]
Message-ID: <YyTpANbITJ0cfslS@pevik> (raw)
In-Reply-To: <20220915093639.2261-1-pvorel@suse.cz>
Hi all,
I finally merged this, with diff below.
In case I overlooked something in eb47b4497 ("tst_supported_fs: Support skip
list when query single fs") or there is other problem needed to be fixed before
release, I'll try to address it next week.
Thanks a lot to all reviewers for their time and patience.
Kind regards,
Petr
diff --git lib/newlib_tests/shell/tst_all_filesystems.sh lib/newlib_tests/shell/tst_all_filesystems.sh
index 61284f4f2..7561579ff 100755
--- lib/newlib_tests/shell/tst_all_filesystems.sh
+++ lib/newlib_tests/shell/tst_all_filesystems.sh
@@ -3,6 +3,7 @@
# Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
TST_ALL_FILESYSTEMS=1
+TST_MOUNT_DEVICE=1
TST_NEEDS_ROOT=1
TST_TESTFUNC=test
TST_CNT=2
diff --git lib/newlib_tests/shell/tst_all_filesystems_skip.sh lib/newlib_tests/shell/tst_all_filesystems_skip.sh
index c2e0ba9ff..9516f38d9 100755
--- lib/newlib_tests/shell/tst_all_filesystems_skip.sh
+++ lib/newlib_tests/shell/tst_all_filesystems_skip.sh
@@ -3,6 +3,7 @@
# Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
TST_ALL_FILESYSTEMS=1
+TST_MOUNT_DEVICE=1
TST_NEEDS_ROOT=1
TST_TESTFUNC=test
TST_SKIP_FILESYSTEMS="btrfs,exfat,ext2,ext3,ext4,fuse,ntfs,vfat,tmpfs,xfs"
diff --git lib/tst_supported_fs_types.c lib/tst_supported_fs_types.c
index 52824cce9..7781f94c3 100644
--- lib/tst_supported_fs_types.c
+++ lib/tst_supported_fs_types.c
@@ -14,7 +14,10 @@
#include "tst_test.h"
#include "tst_fs.h"
-/* NOTE: new filesystem should be also added to tst_*skip*.sh */
+/*
+ * NOTE: new filesystem should be also added to
+ * lib/newlib_tests/shell/tst_{all_filesystems_skip,skip_filesystems}.sh
+ */
static const char *const fs_type_whitelist[] = {
"ext2",
"ext3",
diff --git testcases/commands/df/df01.sh testcases/commands/df/df01.sh
index 9527da214..ae0449c3c 100755
--- testcases/commands/df/df01.sh
+++ testcases/commands/df/df01.sh
@@ -7,6 +7,7 @@
# Test df command with some basic options.
TST_ALL_FILESYSTEMS=1
+TST_MOUNT_DEVICE=1
TST_CNT=12
TST_SETUP=setup
TST_TESTFUNC=test
diff --git testcases/lib/tst_supported_fs.c testcases/lib/tst_supported_fs.c
index e2261244d..70d4d38c7 100644
--- testcases/lib/tst_supported_fs.c
+++ testcases/lib/tst_supported_fs.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
+ * Copyright (c) Linux Test Project, 2019-2022
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
*/
@@ -16,12 +17,23 @@
static void usage(void)
{
- fprintf(stderr, "Usage: tst_supported_fs [-s skip_list] [fs_type]\n");
- fprintf(stderr, " If fs_type is supported, return 0\n");
- fprintf(stderr, " If fs_type isn't supported, return 1\n");
- fprintf(stderr, " If fs_type isn't specified, print the list of supported filesystems\n");
- fprintf(stderr, " fs_type - a specified filesystem type\n");
- fprintf(stderr, " skip_list - filesystems to skip, delimiter: '%c'\n",
+ fprintf(stderr, "Usage:\n");
+ fprintf(stderr, "* all filesystems\n");
+ fprintf(stderr, "tst_supported_fs [-s skip_list]\n");
+ fprintf(stderr, " print the list of supported filesystems\n");
+ fprintf(stderr, " if fs_type is supported and not in skip_list (optional),\n"
+ " print list of supported filesystems and return 0\n");
+ fprintf(stderr, " if fs_type isn't supported or in skip_list, return 1\n\n");
+
+ fprintf(stderr, "* single filesystem\n");
+ fprintf(stderr, "tst_supported_fs fs_type\n");
+ fprintf(stderr, " if fs_type is supported, return 0 otherwise return 1\n\n");
+
+ fprintf(stderr, "tst_supported_fs -s skip_list fs_type\n");
+ fprintf(stderr, " if fs_type is in skip_list, return 1 otherwise return 0\n\n");
+
+ fprintf(stderr, "fs_type - a specified filesystem type\n");
+ fprintf(stderr, "skip_list - filesystems to skip, delimiter: '%c'\n",
SKIP_DELIMITER);
}
@@ -80,15 +92,29 @@ int main(int argc, char *argv[])
return 2;
}
+ /* fs_type */
if (optind < argc) {
- if (tst_fs_in_skiplist(argv[optind], (const char * const*)skiplist))
- tst_brk(TCONF, "%s is not supported by the test", argv[optind]);
+ if (argv[optind][0] == '\0')
+ tst_brk(TCONF, "fs_type is empty");
- tst_res(TINFO, "%s is supported by the test", argv[optind]);
+ if (skiplist) {
+ if (tst_fs_in_skiplist(argv[optind], (const char * const*)skiplist))
+ tst_brk(TCONF, "%s is skipped", argv[optind]);
+ else
+ tst_res(TINFO, "%s is not skipped", argv[optind]);
+
+ return 0;
+ }
+
+ if (tst_fs_is_supported(argv[optind]) == TST_FS_UNSUPPORTED)
+ tst_brk(TCONF, "%s is not supported", argv[optind]);
+ else
+ tst_res(TINFO, "%s is supported", argv[optind]);
return 0;
}
+ /* all filesystems */
filesystems = tst_get_supported_fs_types((const char * const*)skiplist);
if (!filesystems[0])
diff --git testcases/lib/tst_test.sh testcases/lib/tst_test.sh
index 5b2abb282..229317713 100644
--- testcases/lib/tst_test.sh
+++ testcases/lib/tst_test.sh
@@ -699,14 +699,13 @@ tst_run()
[ -n "$TST_NEEDS_MODULE" ] && tst_require_module "$TST_NEEDS_MODULE"
- [ "$TST_ALL_FILESYSTEMS" = 1 ] && TST_MOUNT_DEVICE=1
[ "$TST_MOUNT_DEVICE" = 1 ] && TST_FORMAT_DEVICE=1
- [ "$TST_FORMAT_DEVICE" = 1 ] && TST_NEEDS_DEVICE=1
+ [ "$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 not supported"
+ tst_brk TCONF "$TST_FS_TYPE is skipped by the test"
fi
fi
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2022-09-16 21:22 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 9:36 [LTP] [PATCH v6 0/8] shell: df01.sh: $TST_ALL_FILESYSTEMS Petr Vorel
2022-09-15 9:36 ` [LTP] [PATCH v6 1/8] tst_supported_fs: Implement skip list Petr Vorel
2022-09-15 9:36 ` [LTP] [PATCH v6 2/8] zram01.sh: Use tst_supported_fs -s tmpfs Petr Vorel
2022-09-16 11:33 ` Cyril Hrubis
2022-09-15 9:36 ` [LTP] [PATCH v6 3/8] tst_supported_fs: Support skip list when query single fs Petr Vorel
2022-09-16 11:45 ` Cyril Hrubis
2022-09-16 12:09 ` Petr Vorel
2022-09-16 12:28 ` Cyril Hrubis
2022-09-16 12:39 ` Petr Vorel
2022-09-16 12:10 ` Petr Vorel
2022-09-15 9:36 ` [LTP] [PATCH v6 4/8] shell: Add $TST_SKIP_FILESYSTEMS + tests Petr Vorel
2022-09-16 11:50 ` Cyril Hrubis
2022-09-15 9:36 ` [LTP] [PATCH v6 5/8] tst_test.sh: Add $TST_ALL_FILESYSTEMS Petr Vorel
2022-09-16 12:45 ` Cyril Hrubis
2022-09-16 13:09 ` Petr Vorel
2022-09-16 13:17 ` Cyril Hrubis
2022-09-16 20:27 ` Petr Vorel
2022-09-15 9:36 ` [LTP] [PATCH v6 6/8] tst_test.sh: Allow | after whitelisted variable Petr Vorel
2022-09-16 13:02 ` Cyril Hrubis
2022-09-15 9:36 ` [LTP] [PATCH v6 7/8] shell: Add tests for TST_ALL_FILESYSTEMS=1 Petr Vorel
2022-09-15 9:36 ` [LTP] [PATCH v6 8/8] df01.sh: Convert to TST_ALL_FILESYSTEMS=1 Petr Vorel
2022-09-16 13:10 ` Cyril Hrubis
2022-09-16 13:11 ` Cyril Hrubis
2022-09-16 20:39 ` Petr Vorel
2022-09-16 13:12 ` Petr Vorel
2022-09-16 21:22 ` Petr Vorel [this message]
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=YyTpANbITJ0cfslS@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rpalethorpe@suse.com \
/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