All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <ltp@lists.linux.it>
Subject: [LTP] [PATCH 2/2] testcase: make use of needs_cmd version parser
Date: Wed, 1 Dec 2021 15:53:28 +0800	[thread overview]
Message-ID: <1638345208-2186-2-git-send-email-xuyang2018.jy@fujitsu.com> (raw)
In-Reply-To: <1638345208-2186-1-git-send-email-xuyang2018.jy@fujitsu.com>

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/quotactl/quotactl04.c | 11 +----------
 testcases/kernel/syscalls/statx/statx05.c       | 13 ++-----------
 2 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index dab61cf4d..62c94d596 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -121,18 +121,9 @@ static void do_mount(const char *source, const char *target,
 
 static void setup(void)
 {
-	FILE *f;
 	const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL};
-	int rc, major, minor, patch;
 
 	test_id = geteuid();
-	f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r");
-	rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch);
-	if (rc != 3)
-		tst_res(TWARN, "Unable parse version number");
-	else if (major * 10000 + minor * 100 + patch < 14300)
-		tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota,project option, test skipped");
-	pclose(f);
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
 	do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
 }
@@ -184,7 +175,7 @@ static struct tst_test test = {
 	.dev_fs_type = "ext4",
 	.mntpoint = MNTPOINT,
 	.needs_cmds = (const char *[]) {
-		"mkfs.ext4",
+		"mkfs.ext4 >= 1.43.0",
 		NULL
 	}
 };
diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
index a948a30b0..6b9a1db59 100644
--- a/testcases/kernel/syscalls/statx/statx05.c
+++ b/testcases/kernel/syscalls/statx/statx05.c
@@ -85,18 +85,9 @@ static void run(unsigned int i)
 
 static void setup(void)
 {
-	FILE *f;
 	char opt_bsize[32];
 	const char *const fs_opts[] = {"-O encrypt", opt_bsize, NULL};
-	int ret, rc, major, minor, patch;
-
-	f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r");
-	rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch);
-	if (rc != 3)
-		tst_res(TWARN, "Unable parse version number");
-	else if (major * 10000 + minor * 100 + patch < 14300)
-		tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for encrypt option, test skipped");
-	pclose(f);
+	int ret;
 
 	snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", getpagesize());
 
@@ -129,7 +120,7 @@ static struct tst_test test = {
 	.mntpoint = MNTPOINT,
 	.dev_fs_type = "ext4",
 	.needs_cmds = (const char *[]) {
-		"mkfs.ext4",
+		"mkfs.ext4 >= 1.43.0",
 		"e4crypt",
 		NULL
 	}
-- 
2.23.0


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

  reply	other threads:[~2021-12-01  7:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  7:53 [LTP] [PATCH 1/2] lib: add cmd parse handler in needs_cmd Yang Xu
2021-12-01  7:53 ` Yang Xu [this message]
2021-12-06 12:35   ` [LTP] [PATCH 2/2] testcase: make use of needs_cmd version parser Cyril Hrubis
2021-12-06 12:35 ` [LTP] [PATCH 1/2] lib: add cmd parse handler in needs_cmd Cyril Hrubis
2021-12-07  1:20   ` xuyang2018.jy
2021-12-07  8:08   ` [LTP] [PATCH v2 1/2] library: add cmd check handler in needs_cmds Yang Xu
2021-12-07  8:08     ` [LTP] [PATCH v2 2/2] testcase: make use of needs_cmd version check Yang Xu
2021-12-07 10:52     ` [LTP] [PATCH v2 1/2] library: add cmd check handler in needs_cmds Cyril Hrubis
2021-12-08  3:05       ` xuyang2018.jy
2021-12-08  9:54         ` Cyril Hrubis
2021-12-08 17:05     ` Petr Vorel
2021-12-09  1:31       ` xuyang2018.jy
2021-12-09  3:21       ` [LTP] [PATCH v3 " Yang Xu
2021-12-09  3:21         ` [LTP] [PATCH v3 2/2] testcase: make use of needs_cmd version check Yang Xu
2021-12-09 20:49           ` Petr Vorel
2021-12-10  2:37             ` xuyang2018.jy
2021-12-09 14:42         ` [LTP] [PATCH v3 1/2] library: add cmd check handler in needs_cmds Cyril Hrubis
2021-12-09 20:44         ` Petr Vorel
2021-12-10  2:34           ` xuyang2018.jy

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=1638345208-2186-2-git-send-email-xuyang2018.jy@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --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.