[PATCH v2 3/3] testsuite/smokey/psostests: Avoid timeouts in over virtual environments

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <f188ef4acc2e470c5224073a0bd5f81259e5b651.1778234324.git.jan.kiszka@siemens.com>
From: Jan Kiszka <[email protected]>

This was seen over QEMU:

2026-05-03T09:42:36 [2] at mq-3.c:31
2026-05-03T09:42:36    0\"071.079| BUG in __traceobj_assert_failed(): [TSKA] trace assertion failed:
2026-05-03T09:42:36               mq-3.c:32 => \"ret == 0\"
2026-05-03T09:42:36 [1] at mq-3.c:27
2026-05-03T09:42:36 test psostests_mq3 failed: 256

It's most likely that we ran into a timeout here due to QEMU not being
able to deliver the messages to all receivers in time. Just wait
infinitely in such cases to avoid spurious testsuite errors.

Signed-off-by: Jan Kiszka <[email protected]>
---
 testsuite/smokey/psostests/mq-3.c      | 10 ++++++++--
 testsuite/smokey/psostests/psostests.c |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/testsuite/smokey/psostests/mq-3.c b/testsuite/smokey/psostests/mq-3.c
index 1171a70544..4b6f2dcf35 100644
--- a/testsuite/smokey/psostests/mq-3.c
+++ b/testsuite/smokey/psostests/mq-3.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <copperplate/traceobj.h>
 #include <psos/psos.h>
 
@@ -12,6 +14,8 @@ static int tseq[] = {
 
 static u_long tidA, tidB, qid;
 
+static bool on_vm;
+
 static void task_A(u_long a0, u_long a1, u_long a2, u_long a3)
 {
 	u_long msgbuf[4];
@@ -27,7 +31,7 @@ static void task_A(u_long a0, u_long a1, u_long a2, u_long a3)
 	traceobj_mark(&trobj, 1);
 
 	for (n = 0; n < 3; n++) {
-		ret = q_receive(qid, Q_WAIT, 10, msgbuf);
+		ret = q_receive(qid, Q_WAIT, on_vm ? 0 : 10, msgbuf);
 		traceobj_mark(&trobj, 2);
 		traceobj_assert(&trobj, ret == SUCCESS);
 		traceobj_assert(&trobj, msgbuf[0] == n + 1);
@@ -56,7 +60,7 @@ static void task_B(u_long a0, u_long a1, u_long a2, u_long a3)
 	traceobj_mark(&trobj, 4);
 
 	for (n = 0; n < 3; n++) {
-		ret = q_receive(qid, Q_WAIT, 10, msgbuf);
+		ret = q_receive(qid, Q_WAIT, on_vm ? 0 : 10, msgbuf);
 		traceobj_mark(&trobj, 5);
 		traceobj_assert(&trobj, ret == SUCCESS);
 		traceobj_assert(&trobj, msgbuf[0] == n + 1);
@@ -75,6 +79,8 @@ int main(int argc, char *const argv[])
 	u_long args[] = { 1, 2, 3, 4 }, msgbuf[4], count;
 	int ret, n;
 
+	on_vm = argc > 1 && strcmp(argv[1], "--vm") == 0;
+
 	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
 	ret = q_create("QUEUE", Q_NOLIMIT, 0, &qid);
diff --git a/testsuite/smokey/psostests/psostests.c b/testsuite/smokey/psostests/psostests.c
index a28ceea056..289d563ac3 100644
--- a/testsuite/smokey/psostests/psostests.c
+++ b/testsuite/smokey/psostests/psostests.c
@@ -48,6 +48,7 @@ static int run_psostests(struct smokey_test *t, int argc, char *const argv[])
 	smokey_note("psostests skipped. --enable-lores-clock missing.");
 	return 0;
 #else
+	const char *args = "--vm";
 	int test_ret = 0;
 	int ret = 0;
 	int tmp;
@@ -61,7 +62,7 @@ static int run_psostests(struct smokey_test *t, int argc, char *const argv[])
 
 	for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
 		tmp = smokey_run_extprog(XENO_TEST_DIR, tests[i],
-					 NULL, &test_ret);
+					 smokey_on_vm ? args : NULL, &test_ret);
 		if (test_ret)
 			ret = test_ret; /* Return the last failed test result */
 		if (tmp)
@@ -72,4 +73,3 @@ static int run_psostests(struct smokey_test *t, int argc, char *const argv[])
 #endif
 }
 smokey_test_plugin(psostests, SMOKEY_NOARGS, "Run external psostests");
-
-- 
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.