From 91e8a17be419ac9c76bb1277cd5aff4285a40bf0 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 27 Sep 2022 11:14:57 -0400 Subject: [PATCH] tests/semaphore: fix "cpu test took too long" assertion failure The SMP config for RISC-V on QEMU triggers this: |START - test_sem_queue_mutual_exclusion | |Assertion failed at | WEST_TOPDIR/zephyr/subsys/testsuite/ztest/src/ztest_new.c:155: | cpu_hold: (dt < 3000 is false) |1cpu test took too long (4090 ms) |ERROR: cannot fail in test 'after()', bailing Looping 10000 times is maybe a bit excessive. Signed-off-by: Nicolas Pitre --- tests/kernel/semaphore/semaphore/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kernel/semaphore/semaphore/src/main.c b/tests/kernel/semaphore/semaphore/src/main.c index 94e1d54f5ab..ddbc3c3106e 100644 --- a/tests/kernel/semaphore/semaphore/src/main.c +++ b/tests/kernel/semaphore/semaphore/src/main.c @@ -175,7 +175,7 @@ void sem_take_multiple_high_prio_helper(void *p1, void *p2, void *p3) /* First function for mutual exclusion test */ void sem_queue_mutual_exclusion1(void *p1, void *p2, void *p3) { - for (int i = 0; i < 10000; i++) { + for (int i = 0; i < 1000; i++) { expect_k_sem_take_nomsg(&mut_sem, K_FOREVER, 0); /* in that function critical section makes critical var +1 */ @@ -194,7 +194,7 @@ void sem_queue_mutual_exclusion1(void *p1, void *p2, void *p3) /* Second function for mutual exclusion test */ void sem_queue_mutual_exclusion2(void *p1, void *p2, void *p3) { - for (int i = 0; i < 10000; i++) { + for (int i = 0; i < 1000; i++) { expect_k_sem_take_nomsg(&mut_sem, K_FOREVER, 0); /* in that function critical section makes critical var 0 */