All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively
@ 2021-03-03  4:30 Xiao Yang
  2021-03-03  4:30 ` [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies Xiao Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xiao Yang @ 2021-03-03  4:30 UTC (permalink / raw)
  To: ltp

Current docparse cannot check implied flags recursively.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 docparse/docparse.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/docparse/docparse.c b/docparse/docparse.c
index 9f617c8bb..5879a9944 100644
--- a/docparse/docparse.c
+++ b/docparse/docparse.c
@@ -361,14 +361,16 @@ static const char *filter_out[] = {
 
 static struct implies {
 	const char *flag;
-	const char *implies;
+	const char **implies;
 } implies[] = {
-	{"format_device", "needs_device"},
-	{"mount_device", "needs_device"},
-	{"mount_device", "format_device"},
-	{"all_filesystems", "needs_device"},
-	{"needs_device", "needs_tmpdir"},
-	{NULL, NULL}
+	{"mount_device", (const char *[]) {"format_device", "needs_device",
+		"needs_tmpdir", NULL}},
+	{"format_device", (const char *[]) {"needs_device", "needs_tmpdir",
+		NULL}},
+	{"all_filesystems", (const char *[]) {"needs_device", "needs_tmpdir",
+		NULL}},
+	{"needs_device", (const char *[]) {"needs_tmpdir", NULL}},
+	{NULL, (const char *[]) {NULL}}
 };
 
 const char *strip_name(char *path)
@@ -384,7 +386,7 @@ const char *strip_name(char *path)
 
 int main(int argc, char *argv[])
 {
-	unsigned int i;
+	unsigned int i, j;
 	struct data_node *res;
 
 	if (argc != 2) {
@@ -402,15 +404,23 @@ int main(int argc, char *argv[])
 
 	/* Normalize the result */
 	for (i = 0; implies[i].flag; i++) {
-		if (data_node_hash_get(res, implies[i].flag) &&
-		    data_node_hash_get(res, implies[i].implies))
-			fprintf(stderr, "%s: useless tag: %s\n", argv[1], implies[i].implies);
+		if (data_node_hash_get(res, implies[i].flag)) {
+			for (j = 0; implies[i].implies[j]; j++) {
+				if (data_node_hash_get(res, implies[i].implies[j]))
+					fprintf(stderr, "%s: useless tag: %s\n",
+						argv[1], implies[i].implies[j]);
+			}
+		}
 	}
 
 	for (i = 0; implies[i].flag; i++) {
-		if (data_node_hash_get(res, implies[i].flag) &&
-		    !data_node_hash_get(res, implies[i].implies))
-			data_node_hash_add(res, implies[i].implies, data_node_string("1"));
+		if (data_node_hash_get(res, implies[i].flag)) {
+			for (j = 0; implies[i].implies[j]; j++) {
+				if (!data_node_hash_get(res, implies[i].implies[j]))
+					data_node_hash_add(res, implies[i].implies[j],
+							   data_node_string("1"));
+			}
+		}
 	}
 
 	data_node_hash_add(res, "fname", data_node_string(argv[1]));
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies
  2021-03-03  4:30 [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Xiao Yang
@ 2021-03-03  4:30 ` Xiao Yang
  2021-03-10 10:44   ` Petr Vorel
  2021-03-03  4:30 ` [LTP] [PATCH 3/3] lib/tst_test.c: Remove redundant needs_device Xiao Yang
  2021-03-10 10:43 ` [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Petr Vorel
  2 siblings, 1 reply; 7+ messages in thread
From: Xiao Yang @ 2021-03-03  4:30 UTC (permalink / raw)
  To: ltp

needs_checkpoints and resource_files imply needs_tmpdir.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 docparse/docparse.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/docparse/docparse.c b/docparse/docparse.c
index 5879a9944..790c84a84 100644
--- a/docparse/docparse.c
+++ b/docparse/docparse.c
@@ -370,6 +370,8 @@ static struct implies {
 	{"all_filesystems", (const char *[]) {"needs_device", "needs_tmpdir",
 		NULL}},
 	{"needs_device", (const char *[]) {"needs_tmpdir", NULL}},
+	{"needs_checkpoints", (const char *[]) {"needs_tmpdir", NULL}},
+	{"resource_files", (const char *[]) {"needs_tmpdir", NULL}},
 	{NULL, (const char *[]) {NULL}}
 };
 
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 3/3] lib/tst_test.c: Remove redundant needs_device
  2021-03-03  4:30 [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Xiao Yang
  2021-03-03  4:30 ` [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies Xiao Yang
@ 2021-03-03  4:30 ` Xiao Yang
  2021-03-10 10:44   ` Petr Vorel
  2021-03-10 10:43 ` [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Petr Vorel
  2 siblings, 1 reply; 7+ messages in thread
From: Xiao Yang @ 2021-03-03  4:30 UTC (permalink / raw)
  To: ltp

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 lib/tst_test.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 6bbee030b..9987e9543 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -942,13 +942,11 @@ static void do_setup(int argc, char *argv[])
 				tst_brk(TCONF, "%s driver not available", name);
 	}
 
-	if (tst_test->format_device)
-		tst_test->needs_device = 1;
+	if (tst_test->mount_device)
+		tst_test->format_device = 1;
 
-	if (tst_test->mount_device) {
+	if (tst_test->format_device)
 		tst_test->needs_device = 1;
-		tst_test->format_device = 1;
-	}
 
 	if (tst_test->all_filesystems)
 		tst_test->needs_device = 1;
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively
  2021-03-03  4:30 [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Xiao Yang
  2021-03-03  4:30 ` [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies Xiao Yang
  2021-03-03  4:30 ` [LTP] [PATCH 3/3] lib/tst_test.c: Remove redundant needs_device Xiao Yang
@ 2021-03-10 10:43 ` Petr Vorel
  2021-03-10 14:37   ` Xiao Yang
  2 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2021-03-10 10:43 UTC (permalink / raw)
  To: ltp

Hi Yang,

> Current docparse cannot check implied flags recursively.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Thanks!

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies
  2021-03-03  4:30 ` [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies Xiao Yang
@ 2021-03-10 10:44   ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-03-10 10:44 UTC (permalink / raw)
  To: ltp

Hi Yang,

> needs_checkpoints and resource_files imply needs_tmpdir.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Thanks!

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 3/3] lib/tst_test.c: Remove redundant needs_device
  2021-03-03  4:30 ` [LTP] [PATCH 3/3] lib/tst_test.c: Remove redundant needs_device Xiao Yang
@ 2021-03-10 10:44   ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-03-10 10:44 UTC (permalink / raw)
  To: ltp

Hi Yang,

> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Thanks!

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively
  2021-03-10 10:43 ` [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Petr Vorel
@ 2021-03-10 14:37   ` Xiao Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Xiao Yang @ 2021-03-10 14:37 UTC (permalink / raw)
  To: ltp

Hi Petr,

Thanks for your review and pushed the patch set.

Best Regards,

Xiao Yang

On 3/10/21 6:43 PM, Petr Vorel wrote:
> Hi Yang,
>
>> Current docparse cannot check implied flags recursively.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Thanks!
>
> Kind regards,
> Petr
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-10 14:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  4:30 [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Xiao Yang
2021-03-03  4:30 ` [LTP] [PATCH 2/3] docparse/docparse.c: Add missing entries into struct implies Xiao Yang
2021-03-10 10:44   ` Petr Vorel
2021-03-03  4:30 ` [LTP] [PATCH 3/3] lib/tst_test.c: Remove redundant needs_device Xiao Yang
2021-03-10 10:44   ` Petr Vorel
2021-03-10 10:43 ` [LTP] [PATCH 1/3] docparse/docparse.c: Make docparse check implied flags recursively Petr Vorel
2021-03-10 14:37   ` Xiao Yang

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.