diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-01-26 11:06:50 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-01-26 11:20:45 +0100 |
commit | 6f6da82ca0b57ed1c42050f8103c2ea2adb3d3e2 (patch) | |
tree | 0a2384e1eed6247010b5d890d078212227956a2a /testsuites/sptests/spextensions01 | |
parent | sapi: Add rtems_task_terminate_extension (diff) | |
download | rtems-6f6da82ca0b57ed1c42050f8103c2ea2adb3d3e2.tar.bz2 |
score: Fix user extensions order
Use forward and reverse order for initial and dynamic extensions. This
is the behaviour documented in the C Users Guide. Change thread
terminate order to backward to be in line with the thread delete order.
Change fatal error order to forward to ensure that initial extensions
are called first due the peculiar execution context of fatal error
extensions, see _Terminate() documentation.
Update #2692.
Diffstat (limited to 'testsuites/sptests/spextensions01')
-rw-r--r-- | testsuites/sptests/spextensions01/init.c | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/testsuites/sptests/spextensions01/init.c b/testsuites/sptests/spextensions01/init.c index ceb9f60527..e8d053eee7 100644 --- a/testsuites/sptests/spextensions01/init.c +++ b/testsuites/sptests/spextensions01/init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016, 2017 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -80,12 +80,6 @@ static void assert_thread_dispatch_disabled_context(void) assert(!life_protected()); } -static void assert_static_order(int index) -{ - assert((counter % active_extensions) == index); - ++counter; -} - static void assert_forward_order(int index) { assert((counter % active_extensions) == index); @@ -94,49 +88,49 @@ static void assert_forward_order(int index) static void assert_reverse_order(int index) { - assert((counter % active_extensions) == (5 - index)); + assert((counter % active_extensions) == (active_extensions - 1 - index)); ++counter; } static bool zero_thread_create(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); assert_allocator_protected_thread_context(); return true; } static void zero_thread_start(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); assert_thread_dispatch_disabled_context(); } static void zero_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); assert_life_protected_thread_context(); } static void zero_thread_delete(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_reverse_order(0); assert_allocator_protected_thread_context(); } static void zero_thread_switch(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); } static void zero_thread_begin(rtems_tcb *a) { - assert_static_order(0); + assert_forward_order(0); assert_normal_thread_context(); } static void zero_thread_exitted(rtems_tcb *a) { - assert_static_order(0); + assert_forward_order(0); assert_normal_thread_context(); } @@ -147,55 +141,55 @@ static void zero_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_static_order(0); + assert_forward_order(0); } } static void zero_thread_terminate(rtems_tcb *a) { - assert_static_order(0); + assert_reverse_order(0); assert_life_protected_thread_context(); } static bool one_thread_create(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); assert_allocator_protected_thread_context(); return true; } static void one_thread_start(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); assert_thread_dispatch_disabled_context(); } static void one_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); assert_life_protected_thread_context(); } static void one_thread_delete(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_reverse_order(1); assert_allocator_protected_thread_context(); } static void one_thread_switch(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); } static void one_thread_begin(rtems_tcb *a) { - assert_static_order(1); + assert_forward_order(1); assert_normal_thread_context(); } static void one_thread_exitted(rtems_tcb *a) { - assert_static_order(1); + assert_forward_order(1); assert_normal_thread_context(); } @@ -206,13 +200,13 @@ static void one_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_static_order(1); + assert_forward_order(1); } } static void one_thread_terminate(rtems_tcb *a) { - assert_static_order(1); + assert_reverse_order(1); assert_life_protected_thread_context(); } @@ -231,7 +225,7 @@ static void two_thread_start(rtems_tcb *a, rtems_tcb *b) static void two_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(2); + assert_forward_order(2); assert_life_protected_thread_context(); } @@ -265,15 +259,13 @@ static void two_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_reverse_order(2); - assert(counter == 72); - TEST_END(); + assert_forward_order(2); } } static void two_thread_terminate(rtems_tcb *a) { - assert_forward_order(2); + assert_reverse_order(2); assert_life_protected_thread_context(); } @@ -292,7 +284,7 @@ static void three_thread_start(rtems_tcb *a, rtems_tcb *b) static void three_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(3); + assert_forward_order(3); assert_life_protected_thread_context(); } @@ -326,13 +318,15 @@ static void three_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_reverse_order(3); + assert_forward_order(3); + assert(counter == 72); + TEST_END(); } } static void three_thread_terminate(rtems_tcb *a) { - assert_forward_order(3); + assert_reverse_order(3); assert_life_protected_thread_context(); } |