diff --git a/tests/lib/ringbuffer/prj.conf b/tests/lib/ringbuffer/prj.conf index e07a04cbb44..9c25eb296c6 100644 --- a/tests/lib/ringbuffer/prj.conf +++ b/tests/lib/ringbuffer/prj.conf @@ -2,4 +2,3 @@ CONFIG_ZTEST=y CONFIG_IRQ_OFFLOAD=y CONFIG_RING_BUFFER=y CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100000 diff --git a/tests/lib/ringbuffer/src/concurrent.c b/tests/lib/ringbuffer/src/concurrent.c index 6cb143a3f77..9f71533fcad 100644 --- a/tests/lib/ringbuffer/src/concurrent.c +++ b/tests/lib/ringbuffer/src/concurrent.c @@ -330,7 +330,7 @@ static void microdelay(int delay) static void thread_entry_spsc(void *p1, void *p2, void *p3) { struct ring_buf *rbuf = p1; - uint32_t timeout = 5000; + uint32_t timeout = 6000; bool high_producer = (bool)p2; uint32_t start = k_uptime_get_32(); struct k_timer timer; @@ -370,10 +370,16 @@ static void thread_entry_spsc(void *p1, void *p2, void *p3) } PRINT("preempted: %d\n", preempt_cnt); - zassert_true(preempt_cnt > 1500, "If thread operation was not preempted " + /* Test is tailored for qemu_x86 to generate enough number of preemptions + * to validate that ring buffer is safe to be used without any locks in + * single producer single consumer scenario. + */ + if (IS_ENABLED(CONFIG_BOARD_QEMU_X86)) { + zassert_true(preempt_cnt > 1500, "If thread operation was not preempted " "multiple times then we cannot have confidance that it " "validated the module properly. Platform should not be " "used in that case"); + } } extern uint32_t test_rewind_threshold; @@ -387,8 +393,7 @@ static void test_ringbuffer_spsc(bool higher_producer, int api_type) uint8_t buf[32]; uint32_t buf32[32]; - /* Native posix cannot have sys tick high enough to run this stress test. */ - if (IS_ENABLED(CONFIG_BOARD_NATIVE_POSIX)) { + if (CONFIG_SYS_CLOCK_TICKS_PER_SEC < 100000) { ztest_test_skip(); } diff --git a/tests/lib/ringbuffer/testcase.yaml b/tests/lib/ringbuffer/testcase.yaml index e04928cbfb3..22c68a51cf0 100644 --- a/tests/lib/ringbuffer/testcase.yaml +++ b/tests/lib/ringbuffer/testcase.yaml @@ -1,7 +1,16 @@ -tests: - libraries.data_structures: +common: tags: ring_buffer circular_buffer + +tests: + libraries.ring_buffer: # FIXME: qemu_arc_hs6x excluded, see #37861 platform_exclude: qemu_arc_hs6x + integration_platforms: + - native_posix + + libraries.ring_buffer_concurrent: + platform_allow: qemu_x86 + extra_configs: + - CONFIG_SYS_CLOCK_TICKS_PER_SEC=100000 integration_platforms: - qemu_x86