[rtems commit] tests/smptests: Use barriers in smpfatal0{12}

Sebastian Huber sebh at rtems.org
Thu Oct 23 15:08:52 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Oct 23 17:15:47 2014 +0200

tests/smptests: Use barriers in smpfatal0{12}

Call the test extension explicitly and wait for report output using a
barrier.  This avoids problems with an early shutdown of the system.

---

 testsuites/smptests/smpfatal01/init.c |   11 +++++++++--
 testsuites/smptests/smpfatal02/init.c |   11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/testsuites/smptests/smpfatal01/init.c b/testsuites/smptests/smpfatal01/init.c
index 5ef9ffe..7f565d6 100644
--- a/testsuites/smptests/smpfatal01/init.c
+++ b/testsuites/smptests/smpfatal01/init.c
@@ -20,6 +20,7 @@
 #include <rtems/test.h>
 #include <rtems/score/percpu.h>
 #include <rtems/score/smpimpl.h>
+#include <rtems/score/smpbarrier.h>
 
 #include <assert.h>
 #include <stdlib.h>
@@ -30,6 +31,8 @@ const char rtems_test_name[] = "SMPFATAL 1";
 
 static uint32_t main_cpu;
 
+static SMP_barrier_Control barrier = SMP_BARRIER_CONTROL_INITIALIZER;
+
 static void Init(rtems_task_argument arg)
 {
   assert(0);
@@ -41,6 +44,8 @@ static void fatal_extension(
   rtems_fatal_code code
 )
 {
+  SMP_barrier_State barrier_state = SMP_BARRIER_STATE_INITIALIZER;
+
   if (source == RTEMS_FATAL_SOURCE_SMP) {
     uint32_t self = rtems_get_current_processor();
 
@@ -58,8 +63,11 @@ static void fatal_extension(
       }
 
       rtems_test_endk();
+      rtems_test_fatal_extension(source, is_internal, code);
     }
   }
+
+  _SMP_barrier_Wait(&barrier, &barrier_state, rtems_get_processor_count());
 }
 
 static rtems_status_code test_driver_init(
@@ -114,8 +122,7 @@ static rtems_status_code test_driver_init(
   { .initialization_entry = test_driver_init }
 
 #define CONFIGURE_INITIAL_EXTENSIONS \
-  { .fatal = fatal_extension }, \
-  RTEMS_TEST_INITIAL_EXTENSION
+  { .fatal = fatal_extension }
 
 #define CONFIGURE_SMP_APPLICATION
 
diff --git a/testsuites/smptests/smpfatal02/init.c b/testsuites/smptests/smpfatal02/init.c
index 266251f..72d1ff5 100644
--- a/testsuites/smptests/smpfatal02/init.c
+++ b/testsuites/smptests/smpfatal02/init.c
@@ -20,6 +20,7 @@
 #include <rtems/test.h>
 #include <rtems/score/percpu.h>
 #include <rtems/score/smpimpl.h>
+#include <rtems/score/smpbarrier.h>
 
 #include <assert.h>
 #include <stdlib.h>
@@ -30,6 +31,8 @@ const char rtems_test_name[] = "SMPFATAL 2";
 
 static uint32_t main_cpu;
 
+static SMP_barrier_Control barrier = SMP_BARRIER_CONTROL_INITIALIZER;
+
 static void Init(rtems_task_argument arg)
 {
   assert(0);
@@ -41,6 +44,8 @@ static void fatal_extension(
   rtems_fatal_code code
 )
 {
+  SMP_barrier_State barrier_state = SMP_BARRIER_STATE_INITIALIZER;
+
   if (
     source == RTEMS_FATAL_SOURCE_APPLICATION
       || source == RTEMS_FATAL_SOURCE_SMP
@@ -63,11 +68,14 @@ static void fatal_extension(
       }
 
       rtems_test_endk();
+      rtems_test_fatal_extension(source, is_internal, code);
     } else {
       assert(source == RTEMS_FATAL_SOURCE_SMP);
       assert(code == SMP_FATAL_SHUTDOWN);
     }
   }
+
+  _SMP_barrier_Wait(&barrier, &barrier_state, rtems_get_processor_count());
 }
 
 static rtems_status_code test_driver_init(
@@ -119,8 +127,7 @@ static rtems_status_code test_driver_init(
   { .initialization_entry = test_driver_init }
 
 #define CONFIGURE_INITIAL_EXTENSIONS \
-  { .fatal = fatal_extension }, \
-  RTEMS_TEST_INITIAL_EXTENSION
+  { .fatal = fatal_extension }
 
 #define CONFIGURE_SMP_APPLICATION
 



More information about the vc mailing list