diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-08-04 08:50:58 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-08-04 08:50:58 +0200 |
commit | 9e9de860720010ce444bf47ff021e4701df33faf (patch) | |
tree | f67b4bd4fe9f227a96e8eada005409ec5748be32 | |
parent | 3c0f07267651b72c55922e981e31808d5c79af2a (diff) |
testsuites/validation/tc-terminate.c
-rw-r--r-- | testsuites/validation/tc-terminate.c | 117 |
1 files changed, 77 insertions, 40 deletions
diff --git a/testsuites/validation/tc-terminate.c b/testsuites/validation/tc-terminate.c index aac04870ff..0733a363ca 100644 --- a/testsuites/validation/tc-terminate.c +++ b/testsuites/validation/tc-terminate.c @@ -73,18 +73,21 @@ * * This test case performs the following actions: * - * - Create two dynamic extensions. Call the system termination procedure. - * Delete the two dynamic extensions. + * - Create three dynamic extensions. Call the system termination procedure. + * Delete one dynamic extension during the fatal extension invocation. + * Delete the two remaining dynamic extensions. * - * - Check that the fatal user extensions were called with the expected - * source. + * - Check that the fatal extensions were invoked with the expected source. * - * - Check that the fatal user extensions were called with the expected - * always set to false argument. + * - Check that the fatal extensions were invoked with the expected always + * set to false argument. * - * - Check that the fatal user extensions were called with the expected code. + * - Check that the fatal extensions were invoked with the expected code. * - * - Check that the fatal user extensions were called in forward order. + * - Check that the fatal extensions were invoked in forward order. + * + * - Check that the fatal extension in the deleted extension set was not + * invoked. * * - Check that the system state is terminated. * @@ -109,7 +112,7 @@ typedef struct { static Atomic_Uint counter; -static FatalInfo info[ 4 ]; +static FatalInfo info[ 5 ]; static bool test_case_active; @@ -123,6 +126,8 @@ static rtems_fatal_source halt_source; static rtems_fatal_code halt_code; +static rtems_id extension_id_4; + static unsigned int GetCounter( void ) { return _Atomic_Fetch_add_uint( &counter, 1, ATOMIC_ORDER_RELAXED ) + 1; @@ -194,12 +199,27 @@ static void FatalExtension3( rtems_fatal_code code ) { + rtems_status_code sc; + + FatalExtension( source, always_set_to_false, code, 3 ); + + sc = rtems_extension_delete( extension_id_4 ); + T_quiet_rsc_success( sc ); +} + +static void FatalExtension4( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ FatalExtension( source, always_set_to_false, code, 3 ); } /** - * @brief Create two dynamic extensions. Call the system termination - * procedure. Delete the two dynamic extensions. + * @brief Create three dynamic extensions. Call the system termination + * procedure. Delete one dynamic extension during the fatal extension + * invocation. Delete the two remaining dynamic extensions. */ static void ScoreInterrValTerminate_Action_0( void ) { @@ -233,6 +253,14 @@ static void ScoreInterrValTerminate_Action_0( void ) ); T_step_rsc_success( 1, sc ); + table.fatal = FatalExtension4; + sc = rtems_extension_create( + rtems_build_name( ' ', ' ', ' ', '4' ), + &table, + &extension_id_4 + ); + T_step_rsc_success( 2, sc ); + test_case_active = true; if ( setjmp( before_terminate ) == 0 ) { @@ -242,64 +270,73 @@ static void ScoreInterrValTerminate_Action_0( void ) test_case_active = false; sc = rtems_extension_delete( id_2 ); - T_step_rsc_success( 2, sc ); + T_step_rsc_success( 3, sc ); sc = rtems_extension_delete( id_3 ); - T_step_rsc_success( 3, sc ); + T_step_rsc_success( 4, sc ); /* - * Check that the fatal user extensions were called with the expected source. + * Check that the fatal extensions were invoked with the expected source. */ T_step_eq_int( - 4, + 5, info[ 0 ].source, RTEMS_FATAL_SOURCE_APPLICATION ); T_step_eq_int( - 5, + 6, info[ 1 ].source, RTEMS_FATAL_SOURCE_APPLICATION ); T_step_eq_int( - 6, + 7, info[ 2 ].source, RTEMS_FATAL_SOURCE_APPLICATION ); T_step_eq_int( - 7, + 8, info[ 3 ].source, RTEMS_FATAL_SOURCE_APPLICATION ); /* - * Check that the fatal user extensions were called with the expected always - * set to false argument. + * Check that the fatal extensions were invoked with the expected always set + * to false argument. + */ + T_step_false( 9, info[ 0 ].always_set_to_false ); + T_step_false( 10, info[ 1 ].always_set_to_false ); + T_step_false( 11, info[ 2 ].always_set_to_false ); + T_step_false( 12, info[ 3 ].always_set_to_false ); + + /* + * Check that the fatal extensions were invoked with the expected code. */ - T_step_false( 8, info[ 0 ].always_set_to_false ); - T_step_false( 9, info[ 1 ].always_set_to_false ); - T_step_false( 10, info[ 2 ].always_set_to_false ); - T_step_false( 11, info[ 3 ].always_set_to_false ); + T_step_eq_ulong( 13, info[ 0 ].code, 123456 ); + T_step_eq_ulong( 14, info[ 1 ].code, 123456 ); + T_step_eq_ulong( 15, info[ 2 ].code, 123456 ); + T_step_eq_ulong( 16, info[ 3 ].code, 123456 ); /* - * Check that the fatal user extensions were called with the expected code. + * Check that the fatal extensions were invoked in forward order. */ - T_step_eq_ulong( 12, info[ 0 ].code, 123456 ); - T_step_eq_ulong( 13, info[ 1 ].code, 123456 ); - T_step_eq_ulong( 14, info[ 2 ].code, 123456 ); - T_step_eq_ulong( 15, info[ 3 ].code, 123456 ); + T_step_eq_uint( 17, info[ 0 ].counter, 1 ); + T_step_eq_uint( 18, info[ 1 ].counter, 2 ); + T_step_eq_uint( 19, info[ 2 ].counter, 3 ); + T_step_eq_uint( 20, info[ 3 ].counter, 4 ); /* - * Check that the fatal user extensions were called in forward order. + * Check that the fatal extension in the deleted extension set was not + * invoked. */ - T_step_eq_uint( 16, info[ 0 ].counter, 1 ); - T_step_eq_uint( 17, info[ 1 ].counter, 2 ); - T_step_eq_uint( 18, info[ 2 ].counter, 3 ); - T_step_eq_uint( 19, info[ 3 ].counter, 4 ); + T_step_eq_int( 21, info[ 4 ].source, 0 ); + T_step_false( 22, info[ 4 ].always_set_to_false ); + T_step_eq_ulong( 23, info[ 4 ].code, 0 ); + T_step_eq_uint( 24, info[ 4 ].counter, 0 ); /* * Check that the system state is terminated. */ - T_step_eq_int( 20, _System_state_Get(), SYSTEM_STATE_TERMINATED ); + T_step_eq_int( 25, _System_state_Get(), SYSTEM_STATE_TERMINATED ); /* * Where the system was built with SMP support enabled, check that a shutdown @@ -310,22 +347,22 @@ static void ScoreInterrValTerminate_Action_0( void ) _Per_CPU_Get_state( _Per_CPU_Get() ) == PER_CPU_STATE_SHUTDOWN ); _ISR_Set_level( 0 ); #endif - T_step_true( 21, shutdown_ok ); + T_step_true( 26, shutdown_ok ); /* * Check that the system was halted with the expected fatal source. */ - T_step_eq_int( 22, halt_source, RTEMS_FATAL_SOURCE_APPLICATION ); + T_step_eq_int( 27, halt_source, RTEMS_FATAL_SOURCE_APPLICATION ); /* * Check that the system was halted with the expected fatal code. */ - T_step_eq_ulong( 23, halt_code, 123456 ); + T_step_eq_ulong( 28, halt_code, 123456 ); /* * Check that the system was finally halted. */ - T_step_eq_uint( 24, counter, 5 ); + T_step_eq_uint( 29, counter, 5 ); } /** @@ -333,7 +370,7 @@ static void ScoreInterrValTerminate_Action_0( void ) */ T_TEST_CASE( ScoreInterrValTerminate ) { - T_plan( 25 ); + T_plan( 30 ); ScoreInterrValTerminate_Action_0(); } |