[rtems commit] smpthreadlife01: Fix due to robust thread dispatch

Sebastian Huber sebh at rtems.org
Fri Dec 2 12:57:03 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Dec  2 13:39:40 2016 +0100

smpthreadlife01: Fix due to robust thread dispatch

Update #2811.

---

 testsuites/smptests/smpthreadlife01/init.c | 32 ++++++++++++++++++------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/testsuites/smptests/smpthreadlife01/init.c b/testsuites/smptests/smpthreadlife01/init.c
index 2867be7..8b9079c 100644
--- a/testsuites/smptests/smpthreadlife01/init.c
+++ b/testsuites/smptests/smpthreadlife01/init.c
@@ -265,10 +265,6 @@ static void delay_switch_task(rtems_task_argument arg)
 {
   test_context *ctx = &test_instance;
   rtems_status_code sc;
-  ISR_Level level;
-
-  _ISR_Local_disable(level);
-  (void) level;
 
   ctx->delay_switch_for_executing = _Thread_Get_executing();
 
@@ -331,34 +327,42 @@ typedef enum {
 
 static void op_begin_suspend(void)
 {
-  rtems_task_suspend(RTEMS_SELF);
-  rtems_test_assert(0);
+  rtems_status_code sc;
+
+  sc = rtems_task_suspend(RTEMS_SELF);
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
 }
 
 static void op_begin_event(void)
 {
+  rtems_status_code sc;
   rtems_event_set events;
 
-  rtems_event_receive(
+  events = 0;
+  sc = rtems_event_receive(
     RTEMS_EVENT_0,
     RTEMS_EVENT_ALL | RTEMS_WAIT,
     RTEMS_NO_TIMEOUT,
     &events
   );
-  rtems_test_assert(0);
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+  rtems_test_assert(events == RTEMS_EVENT_0);
 }
 
 static void op_begin_event_system(void)
 {
+  rtems_status_code sc;
   rtems_event_set events;
 
-  rtems_event_system_receive(
+  events = 0;
+  sc = rtems_event_system_receive(
     RTEMS_EVENT_0,
     RTEMS_EVENT_ALL | RTEMS_WAIT,
     RTEMS_NO_TIMEOUT,
     &events
   );
-  rtems_test_assert(0);
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+  rtems_test_assert(events == RTEMS_EVENT_0);
 }
 
 static void (*const test_ops_begin[])(void) = {
@@ -401,10 +405,9 @@ static void op_worker_task(rtems_task_argument arg)
 {
   test_context *ctx = &test_instance;
   test_op op = arg;
-  ISR_Level level;
+  Thread_Life_state previous_life_state;
 
-  _ISR_Local_disable(level);
-  (void) level;
+  previous_life_state = _Thread_Set_life_protection(THREAD_LIFE_PROTECTED);
 
   /* (E) */
   barrier(ctx, &ctx->worker_barrier_state);
@@ -413,6 +416,9 @@ static void op_worker_task(rtems_task_argument arg)
   barrier(ctx, &ctx->worker_barrier_state);
 
   (*test_ops_begin[op])();
+
+  _Thread_Set_life_protection(previous_life_state);
+  rtems_test_assert(0);
 }
 
 static void help_task(rtems_task_argument arg)




More information about the vc mailing list