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

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
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]>
---

Was not worth to bother the AI in this case.

 testsuite/smokey/psostests/mq-3.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 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);
-- 
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.