Skip to contentSkip to conversation

testsuite/smokey/alchemytests: Be more tolerant to VM environment

PATCH New Jan Kiszka 1 participant 1 message May 6

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

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

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.

---
 testsuite/smokey/alchemytests/task-11.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
testsuite/smokey/alchemytests/task-11.c +4 -2
index 819eca715f..6d07e02703 100644
@@ -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);
Signature · 1 line
2.47.3