[rtems commit] testsuites: Use _Thread_Get_executing()

Sebastian Huber sebh at rtems.org
Mon Jul 22 14:51:42 UTC 2013


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jul 22 09:16:58 2013 +0200

testsuites: Use _Thread_Get_executing()

---

 testsuites/libtests/stackchk/blow.c        |    6 ++++--
 testsuites/psxtests/psxobj01/init.c        |    2 +-
 testsuites/psxtests/psxsignal05/init.c     |    2 +-
 testsuites/sptests/sp34/changepri.c        |    9 +++++----
 testsuites/sptests/sp35/priinv.c           |    9 +++++----
 testsuites/sptests/spintrcritical10/init.c |    2 +-
 testsuites/sptests/spintrcritical16/init.c |    2 +-
 testsuites/sptests/spthreadq01/init.c      |    2 +-
 testsuites/tmtests/tm25/task1.c            |    2 ++
 9 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/testsuites/libtests/stackchk/blow.c b/testsuites/libtests/stackchk/blow.c
index 5bcc8ee..8db9d25 100644
--- a/testsuites/libtests/stackchk/blow.c
+++ b/testsuites/libtests/stackchk/blow.c
@@ -30,6 +30,7 @@ void blow_stack(void)
 {
   volatile uint32_t   *low, *high;
   unsigned char *area;
+  Thread_Control *executing;
 
   b();
 
@@ -38,13 +39,14 @@ void blow_stack(void)
    *  does not cause problems :)
    */
 
-  area = (unsigned char *)_Thread_Executing->Start.Initial_stack.area;
+  executing = _Thread_Get_executing();
+  area = (unsigned char *)executing->Start.Initial_stack.area;
 
   /* Look in the stack checker implementation for this magic offset */
   low  = (volatile uint32_t *) \
      (area + sizeof(Heap_Block) - HEAP_BLOCK_HEADER_SIZE);
   high = (volatile uint32_t *)
-             (area + _Thread_Executing->Start.Initial_stack.size - 16);
+             (area + executing->Start.Initial_stack.size - 16);
 
   low[0] = 0x11111111;
   low[1] = 0x22222222;
diff --git a/testsuites/psxtests/psxobj01/init.c b/testsuites/psxtests/psxobj01/init.c
index 3f639da..6bddee7 100644
--- a/testsuites/psxtests/psxobj01/init.c
+++ b/testsuites/psxtests/psxobj01/init.c
@@ -76,7 +76,7 @@ rtems_task Init(
   puts( "INIT - _Objects_Set_name fails - out of memory" );
   rtems_workspace_greedy_allocate( NULL, 0 );
 
-  bc = _Objects_Set_name( &TestClass, &_Thread_Executing->Object, name );
+  bc = _Objects_Set_name( &TestClass, &_Thread_Get_executing()->Object, name );
   rtems_test_assert( bc == false );
 
   puts( "*** END OF POSIX OBJECT TEST 1 ***" );
diff --git a/testsuites/psxtests/psxsignal05/init.c b/testsuites/psxtests/psxsignal05/init.c
index 04c7879..3541bec 100644
--- a/testsuites/psxtests/psxsignal05/init.c
+++ b/testsuites/psxtests/psxsignal05/init.c
@@ -77,7 +77,7 @@ void *POSIX_Init(
   _POSIX_signals_Pending |= signo_to_mask( SIGUSR1 );
 
   bc = _POSIX_signals_Clear_signals(
-    _Thread_Executing->API_Extensions[ THREAD_API_POSIX ],
+    _Thread_Get_executing()->API_Extensions[ THREAD_API_POSIX ],
     SIGNAL_ONE,
     &info,
     true,              /* is_global */
diff --git a/testsuites/sptests/sp34/changepri.c b/testsuites/sptests/sp34/changepri.c
index 705a1e0..d78841a 100644
--- a/testsuites/sptests/sp34/changepri.c
+++ b/testsuites/sptests/sp34/changepri.c
@@ -39,9 +39,10 @@ const char *CallerName(void);
 const char *CallerName(void)
 {
   static char buffer[32];
+  Thread_Control *executing = _Thread_Get_executing();
 #if defined(TEST_PRINT_TASK_ID)
   sprintf( buffer, "0x%08x -- %d",
-      rtems_task_self(), _Thread_Executing->current_priority );
+      rtems_task_self(), executing->current_priority );
 #else
   volatile union {
     uint32_t u;
@@ -49,13 +50,13 @@ const char *CallerName(void)
   } TempName;
 
   #if defined(TEST_ON_RTEMS_45)
-    TempName.u = *(uint32_t *)_Thread_Executing->Object.name;
+    TempName.u = *(uint32_t *)executing->Object.name;
   #else
-    TempName.u = _Thread_Executing->Object.name.name_u32;
+    TempName.u = executing->Object.name.name_u32;
   #endif
     sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control,
       TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3],
-      _Thread_Executing->current_priority
+      executing->current_priority
   );
 #endif
   return buffer;
diff --git a/testsuites/sptests/sp35/priinv.c b/testsuites/sptests/sp35/priinv.c
index 24c41d5..ba74c69 100644
--- a/testsuites/sptests/sp35/priinv.c
+++ b/testsuites/sptests/sp35/priinv.c
@@ -81,9 +81,10 @@ void AccessRemoteHw(void);
 const char *CallerName(void)
 {
   static char buffer[32];
+  Thread_Control *executing = _Thread_Get_executing();
 #if defined(TEST_PRINT_TASK_ID)
   sprintf( buffer, "0x%08x -- %d",
-      rtems_task_self(), _Thread_Executing->current_priority );
+      rtems_task_self(), executing->current_priority );
 #else
   volatile union {
     uint32_t u;
@@ -91,13 +92,13 @@ const char *CallerName(void)
   } TempName;
 
   #if defined(TEST_ON_RTEMS_45)
-    TempName.u = *(uint32_t *)_Thread_Executing->Object.name;
+    TempName.u = *(uint32_t *)executing->Object.name;
   #else
-    TempName.u = (uint32_t) _Thread_Executing->Object.name.name_u32;
+    TempName.u = (uint32_t) executing->Object.name.name_u32;
   #endif
   sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control,
       TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3],
-      _Thread_Executing->current_priority
+      executing->current_priority
   );
 #endif
   return buffer;
diff --git a/testsuites/sptests/spintrcritical10/init.c b/testsuites/sptests/spintrcritical10/init.c
index f284780..5334a26 100644
--- a/testsuites/sptests/spintrcritical10/init.c
+++ b/testsuites/sptests/spintrcritical10/init.c
@@ -300,7 +300,7 @@ static rtems_task Init(
 {
   rtems_status_code sc;
   test_context ctx = {
-    .thread = _Thread_Executing
+    .thread = _Thread_Get_executing()
   };
 
   puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION 10 ***" );
diff --git a/testsuites/sptests/spintrcritical16/init.c b/testsuites/sptests/spintrcritical16/init.c
index 4a32de2..cdd862f 100644
--- a/testsuites/sptests/spintrcritical16/init.c
+++ b/testsuites/sptests/spintrcritical16/init.c
@@ -84,7 +84,7 @@ rtems_task Init(
   directive_failed( sc, "rtems_semaphore_create of SM1" );
 
   Main_task = rtems_task_self();
-  Main_TCB  = _Thread_Executing;
+  Main_TCB  = _Thread_Get_executing();
 
   interrupt_critical_section_test_support_initialize( test_release_from_isr );
 
diff --git a/testsuites/sptests/spthreadq01/init.c b/testsuites/sptests/spthreadq01/init.c
index e03efe6..cbe3652 100644
--- a/testsuites/sptests/spthreadq01/init.c
+++ b/testsuites/sptests/spthreadq01/init.c
@@ -34,7 +34,7 @@ void threadq_first_empty(
   _Thread_queue_Initialize( &tq, discipline, 0x01, 3 );
 
   puts( "Init - _Thread_queue_Extract - thread not blocked on a thread queue" );
-  _Thread_queue_Extract( &tq, _Thread_Executing );
+  _Thread_queue_Extract( &tq, _Thread_Get_executing() );
   /* is there anything to check? */
 }
 
diff --git a/testsuites/tmtests/tm25/task1.c b/testsuites/tmtests/tm25/task1.c
index 4730208..887e051 100644
--- a/testsuites/tmtests/tm25/task1.c
+++ b/testsuites/tmtests/tm25/task1.c
@@ -93,7 +93,9 @@ rtems_task Low_task(
 )
 {
   benchmark_timer_initialize();
+  _Thread_Disable_dispatch();
     (void) rtems_clock_tick();
+  _Thread_Enable_dispatch();
   end_time = benchmark_timer_read();
 
   put_time(




More information about the vc mailing list