diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-08-06 19:12:55 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-08-06 19:15:57 +0200 |
commit | 32f1f747cc7789d105f16227cafbe96b0371ae4d (patch) | |
tree | b66b55adf56bdceb1d29ef1ebcb4bb9e71319fb8 /testsuites/libtests/ttest02 | |
parent | psxhdrs/strncpy/stpncpy: Fix string turncation warning (diff) | |
download | rtems-32f1f747cc7789d105f16227cafbe96b0371ae4d.tar.bz2 |
libtest: Fix T_interrupt_test() in SMP configs
Update #3199.
Diffstat (limited to 'testsuites/libtests/ttest02')
-rw-r--r-- | testsuites/libtests/ttest02/init.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testsuites/libtests/ttest02/init.c b/testsuites/libtests/ttest02/init.c index 0f907e15ec..78c874faf7 100644 --- a/testsuites/libtests/ttest02/init.c +++ b/testsuites/libtests/ttest02/init.c @@ -152,6 +152,60 @@ T_TEST_CASE(TestInterruptFatal) T_unreachable(); } +static void +suspend(void *arg) +{ + rtems_status_code sc; + rtems_id *id; + + id = arg; + sc = rtems_task_suspend(*id); + T_step_rsc_success(1, sc); +} + +static T_interrupt_test_state +do_nothing(void *arg) +{ + (void)arg; + return T_INTERRUPT_TEST_ACTION; +} + +static void +resume(void *arg) +{ + T_interrupt_test_state state; + + state = T_interrupt_test_change_state(T_INTERRUPT_TEST_ACTION, + T_INTERRUPT_TEST_DONE); + + if (state == T_INTERRUPT_TEST_ACTION) { + rtems_status_code sc; + rtems_id *id; + + id = arg; + sc = rtems_task_resume(*id); + T_step_rsc_success(0, sc); + } +} + +static const T_interrupt_test_config blocked_config = { + .action = suspend, + .interrupt = do_nothing, + .blocked = resume, + .max_iteration_count = 10000 +}; + +T_TEST_CASE(TestInterruptBlocked) +{ + T_interrupt_test_state state; + rtems_id id; + + T_plan(3); + id = rtems_task_self(); + state = T_interrupt_test(&blocked_config, &id); + T_step_eq_int(2, state, T_INTERRUPT_TEST_DONE); +} + const char rtems_test_name[] = "TTEST 2"; static void |