[rtems-central commit] spec: Update due to API changes

Sebastian Huber sebh at rtems.org
Fri Sep 24 11:32:07 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    196cf4ba47419e7e06514eeeee8594078497d357
Changeset: http://git.rtems.org/rtems-central/commit/?id=196cf4ba47419e7e06514eeeee8594078497d357

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Sep 20 08:07:56 2021 +0200

spec: Update due to API changes

---

 spec/bsp/req/interrupt-spurious.yml |  13 ++--
 spec/rtems/message/req/receive.yml  |   4 +-
 spec/rtems/sem/req/obtain.yml       |   4 +-
 spec/rtems/sem/req/timeout.yml      |   4 +-
 spec/rtems/sem/val/smp.yml          |  11 ++-
 spec/rtems/task/req/delete.yml      |  25 +++----
 spec/rtems/task/req/exit.yml        |  11 ++-
 spec/rtems/task/req/restart.yml     |  25 +++----
 spec/score/mtx/req/seize-wait.yml   |   2 -
 spec/score/sem/req/seize-wait.yml   |   6 +-
 spec/score/smp/val/fatal.yml        |  24 +++----
 spec/score/val/fatal.yml            | 137 +++++++++++++++++-------------------
 12 files changed, 122 insertions(+), 144 deletions(-)

diff --git a/spec/bsp/req/interrupt-spurious.yml b/spec/bsp/req/interrupt-spurious.yml
index 59a7bce..d423df3 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 b32b9eb..a291895 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 6fed26f..2e0a3b3 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 ce7dc3b..3030343 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 68e51ab..fb063e0 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 7f9519b..4c886ab 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 5b4d7b0..521b136 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 ed6cbf6..813ecf9 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 ae7dbbd..8439441 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 ee2eef6..cbb5297 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 fd66eb4..d30da8f 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 68a2c78..13d6a3f 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 );
   }
 



More information about the vc mailing list