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

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
From: Jan Kiszka <[email protected]>

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

Part of #52.

Signed-off-by: Jan Kiszka <[email protected]>
---
 testsuite/smokey/alchemytests/mq-2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testsuite/smokey/alchemytests/mq-2.c b/testsuite/smokey/alchemytests/mq-2.c
index a389e46db0..09b26b2135 100644
--- a/testsuite/smokey/alchemytests/mq-2.c
+++ b/testsuite/smokey/alchemytests/mq-2.c
@@ -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);
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.