mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 06:54:41 +08:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user