From 37377b0f9dc3c373c7498e7a1f9bb1c2af9f7bce Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 12 Jan 2022 14:23:06 +0100 Subject: 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(+) (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/spintrcritical21/init.c b/testsuites/sptests/spintrcritical21/init.c index 032ee89eac..5b1ecb2862 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 ) -- cgit v1.2.3