[PATCH] testsuite/smokey/alchemytests: Be more tolerant to VM environment

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

We already relax the duration check in task-11, but also
rt_task_wait_period could run into errors if hosted in a VM on a busy
machine.

Part of the issue #52 story.

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

diff --git a/testsuite/smokey/alchemytests/task-11.c b/testsuite/smokey/alchemytests/task-11.c
index 819eca715f..6d07e02703 100644
--- a/testsuite/smokey/alchemytests/task-11.c
+++ b/testsuite/smokey/alchemytests/task-11.c
@@ -15,6 +15,7 @@ static RT_TASK t_test;
 static RTIME duration[TEST_ITERATIONS];
 
 static struct traceobj trobj;
+static bool on_vm;
 
 static int tseq[] = {
 	1, 2,
@@ -45,7 +46,7 @@ static void test_task(void *arg)
 			rt_task_set_periodic(NULL, TM_NOW, PERIOD_SWITCH);
 
 		ret = rt_task_wait_period(NULL);
-		traceobj_check(&trobj, ret, 0);
+		traceobj_assert(&trobj, ret == 0 || on_vm);
 
 		end = rt_timer_read();
 
@@ -61,9 +62,10 @@ static void test_task(void *arg)
 
 int main(int argc, char *const argv[])
 {
-	bool on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
 	int ret;
 
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+
 	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
 	ret = rt_task_create(&t_test, "test_task", 0, 99, 0);
-- 
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.