[PATCH] smptests: Print proper end of test message

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 23 12:20:29 UTC 2023


Make sure that the end of test message is not mixed up with other test
output.
---
 testsuites/smptests/smp05/init.c  | 8 ++++++++
 testsuites/smptests/smp07/init.c  | 4 ++--
 testsuites/smptests/smp08/tasks.c | 8 ++++++--
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
index c8a9da2131..eb6461f3bc 100644
--- a/testsuites/smptests/smp05/init.c
+++ b/testsuites/smptests/smp05/init.c
@@ -35,6 +35,8 @@
 
 const char rtems_test_name[] = "SMP 5";
 
+static volatile bool init_task_done;
+
 rtems_task Init(
   rtems_task_argument argument
 );
@@ -54,6 +56,10 @@ rtems_task Test_task(
   rtems_task_argument argument
 )
 {
+  while (!init_task_done) {
+    /* Wait */
+  }
+
   locked_printf( "Shut down from CPU %" PRIu32 "\n", rtems_scheduler_get_processor() );
   success();
 }
@@ -95,6 +101,8 @@ rtems_task Init(
     directive_failed( status, "task start" );
   }
 
+  init_task_done = true;
+
   while (1)
     ;
 }
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
index 3e1a852bd4..7066720a47 100644
--- a/testsuites/smptests/smp07/init.c
+++ b/testsuites/smptests/smp07/init.c
@@ -78,8 +78,6 @@ rtems_task Test_task(
   if ( !TSRFired )
     locked_printf( "*** ERROR TSR DID NOT FIRE BUT TEST TASK AWAKE***" );
 
-  TaskRan = true;
-
   /* Print that the task is up and running. */
   locked_printf(
     " CPU %" PRIu32 " running Task %s after semaphore release\n",
@@ -87,6 +85,8 @@ rtems_task Test_task(
     name
   );
 
+  TaskRan = true;
+
   rtems_task_exit();
 }
 
diff --git a/testsuites/smptests/smp08/tasks.c b/testsuites/smptests/smp08/tasks.c
index b71f437027..446c0d11da 100644
--- a/testsuites/smptests/smp08/tasks.c
+++ b/testsuites/smptests/smp08/tasks.c
@@ -54,8 +54,12 @@ rtems_task Test_task(
     status = rtems_clock_get_tod( &time );
     rtems_test_assert( status == RTEMS_SUCCESSFUL );
     if ( time.second >= 35 ) {
-      TEST_END();
-      rtems_test_exit( 0 );
+      if ( task_index == 1 ) {
+        TEST_END();
+        rtems_test_exit( 0 );
+      } else {
+        rtems_task_exit();
+      }
     }
 
     PrintTaskInfo( p, &time );
-- 
2.35.3



More information about the devel mailing list