[rtems commit] spintrcritical21: Clear pending events

Sebastian Huber sebh at rtems.org
Wed Jan 12 13:17:19 UTC 2022


Module:    rtems
Branch:    master
Commit:    37377b0f9dc3c373c7498e7a1f9bb1c2af9f7bce
Changeset: http://git.rtems.org/rtems/commit/?id=37377b0f9dc3c373c7498e7a1f9bb1c2af9f7bce

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jan 12 14:23:06 2022 +0100

spintrcritical21: Clear pending events

The test runner checks that there are no pending events after a test
case.

---

 testsuites/sptests/spintrcritical21/init.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/testsuites/sptests/spintrcritical21/init.c b/testsuites/sptests/spintrcritical21/init.c
index 032ee89..5b1ecb2 100644
--- a/testsuites/sptests/spintrcritical21/init.c
+++ b/testsuites/sptests/spintrcritical21/init.c
@@ -31,6 +31,18 @@ typedef struct {
   rtems_id        other_task;
 } test_context;
 
+static void clear_pending_events( void )
+{
+  rtems_event_set out;
+
+  (void) rtems_event_receive(
+    RTEMS_ALL_EVENTS,
+    RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+    0,
+    &out
+  );
+}
+
 static bool is_blocked( Thread_Wait_flags flags )
 {
   return flags == ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_BLOCKED );
@@ -123,6 +135,8 @@ T_TEST_CASE(EventFromISR)
 
   status = rtems_task_delete( ctx.other_task );
   T_rsc_success( status );
+
+  clear_pending_events();
 }
 
 static T_interrupt_test_state event_with_timeout_from_isr_interrupt(
@@ -183,6 +197,8 @@ T_TEST_CASE( EventWithTimeoutFromISR )
 
   state = T_interrupt_test( &event_with_timeout_from_isr_config, &ctx );
   T_eq_int( state, T_INTERRUPT_TEST_DONE );
+
+  clear_pending_events();
 }
 
 static rtems_task Init( rtems_task_argument argument )



More information about the vc mailing list