From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Richard Palethorpe <rpalethorpe@suse.com>,
Joerg Vehlow <joerg.vehlow@aox-tech.de>,
linux-fsdevel@vger.kernel.org,
automated-testing@lists.yoctoproject.org
Subject: [LTP] [PATCH 5/6] tst_device: Add support -f filesystem
Date: Sat, 27 Aug 2022 02:28:14 +0200 [thread overview]
Message-ID: <20220827002815.19116-6-pvorel@suse.cz> (raw)
In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz>
Useful to get smaller minimal required size.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/lib/tst_device.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
index b672202e2..a161fb069 100644
--- a/testcases/lib/tst_device.c
+++ b/testcases/lib/tst_device.c
@@ -19,19 +19,19 @@ static struct tst_test test = {
static void print_help(void)
{
fprintf(stderr, "\nUsage:\n");
- fprintf(stderr, "tst_device [-s size [-d /path/to/device]] acquire\n");
+ fprintf(stderr, "tst_device [-f filesystem] [-s size [-d /path/to/device]] acquire\n");
fprintf(stderr, "tst_device -d /path/to/device release\n");
fprintf(stderr, "tst_device -h\n\n");
}
-static int acquire_device(const char *device_path, unsigned int size)
+static int acquire_device(const char *device_path, unsigned int size, long f_type)
{
const char *device;
if (device_path)
device = tst_acquire_loop_device(size, device_path);
else
- device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS);
+ device = tst_acquire_device__(size, f_type);
if (!device)
return 1;
@@ -66,6 +66,7 @@ int main(int argc, char *argv[])
{
char *device_path = NULL;
unsigned int size = 0;
+ long f_type = TST_ALL_FILESYSTEMS;
int ret;
/*
@@ -79,7 +80,7 @@ int main(int argc, char *argv[])
*/
tst_test = &test;
- while ((ret = getopt(argc, argv, "d:hs:"))) {
+ while ((ret = getopt(argc, argv, "d:f:hs:"))) {
if (ret < 0)
break;
@@ -87,6 +88,13 @@ int main(int argc, char *argv[])
case 'd':
device_path = optarg;
break;
+ case 'f':
+ f_type = tst_fs_name_type(optarg);
+ if (f_type == -1) {
+ fprintf(stderr, "ERROR: Unsupported filesystem '%s'", optarg);
+ return 1;
+ }
+ break;
case 'h':
print_help();
return 0;
@@ -104,7 +112,7 @@ int main(int argc, char *argv[])
goto help;
if (!strcmp(argv[optind], "acquire")) {
- if (acquire_device(device_path, size))
+ if (acquire_device(device_path, size, f_type))
goto help;
} else if (!strcmp(argv[optind], "release")) {
if (release_device(device_path))
--
2.37.2
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-08-27 0:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
2022-08-27 0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
2022-08-29 10:44 ` Cyril Hrubis
2022-08-29 15:46 ` Bird, Tim
2022-08-29 16:14 ` Petr Vorel
2022-08-29 16:35 ` Bird, Tim
2022-08-29 16:49 ` Petr Vorel
2022-08-30 5:59 ` Li Wang
2022-08-27 0:28 ` [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem Petr Vorel
2022-08-29 10:58 ` Cyril Hrubis
2022-08-29 11:29 ` Petr Vorel
2022-08-29 12:24 ` [LTP] [Automated-testing] " Cyril Hrubis
2022-08-30 6:11 ` [LTP] " Li Wang
2022-08-27 0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
2022-08-29 11:00 ` Cyril Hrubis
2022-08-30 6:12 ` Li Wang
2022-08-27 0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
2022-08-29 11:03 ` [LTP] [Automated-testing] " Cyril Hrubis
2022-08-29 11:42 ` Petr Vorel
2022-08-30 6:14 ` [LTP] " Li Wang
2022-08-27 0:28 ` Petr Vorel [this message]
2022-08-29 11:04 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Cyril Hrubis
2022-08-30 6:14 ` Li Wang
2022-08-27 0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
2022-08-29 11:05 ` Cyril Hrubis
2022-08-30 6:16 ` Li Wang
2022-08-29 10:43 ` [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem Cyril Hrubis
2022-08-29 11:39 ` Petr Vorel
2022-08-30 5:52 ` Li Wang
2022-08-30 8:18 ` 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=20220827002815.19116-6-pvorel@suse.cz \
--to=pvorel@suse.cz \
--cc=automated-testing@lists.yoctoproject.org \
--cc=joerg.vehlow@aox-tech.de \
--cc=linux-fsdevel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).