Xenomai real-time core development
 help / color / mirror / Atom feed
* [libevl][PATCH] tests: sched-quota-accuracy: Fix test cpu selection
@ 2026-08-28  5:46 Jan Kiszka
  2026-08-28  7:49 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2026-08-28  5:46 UTC (permalink / raw)
  To: Xenomai, Philippe Gerum

From: Jan Kiszka <jan.kiszka@siemens.com>

pick_test_cpu() is adjusting test_cpu to the system's possibilities.
That is 0 for a single-core machine, but it can also be something else
on multicore machines if the OOB cpuset is restricted. And this causes
the test to fail:

sched-quota-accuracy: ** BROKEN
../tests/sched-quota-accuracy.c:96: FAILED: sched_setaffinity(0, sizeof(affinity), &affinity) (=Operation not permitted)

Fixes: 245a2eac29eb ("tests: sched-quota-accuracy: extend measurement to preemption noise")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 tests/sched-quota-accuracy.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/sched-quota-accuracy.c b/tests/sched-quota-accuracy.c
index 2c4daed..2a2dc38 100644
--- a/tests/sched-quota-accuracy.c
+++ b/tests/sched-quota-accuracy.c
@@ -389,15 +389,6 @@ int main(int argc, char *argv[])
 	}
 
 	atexit((void (*)(void))cleanup_group);
-	set_cpu_affinity();	/* All test threads inherit this. */
-
-	param.sched_priority = MAIN_PRIO;
-	__Tcall_assert(ret, pthread_setschedparam(pthread_self(), SCHED_FIFO, &param));
-	__Tcall_assert(ret, evl_attach_self("quota-accuracy:%d", getpid()));
-
-	__Tcall_assert(ret, evl_new_sem(&ready, "quota-ready:%d", getpid()));
-	__Tcall_assert(ret, evl_new_event(&barrier, "quota-barrier:%d", getpid()));
-	__Tcall_assert(ret, evl_new_mutex(&lock, "quota-lock:%d", getpid()));
 
 	/*
 	 * We need all threads to be pinned on the same (oob-capable)
@@ -407,6 +398,15 @@ int main(int argc, char *argv[])
 	 */
 	test_cpu = pick_test_cpu(test_cpu, false, NULL);
 	do_trace("picked CPU%d for execution", test_cpu);
+	set_cpu_affinity();	/* All test threads inherit this. */
+
+	param.sched_priority = MAIN_PRIO;
+	__Tcall_assert(ret, pthread_setschedparam(pthread_self(), SCHED_FIFO, &param));
+	__Tcall_assert(ret, evl_attach_self("quota-accuracy:%d", getpid()));
+
+	__Tcall_assert(ret, evl_new_sem(&ready, "quota-ready:%d", getpid()));
+	__Tcall_assert(ret, evl_new_event(&barrier, "quota-barrier:%d", getpid()));
+	__Tcall_assert(ret, evl_new_mutex(&lock, "quota-lock:%d", getpid()));
 
 	if (nrthreads <= 0)
 		nrthreads = 3;
-- 
2.47.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-28  7:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28  5:46 [libevl][PATCH] tests: sched-quota-accuracy: Fix test cpu selection Jan Kiszka
2026-08-28  7:49 ` Philippe Gerum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox