tests: portability: cmsis: Fix test_event_flags_signalled()
Until now, the main thread preempted thread2 between k_event_post() and
k_event_test(). Then main thread consumed the event before it was tested by
thread2.
This behavior was not correct since the caller can't know the event is in
fact consumed (the CMSIS-RTOS specification says osEventFlagsSet() "returns
the event flags stored in the event")
This behavior is now fixed. So we can fix the test.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
diff --git a/tests/subsys/portability/cmsis_rtos_v2/src/event_flags.c b/tests/subsys/portability/cmsis_rtos_v2/src/event_flags.c
index faa3b19..a6e3e50 100644
--- a/tests/subsys/portability/cmsis_rtos_v2/src/event_flags.c
+++ b/tests/subsys/portability/cmsis_rtos_v2/src/event_flags.c
@@ -32,16 +32,7 @@
{
int flags = osEventFlagsSet((osEventFlagsId_t)arg, FLAG2);
- /* Please note that as soon as the last flag that a thread is waiting
- * on is set, the control shifts to that thread and that thread may
- * choose to clear the flags as part of its osEventFlagsWait operation.
- * In this test case, the main thread is waiting for FLAG1 and FLAG2.
- * FLAG1 gets set first and then FLAG2 gets set. As soon as FLAG2 gets
- * set, control shifts to the waiting thread where osEventFlagsWait
- * clears FLAG1 and FLAG2 internally. When this thread eventually gets
- * scheduled we should hence check if FLAG2 is cleared.
- */
- zassert_equal(flags & FLAG2, 0, "");
+ zassert_equal(flags & FLAG2, FLAG2, "");
}
static K_THREAD_STACK_DEFINE(test_stack1, STACKSZ);