summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-20 08:07:56 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-24 12:02:01 +0200
commit196cf4ba47419e7e06514eeeee8594078497d357 (patch)
tree01a5ee4d1a5fea19a549468f5c2fccaefe137e7e
parentspec: Specify timeout with priority inherit (diff)
downloadrtems-central-196cf4ba47419e7e06514eeeee8594078497d357.tar.bz2
spec: Update due to API changes
-rw-r--r--spec/bsp/req/interrupt-spurious.yml13
-rw-r--r--spec/rtems/message/req/receive.yml4
-rw-r--r--spec/rtems/sem/req/obtain.yml4
-rw-r--r--spec/rtems/sem/req/timeout.yml4
-rw-r--r--spec/rtems/sem/val/smp.yml11
-rw-r--r--spec/rtems/task/req/delete.yml25
-rw-r--r--spec/rtems/task/req/exit.yml11
-rw-r--r--spec/rtems/task/req/restart.yml25
-rw-r--r--spec/score/mtx/req/seize-wait.yml2
-rw-r--r--spec/score/sem/req/seize-wait.yml6
-rw-r--r--spec/score/smp/val/fatal.yml24
-rw-r--r--spec/score/val/fatal.yml137
12 files changed, 122 insertions, 144 deletions
diff --git a/spec/bsp/req/interrupt-spurious.yml b/spec/bsp/req/interrupt-spurious.yml
index 59a7bcec..d423df32 100644
--- a/spec/bsp/req/interrupt-spurious.yml
+++ b/spec/bsp/req/interrupt-spurious.yml
@@ -171,7 +171,7 @@ test-setup:
rtems_interrupt_entry_initialize( &ctx->entry, EntryRoutine, ctx, "Info" );
test_case_active = true;
- SetFatalExtension( FatalExtension );
+ SetFatalHandler( Fatal, ctx );
description: null
test-stop: null
test-support: |
@@ -207,16 +207,15 @@ test-support: |
ProcessInterrupt( ctx );
}
- static void FatalExtension(
+ static void Fatal(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Context *ctx;
- ctx = T_fixture_context();
- T_false( always_set_to_false );
+ ctx = arg;
ctx->fatal_source = source;
ctx->fatal_code = code;
++ctx->fatal_counter;
@@ -246,7 +245,7 @@ test-target: testsuites/validation/tc-bsp-interrupt-spurious.c
test-teardown:
brief: null
code: |
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
test_case_active = false;
description: null
text: ${.:text-template}
diff --git a/spec/rtems/message/req/receive.yml b/spec/rtems/message/req/receive.yml
index b32b9eb7..a2918954 100644
--- a/spec/rtems/message/req/receive.yml
+++ b/spec/rtems/message/req/receive.yml
@@ -273,7 +273,7 @@ pre-conditions:
${../../option/if/no-wait:/name} option.
- name: Timeout
test-code: |
- ctx->tq_ctx.wait = TQ_WAIT_TICKS;
+ ctx->tq_ctx.wait = TQ_WAIT_TIMED;
ctx->option_set_param = RTEMS_WAIT;
ctx->timeout_param = timeout_ticks;
text: |
@@ -768,7 +768,7 @@ test-support: |
option_set = RTEMS_WAIT;
timeout = RTEMS_NO_TIMEOUT;
break;
- case TQ_WAIT_TICKS:
+ case TQ_WAIT_TIMED:
option_set = RTEMS_WAIT;
timeout = UINT32_MAX;
break;
diff --git a/spec/rtems/sem/req/obtain.yml b/spec/rtems/sem/req/obtain.yml
index 6fed26f5..2e0a3b34 100644
--- a/spec/rtems/sem/req/obtain.yml
+++ b/spec/rtems/sem/req/obtain.yml
@@ -179,7 +179,7 @@ pre-conditions:
${../../option/if/no-wait:/name} option.
- name: Timeout
test-code: |
- ctx->tq_ctx.wait = TQ_WAIT_TICKS;
+ ctx->tq_ctx.wait = TQ_WAIT_TIMED;
text: |
While the ${../if/obtain:/params[1]/name} parameter indicates the
${../../option/if/wait:/name} option, while the
@@ -268,6 +268,8 @@ test-setup:
brief: null
code: |
memset( ctx, 0, sizeof( *ctx ) );
+ ctx->tq_ctx.enqueue_prepare = TQEnqueuePrepareDefault;
+ ctx->tq_ctx.enqueue_done = TQSurrenderClassicSem;
ctx->tq_ctx.enqueue = TQEnqueueClassicSem;
ctx->tq_ctx.surrender = TQSurrenderClassicSem;
ctx->tq_ctx.get_owner = TQGetOwnerClassicSem;
diff --git a/spec/rtems/sem/req/timeout.yml b/spec/rtems/sem/req/timeout.yml
index ce7dc3b4..30303432 100644
--- a/spec/rtems/sem/req/timeout.yml
+++ b/spec/rtems/sem/req/timeout.yml
@@ -139,8 +139,8 @@ test-setup:
brief: null
code: |
memset( ctx, 0, sizeof( *ctx ) );
- ctx->tq_ctx.wait = TQ_WAIT_TICKS;
- ctx->tq_ctx.enqueue_prepare = TQEnqueuePrepareClassicSem;
+ ctx->tq_ctx.wait = TQ_WAIT_TIMED;
+ ctx->tq_ctx.enqueue_prepare = TQEnqueuePrepareDefault;
ctx->tq_ctx.enqueue_done = TQSurrenderClassicSem;
ctx->tq_ctx.enqueue = TQEnqueueClassicSem;
ctx->tq_ctx.surrender = TQSurrenderClassicSem;
diff --git a/spec/rtems/sem/val/smp.yml b/spec/rtems/sem/val/smp.yml
index 68e51ab1..fb063e0e 100644
--- a/spec/rtems/sem/val/smp.yml
+++ b/spec/rtems/sem/val/smp.yml
@@ -31,7 +31,7 @@ test-actions:
SetScheduler( worker_id, scheduler_b_id, PRIO_NORMAL );
ObtainMutex( ctx->mutex_id );
- SetFatalExtension( BadEnqueueFatal );
+ SetFatalHandler( BadEnqueueFatal, ctx );
StartTask( worker_id, BadEnqueueTask, ctx );
while ( !ctx->done ) {
@@ -270,27 +270,26 @@ test-support: |
static void BadEnqueueFatal(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Per_CPU_Control *cpu_self;
Context *ctx;
T_eq_int( source, INTERNAL_ERROR_CORE );
- T_false( always_set_to_false );
T_eq_ulong(
code,
INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE
);
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
cpu_self = _Per_CPU_Get();
_Thread_Dispatch_unnest( cpu_self );
_Thread_Dispatch_unnest( cpu_self );
- ctx = T_fixture_context();
+ ctx = arg;
ctx->done = true;
SuspendSelf();
}
diff --git a/spec/rtems/task/req/delete.yml b/spec/rtems/task/req/delete.yml
index 7f9519bf..4c886abe 100644
--- a/spec/rtems/task/req/delete.yml
+++ b/spec/rtems/task/req/delete.yml
@@ -724,7 +724,7 @@ test-setup:
);
T_rsc_success( sc );
- SetFatalExtension( Fatal );
+ SetFatalHandler( Fatal, ctx );
SetTaskSwitchExtension( TaskSwitch );
SetSelfPriority( PRIO_NORMAL );
@@ -802,39 +802,34 @@ test-support: |
static void Fatal(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Context *ctx;
T_eq_int( source, INTERNAL_ERROR_CORE );
- T_false( always_set_to_false );
T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
- ctx = T_fixture_context();
+ ctx = arg;
++ctx->calls.fatal;
T_assert_eq_int( ctx->calls.fatal, 1 );
-
- ctx = T_fixture_context();
longjmp( ctx->thread_dispatch_context, 1 );
}
static void ResumeThreadDispatch(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Context *ctx;
T_eq_int( source, INTERNAL_ERROR_CORE );
- T_false( always_set_to_false );
T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
- SetFatalExtension( Fatal );
-
- ctx = T_fixture_context();
+ ctx = arg;
+ SetFatalHandler( Fatal, ctx );
longjmp( ctx->thread_dispatch_context, 1 );
}
@@ -931,7 +926,7 @@ test-support: |
if ( ctx->blocked ) {
Per_CPU_Control *cpu_self;
- SetFatalExtension( ResumeThreadDispatch );
+ SetFatalHandler( ResumeThreadDispatch, ctx );
cpu_self = _Thread_Dispatch_disable();
if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
@@ -1103,7 +1098,7 @@ test-teardown:
sc = rtems_extension_delete( ctx->extension_id );
T_rsc_success( sc );
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
SetTaskSwitchExtension( NULL );
DeleteTask( ctx->deleter_id );
DeleteTask( ctx->deleter_2_id );
diff --git a/spec/rtems/task/req/exit.yml b/spec/rtems/task/req/exit.yml
index 5b4d7b0b..521b136e 100644
--- a/spec/rtems/task/req/exit.yml
+++ b/spec/rtems/task/req/exit.yml
@@ -340,7 +340,7 @@ test-setup:
);
T_rsc_success( sc );
- SetFatalExtension( Fatal );
+ SetFatalHandler( Fatal, ctx );
SetSelfPriority( PRIO_NORMAL );
ctx->deleter_id = CreateTask( "DELE", PRIO_HIGH );
@@ -421,19 +421,18 @@ test-support: |
static void Fatal(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Context *ctx;
T_scheduler_log *log;
Per_CPU_Control *cpu_self;
- ctx = T_fixture_context();
+ ctx = arg;
++ctx->fatal_extension_calls;
T_eq_int( source, INTERNAL_ERROR_CORE );
- T_false( always_set_to_false );
T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
T_assert_eq_int( ctx->fatal_extension_calls, 1 );
@@ -496,7 +495,7 @@ test-teardown:
sc = rtems_extension_delete( ctx->extension_id );
T_rsc_success( sc );
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
DeleteTask( ctx->deleter_id );
RestoreRunnerASR();
RestoreRunnerPriority();
diff --git a/spec/rtems/task/req/restart.yml b/spec/rtems/task/req/restart.yml
index ed6cbf67..813ecf97 100644
--- a/spec/rtems/task/req/restart.yml
+++ b/spec/rtems/task/req/restart.yml
@@ -882,7 +882,7 @@ test-setup:
);
T_rsc_success( sc );
- SetFatalExtension( Fatal );
+ SetFatalHandler( Fatal, ctx );
SetSelfPriority( PRIO_NORMAL );
ctx->deleter_id = CreateTask( "DELE", PRIO_HIGH );
@@ -1038,18 +1038,17 @@ test-support: |
static void Fatal(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Context *ctx;
Per_CPU_Control *cpu_self;
T_eq_int( source, INTERNAL_ERROR_CORE );
- T_false( always_set_to_false );
T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
- ctx = T_fixture_context();
+ ctx = arg;
++ctx->calls.fatal;
T_assert_eq_int( ctx->calls.fatal, 1 );
@@ -1062,19 +1061,17 @@ test-support: |
static void ResumeThreadDispatch(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Context *ctx;
T_eq_int( source, INTERNAL_ERROR_CORE );
- T_false( always_set_to_false );
T_eq_ulong( code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
- SetFatalExtension( Fatal );
-
- ctx = T_fixture_context();
+ ctx = arg;
+ SetFatalHandler( Fatal, ctx );
longjmp( ctx->thread_dispatch_context, 1 );
}
@@ -1084,7 +1081,7 @@ test-support: |
)
{
WrapThreadQueueExtract( &ctx->wrap_tq_ctx, ctx->worker_tcb );
- SetFatalExtension( ResumeThreadDispatch );
+ SetFatalHandler( ResumeThreadDispatch, ctx );
if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
(void) rtems_task_restart(
@@ -1111,7 +1108,7 @@ test-support: |
if ( ctx->interrupt || ctx->nested_request ) {
if ( ctx->blocked ) {
- SetFatalExtension( ResumeThreadDispatch );
+ SetFatalHandler( ResumeThreadDispatch, ctx );
cpu_self = _Thread_Dispatch_disable();
if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
@@ -1258,7 +1255,7 @@ test-teardown:
sc = rtems_extension_delete( ctx->extension_id );
T_rsc_success( sc );
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
DeleteTask( ctx->deleter_id );
ReleaseMutex( ctx->mutex_id );
DeleteMutex( ctx->mutex_id );
diff --git a/spec/score/mtx/req/seize-wait.yml b/spec/score/mtx/req/seize-wait.yml
index ae7dbbde..84394417 100644
--- a/spec/score/mtx/req/seize-wait.yml
+++ b/spec/score/mtx/req/seize-wait.yml
@@ -325,8 +325,6 @@ test-local-includes:
- tr-tq-enqueue-mrsp.h
- tr-tq-enqueue-priority.h
test-prepare: |
- ctx->tq_ctx->base.enqueue_prepare = TQEnqueuePrepareClassicSem;
- ctx->tq_ctx->base.enqueue_done = TQSurrenderClassicSem;
ctx->owner_caller = false;
ctx->owner_other = false;
ctx->deadlock = false;
diff --git a/spec/score/sem/req/seize-wait.yml b/spec/score/sem/req/seize-wait.yml
index ee2eef69..cbb5297f 100644
--- a/spec/score/sem/req/seize-wait.yml
+++ b/spec/score/sem/req/seize-wait.yml
@@ -78,7 +78,7 @@ pre-conditions:
states:
- name: Zero
test-code: |
- /* Done by TQEnqueuePrepareClassicSem() */
+ /* Done by TQEnqueuePrepareDefault() */
text: |
While the count of the semaphore is zero.
- name: Positive
@@ -119,7 +119,7 @@ test-local-includes:
- tr-tq-enqueue-fifo.h
- tr-tq-enqueue-priority.h
test-prepare: |
- ctx->tq_ctx->base.enqueue_prepare = TQEnqueuePrepareClassicSem;
+ ctx->tq_ctx->base.enqueue_prepare = TQEnqueuePrepareDefault;
ctx->tq_ctx->base.enqueue_done = TQSurrenderClassicSem;
ctx->tq_ctx->base.get_properties = GetProperties;
test-setup: null
@@ -147,7 +147,7 @@ test-support: |
ctx->base.worker_id[ enqueued_worker ]
);
- if ( base->wait == TQ_WAIT_TICKS ) {
+ if ( base->wait == TQ_WAIT_TIMED ) {
T_eq_int( timer_state, T_THREAD_TIMER_SCHEDULED );
} else {
T_eq_int( timer_state, T_THREAD_TIMER_INACTIVE );
diff --git a/spec/score/smp/val/fatal.yml b/spec/score/smp/val/fatal.yml
index fd66eb4f..d30da8fe 100644
--- a/spec/score/smp/val/fatal.yml
+++ b/spec/score/smp/val/fatal.yml
@@ -49,7 +49,7 @@ test-actions:
action-code: |
Per_CPU_Control *cpu;
- SetFatalExtension( FatalRecordAndJump );
+ SetFatalHandler( FatalRecordAndJump, ctx );
cpu = _Per_CPU_Get_by_index( 0 );
_Per_CPU_Submit_job( cpu, &job );
@@ -63,13 +63,12 @@ test-actions:
1
);
T_step_eq_int( ${step}, fatal_source, RTEMS_FATAL_SOURCE_SMP );
- T_step_false( ${step}, fatal_always_set_to_false );
T_step_eq_ulong(
${step},
fatal_code,
SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS
);
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
checks: []
links:
- role: validation
@@ -80,7 +79,7 @@ test-actions:
action-code: |
Per_CPU_Control *cpu;
- SetFatalExtension( FatalRecordAndJump );
+ SetFatalHandler( FatalRecordAndJump, ctx );
/*
* This element is outside the array. This is not an issue since
@@ -99,13 +98,12 @@ test-actions:
2
);
T_step_eq_int( ${step}, fatal_source, RTEMS_FATAL_SOURCE_SMP );
- T_step_false( ${step}, fatal_always_set_to_false );
T_step_eq_ulong(
${step},
fatal_code,
SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR
);
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
checks: []
links:
- role: validation
@@ -116,7 +114,7 @@ test-actions:
action-code: |
Per_CPU_Control *cpu;
- SetFatalExtension( FatalRecordAndJump );
+ SetFatalHandler( FatalRecordAndJump, ctx );
cpu = _Per_CPU_Get_by_index( 2 );
if ( setjmp( fatal_before ) == 0 ) {
@@ -129,13 +127,12 @@ test-actions:
3
);
T_step_eq_int( ${step}, fatal_source, RTEMS_FATAL_SOURCE_SMP );
- T_step_false( ${step}, fatal_always_set_to_false );
T_step_eq_ulong(
${step},
fatal_code,
SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR
);
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
checks: []
links:
- role: validation
@@ -193,18 +190,17 @@ test-support: |
static rtems_fatal_source fatal_source;
- static bool fatal_always_set_to_false;
-
static rtems_fatal_code fatal_code;
static void FatalRecordAndJump(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
+ (void) arg;
+
fatal_source = source;
- fatal_always_set_to_false = always_set_to_false;
fatal_code = code;
_Atomic_Fetch_add_uint( &fatal_counter, 1, ATOMIC_ORDER_RELAXED );
longjmp( fatal_before, 1 );
diff --git a/spec/score/val/fatal.yml b/spec/score/val/fatal.yml
index 68a2c782..13d6a3f7 100644
--- a/spec/score/val/fatal.yml
+++ b/spec/score/val/fatal.yml
@@ -11,17 +11,16 @@ test-actions:
rtems_id id;
unsigned int counter;
- SetFatalExtension( FatalTaskExit );
+ SetFatalHandler( FatalTaskExit, ctx );
SetSelfPriority( PRIO_NORMAL );
- counter = ResetFatalInfo();
+ counter = ResetFatalInfo( ctx );
id = CreateTask( "EXIT", PRIO_HIGH );
StartTask( id, ExitTask, NULL );
- T_eq_uint( GetFatalCounter(), counter + 1 );
- T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE );
- T_false( fatal_info.always_set_to_false );
- T_eq_ulong( fatal_info.code, INTERNAL_ERROR_THREAD_EXITTED );
+ T_eq_uint( GetFatalCounter( ctx ), counter + 1 );
+ T_eq_int( ctx->source, INTERNAL_ERROR_CORE );
+ T_eq_ulong( ctx->code, INTERNAL_ERROR_THREAD_EXITTED );
RestoreRunnerPriority();
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
checks: []
links:
- role: validation
@@ -34,30 +33,26 @@ test-actions:
rtems_id id;
unsigned int counter;
- SetFatalExtension( FatalBadThreadDispatchEnvironment );
+ SetFatalHandler( FatalBadThreadDispatchEnvironment, ctx );
SetSelfPriority( PRIO_NORMAL );
- counter = ResetFatalInfo();
+ counter = ResetFatalInfo( ctx );
id = CreateTask( "BENV", PRIO_HIGH );
StartTask( id, ISRDisabledThreadDispatchTask, NULL );
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
if ( rtems_configuration_get_maximum_processors() > 1 ) {
#endif
- T_eq_uint( GetFatalCounter(), counter + 1 );
- T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE );
- T_false( fatal_info.always_set_to_false );
- T_eq_ulong(
- fatal_info.code,
- INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT
- );
+ T_eq_uint( GetFatalCounter( ctx ), counter + 1 );
+ T_eq_int( ctx->source, INTERNAL_ERROR_CORE );
+ T_eq_ulong( ctx->code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT );
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
} else {
- T_eq_uint( GetFatalCounter(), counter );
+ T_eq_uint( GetFatalCounter( ctx ), counter );
}
#endif
RestoreRunnerPriority();
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
checks: []
links:
- role: validation
@@ -73,20 +68,16 @@ test-actions:
rtems_id id;
unsigned int counter;
- SetFatalExtension( FatalBadThreadDispatchDisableLevel );
+ SetFatalHandler( FatalBadThreadDispatchDisableLevel, ctx );
SetSelfPriority( PRIO_NORMAL );
- counter = ResetFatalInfo();
+ counter = ResetFatalInfo( ctx );
id = CreateTask( "BLVL", PRIO_HIGH );
StartTask( id, BadLevelThreadDispatchTask, NULL );
- T_eq_uint( GetFatalCounter(), counter + 1 );
- T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE );
- T_false( fatal_info.always_set_to_false );
- T_eq_ulong(
- fatal_info.code,
- INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL
- );
+ T_eq_uint( GetFatalCounter( ctx ), counter + 1 );
+ T_eq_int( ctx->source, INTERNAL_ERROR_CORE );
+ T_eq_ulong( ctx->code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL );
RestoreRunnerPriority();
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
checks: []
links:
- role: validation
@@ -113,9 +104,9 @@ test-actions:
deadlock_mutex = CreateMutex();
- SetFatalExtension( FatalThreadQueueDeadlock );
+ SetFatalHandler( FatalThreadQueueDeadlock, ctx );
SetSelfPriority( PRIO_NORMAL );
- counter = ResetFatalInfo();
+ counter = ResetFatalInfo( ctx );
ObtainMutex( deadlock_mutex );
@@ -128,16 +119,12 @@ test-actions:
ReleaseMutex( deadlock_mutex );
- T_eq_uint( GetFatalCounter(), counter + 1 );
- T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE );
- T_false( fatal_info.always_set_to_false );
- T_eq_ulong(
- fatal_info.code,
- INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK
- );
+ T_eq_uint( GetFatalCounter( ctx ), counter + 1 );
+ T_eq_int( ctx->source, INTERNAL_ERROR_CORE );
+ T_eq_ulong( ctx->code, INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK );
RestoreRunnerPriority();
- SetFatalExtension( NULL );
+ SetFatalHandler( NULL, NULL );
sc = rtems_extension_delete( extension_id );
T_rsc_success( sc );
@@ -149,7 +136,22 @@ test-actions:
uid: ../object/req/fatal-allocator-mutex-deadlock
test-brief: |
Tests some fatal errors.
-test-context: []
+test-context:
+- brief: |
+ This member is a fatal extension invocation counter.
+ description: null
+ member: |
+ Atomic_Uint counter
+- brief: |
+ This member contains the last fatal source.
+ description: null
+ member: |
+ rtems_fatal_source source
+- brief: |
+ This member contains the last fatal code.
+ description: null
+ member: |
+ rtems_fatal_code code
test-context-support: null
test-description: null
test-header: null
@@ -165,48 +167,39 @@ test-local-includes:
test-setup: null
test-stop: null
test-support: |
- typedef struct {
- Atomic_Uint counter;
- rtems_fatal_source source;
- bool always_set_to_false;
- rtems_fatal_code code;
- } FatalInfo;
-
- static FatalInfo fatal_info;
+ typedef ${.:/test-context-type} Context;
- static unsigned int GetFatalCounter( void )
+ static unsigned int GetFatalCounter( const Context *ctx )
{
- return _Atomic_Load_uint( &fatal_info.counter, ATOMIC_ORDER_RELAXED );
+ return _Atomic_Load_uint( &ctx->counter, ATOMIC_ORDER_RELAXED );
}
- static unsigned int ResetFatalInfo( void )
+ static unsigned int ResetFatalInfo( Context *ctx )
{
- fatal_info.source = RTEMS_FATAL_SOURCE_APPLICATION;
- fatal_info.always_set_to_false = true;
- fatal_info.code = INTERNAL_ERROR_NO_MPCI;
+ ctx->source = RTEMS_FATAL_SOURCE_APPLICATION;
+ ctx->code = INTERNAL_ERROR_NO_MPCI;
- return GetFatalCounter();
+ return GetFatalCounter( ctx );
}
static void Fatal(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ Context *ctx
)
{
- fatal_info.source = source;
- fatal_info.always_set_to_false = always_set_to_false;
- fatal_info.code = code;
- _Atomic_Fetch_add_uint( &fatal_info.counter, 1, ATOMIC_ORDER_RELAXED );
+ ctx->source = source;
+ ctx->code = code;
+ _Atomic_Fetch_add_uint( &ctx->counter, 1, ATOMIC_ORDER_RELAXED );
}
static void FatalTaskExit(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
- Fatal( source, always_set_to_false, code );
+ Fatal( source, code, arg );
rtems_task_exit();
}
@@ -217,11 +210,11 @@ test-support: |
static void FatalBadThreadDispatchEnvironment(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
- Fatal( source, always_set_to_false, code );
+ Fatal( source, code, arg );
_ISR_Set_level( 0 );
_Thread_Dispatch_direct_no_return( _Per_CPU_Get() );
}
@@ -238,13 +231,13 @@ test-support: |
static void FatalBadThreadDispatchDisableLevel(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
Per_CPU_Control *cpu_self;
- Fatal( source, always_set_to_false, code );
+ Fatal( source, code, arg );
cpu_self = _Per_CPU_Get();
_Thread_Dispatch_unnest( cpu_self );
_Thread_Dispatch_direct_no_return( cpu_self );
@@ -274,11 +267,11 @@ test-support: |
static void FatalThreadQueueDeadlock(
rtems_fatal_source source,
- bool always_set_to_false,
- rtems_fatal_code code
+ rtems_fatal_code code,
+ void *arg
)
{
- Fatal( source, always_set_to_false, code );
+ Fatal( source, code, arg );
longjmp( before_deadlock, 1 );
}