Skip to contentSkip to conversation

testsuite/smokey/alchemytests: Relax mq-2 test over VM

PATCH In review Jan Kiszka 2 participants 7 messages May 6 – May 8

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 testsuite/smokey/alchemytests: Relax mq-2 test over VM

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +6 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+
 	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
 	ret = rt_task_spawn(&t_main, "main_task", 0,  50, 0, main_task, NULL);
Signature · 1 line
2.47.3
#1 lore raw
Quoted 38 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +4 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }

testsuite/smokey/alchemytests/mq-2.c int main(int argc, char *const argv[]) · line 105

Quoted 5 lines
testsuite/smokey/alchemytests/mq-2.c +2 -0
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+

Seems a bit risky to expect --vm as first argument only.

Quoted 5 lines
testsuite/smokey/alchemytests/mq-2.c +0 -0
 	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
 	ret = rt_task_spawn(&t_main, "main_task", 0,  50, 0, main_task, NULL);
Signature · 1 line
2.47.3
author
#2 lore raw
Quoted 42 lines · Florian Bezdeka
Quoted 41 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +4 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
Quoted 5 lines

testsuite/smokey/alchemytests/mq-2.c int main(int argc, char *const argv[]) · line 105

Quoted 2 lines
testsuite/smokey/alchemytests/mq-2.c +2 -0
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+

Seems a bit risky to expect --vm as first argument only.

It's not a new pattern, and I thought (please prove me wrong) that this is already a filtered argv, freed from generic switches.

Jan

Quoted 5 lines
Quoted 5 lines
testsuite/smokey/alchemytests/mq-2.c +0 -0
 	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
 	ret = rt_task_spawn(&t_main, "main_task", 0,  50, 0, main_task, NULL);
Signature · 1 line
2.47.3
Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#3 lore raw
Quoted 43 lines · Jan Kiszka
Quoted 42 lines · Florian Bezdeka
Quoted 41 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +4 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
Quoted 8 lines
Quoted 5 lines

testsuite/smokey/alchemytests/mq-2.c int main(int argc, char *const argv[]) · line 105

Quoted 2 lines
testsuite/smokey/alchemytests/mq-2.c +2 -0
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+

Seems a bit risky to expect --vm as first argument only.

It's not a new pattern, and I thought (please prove me wrong) that this is already a filtered argv, freed from generic switches.

Yes, that seems to be the case, but the filtering seems questionable:

Taken from run_alchemytests():

tmp = smokey_run_extprog(XENO_TEST_DIR, tests[i],
smokey_on_vm ? args : args + 5, &test_ret);

Where args is

	const char *args = "--vm";

args + 5 is pointing to garbage in case smokey_on_vm is false. Right?

Quoted 13 lines

Jan

Quoted 5 lines
Quoted 5 lines
testsuite/smokey/alchemytests/mq-2.c +0 -0
 	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
 	ret = rt_task_spawn(&t_main, "main_task", 0,  50, 0, main_task, NULL);
Signature · 1 line
2.47.3
Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
author
#4 lore raw
Quoted 61 lines · Florian Bezdeka
Quoted 43 lines · Jan Kiszka
Quoted 42 lines · Florian Bezdeka
Quoted 41 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +4 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
Quoted 8 lines
Quoted 5 lines

testsuite/smokey/alchemytests/mq-2.c int main(int argc, char *const argv[]) · line 105

Quoted 2 lines
testsuite/smokey/alchemytests/mq-2.c +2 -0
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+

Seems a bit risky to expect --vm as first argument only.

It's not a new pattern, and I thought (please prove me wrong) that this is already a filtered argv, freed from generic switches.

Yes, that seems to be the case, but the filtering seems questionable:

Taken from run_alchemytests():

tmp = smokey_run_extprog(XENO_TEST_DIR, tests[i],
smokey_on_vm ? args : args + 5, &test_ret);

Quoted 5 lines

Where args is

	const char *args = "--vm";

args + 5 is pointing to garbage in case smokey_on_vm is false. Right?

Yeah, went unnoticed in via 61fc9ff4b7214fb1d9802aa7d177a555f0ad47e3. Please fix and also check the other tests at that chance.

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#5 lore raw
Quoted 62 lines · Jan Kiszka
Quoted 61 lines · Florian Bezdeka
Quoted 43 lines · Jan Kiszka
Quoted 42 lines · Florian Bezdeka
Quoted 41 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +4 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
Quoted 8 lines
Quoted 5 lines

testsuite/smokey/alchemytests/mq-2.c int main(int argc, char *const argv[]) · line 105

Quoted 2 lines
testsuite/smokey/alchemytests/mq-2.c +2 -0
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+

Seems a bit risky to expect --vm as first argument only.

It's not a new pattern, and I thought (please prove me wrong) that this is already a filtered argv, freed from generic switches.

Yes, that seems to be the case, but the filtering seems questionable:

Taken from run_alchemytests():

tmp = smokey_run_extprog(XENO_TEST_DIR, tests[i],
smokey_on_vm ? args : args + 5, &test_ret);

Quoted 9 lines
Quoted 5 lines

Where args is

	const char *args = "--vm";

args + 5 is pointing to garbage in case smokey_on_vm is false. Right?

Yeah, went unnoticed in via 61fc9ff4b7214fb1d9802aa7d177a555f0ad47e3. Please fix and also check the other tests at that chance.

testsuite/smokey/psostests/mq-3.c has also a check for --vm in argv[1] but never got this cmdline parameter...

Should I remove the check or fix the cmdline arg invocation? Were there any issues seen with this specific test (in CI) in the past?

author
#6 lore raw
Quoted 73 lines · Florian Bezdeka
Quoted 62 lines · Jan Kiszka
Quoted 61 lines · Florian Bezdeka
Quoted 43 lines · Jan Kiszka
Quoted 42 lines · Florian Bezdeka
Quoted 41 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

VM environment may delay or reorder the execution of tasks, so relax the checks.

Part of #52.

---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/mq-2.c +4 -2
index a389e46db0..09b26b2135 100644
@@ -7,6 +7,7 @@
 #include <alchemy/queue.h>
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	3, 4, 5, 6,
@@ -87,9 +88,10 @@ static void main_task(void *arg)
 
 	ret = rt_queue_inquire(&q, &info);
 	traceobj_check(&trobj, ret, 0);
-	traceobj_assert(&trobj, info.nmessages == 0);
+	traceobj_assert(&trobj, info.nmessages == 0 || on_vm);
 
-	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+	if (info.nmessages == 0)
+		traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
 
 	traceobj_exit(&trobj);
 }
@@ -99,6 +101,8 @@ int main(int argc, char *const argv[])
 	RT_TASK t_main;
 	int ret;
 
Quoted 8 lines
Quoted 5 lines

testsuite/smokey/alchemytests/mq-2.c int main(int argc, char *const argv[]) · line 105

Quoted 2 lines
testsuite/smokey/alchemytests/mq-2.c +2 -0
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+

Seems a bit risky to expect --vm as first argument only.

It's not a new pattern, and I thought (please prove me wrong) that this is already a filtered argv, freed from generic switches.

Yes, that seems to be the case, but the filtering seems questionable:

Taken from run_alchemytests():

tmp = smokey_run_extprog(XENO_TEST_DIR, tests[i],
smokey_on_vm ? args : args + 5, &test_ret);

Quoted 9 lines
Quoted 5 lines

Where args is

	const char *args = "--vm";

args + 5 is pointing to garbage in case smokey_on_vm is false. Right?

Yeah, went unnoticed in via 61fc9ff4b7214fb1d9802aa7d177a555f0ad47e3. Please fix and also check the other tests at that chance.

Quoted 5 lines

testsuite/smokey/psostests/mq-3.c has also a check for --vm in argv[1] but never got this cmdline parameter...

Should I remove the check or fix the cmdline arg invocation? Were there any issues seen with this specific test (in CI) in the past?

That's a fail of my recent patch, you already commented on it. Still in next, let me bake a v2.

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center