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.
This commit is contained in:
Sebastian Huber
2014-10-23 17:15:47 +02:00
parent a420327390
commit 17889b257c
2 changed files with 18 additions and 4 deletions
+9 -2
View File
@@ -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
+9 -2
View File
@@ -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