summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2024-03-07 09:29:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2024-04-17 11:24:05 +0200
commit05f8d633dfd206486b822a654b9d8f8f1957af93 (patch)
tree816a478c31e0931336a6293f4921b4e90552617f
parentspec: Specify Xilinx TTC clock driver (diff)
downloadrtems-central-05f8d633dfd206486b822a654b9d8f8f1957af93.tar.bz2
spec: Improve bad thread dispatch validation
-rw-r--r--spec/score/val/fatal.yml68
1 files changed, 59 insertions, 9 deletions
diff --git a/spec/score/val/fatal.yml b/spec/score/val/fatal.yml
index d5e414ab..09664807 100644
--- a/spec/score/val/fatal.yml
+++ b/spec/score/val/fatal.yml
@@ -1,12 +1,12 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
-- Copyright (C) 2021 embedded brains GmbH & Co. KG
+- Copyright (C) 2021, 2024 embedded brains GmbH & Co. KG
enabled-by: true
links: []
test-actions:
- action-brief: |
Construct a task with a task body which returns. Check that the right
- fatal error occurs.
+ fatal error occurred.
action-code: |
rtems_id id;
unsigned int counter;
@@ -26,9 +26,10 @@ test-actions:
- role: validation
uid: ../thread/req/fatal-thread-exitted
- action-brief: |
- Construct a task which performs a thread dispatch with maskable interrupts
- disabled. Check that the right fatal error occurs or no fatal error
- occurs.
+ Construct a task which performs a direct thread dispatch with maskable
+ interrupts disabled. Where robust thread dispatching is required, check
+ that the right fatal error occurred, otherwise check that no fatal error
+ occurred.
action-code: |
rtems_id id;
unsigned int counter;
@@ -37,7 +38,44 @@ test-actions:
SetSelfPriority( PRIO_NORMAL );
counter = ResetFatalInfo( ctx );
id = CreateTask( "BENV", PRIO_HIGH );
- StartTask( id, ISRDisabledThreadDispatchTask, NULL );
+ StartTask( id, ISRDisabledDirectThreadDispatchTask, NULL );
+
+ #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
+ if ( rtems_configuration_get_maximum_processors() > 1 ) {
+ #endif
+ 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( ctx ), counter );
+ }
+ #endif
+
+ RestoreRunnerPriority();
+ SetFatalHandler( NULL, NULL );
+ checks: []
+ links:
+ - role: validation
+ uid: ../thread/req/fatal-bad-thread-dispatch-environment-ipi
+ - role: validation
+ uid: ../thread/req/fatal-bad-thread-dispatch-environment-robust
+ - role: validation
+ uid: ../thread/req/thread-dispatch-isr-disabled
+- action-brief: |
+ Construct a task which performs an on demand thread dispatch with maskable
+ interrupts disabled. Where robust thread dispatching is required, check
+ that the right fatal error occurred, otherwise check that no fatal error
+ occurred.
+ action-code: |
+ rtems_id id;
+ unsigned int counter;
+
+ SetFatalHandler( FatalBadThreadDispatchEnvironment, ctx );
+ SetSelfPriority( PRIO_NORMAL );
+ counter = ResetFatalInfo( ctx );
+ id = CreateTask( "BENV", PRIO_HIGH );
+ StartTask( id, ISRDisabledOnDemandThreadDispatchTask, NULL );
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
if ( rtems_configuration_get_maximum_processors() > 1 ) {
@@ -63,7 +101,8 @@ test-actions:
uid: ../thread/req/thread-dispatch-isr-disabled
- action-brief: |
Construct a task which performs a direct thread dispatch with a thread
- dispatch level not equal to one. Check that the right fatal error occurs.
+ dispatch level not equal to one. Check that the right fatal error
+ occurred.
action-code: |
rtems_id id;
unsigned int counter;
@@ -238,10 +277,11 @@ test-support: |
{
Fatal( source, code, arg );
_ISR_Set_level( 0 );
- _Thread_Dispatch_direct_no_return( _Per_CPU_Get() );
+ _Thread_Dispatch_unnest( _Per_CPU_Get() );
+ rtems_task_exit();
}
- static void ISRDisabledThreadDispatchTask( rtems_task_argument arg )
+ static void ISRDisabledDirectThreadDispatchTask( rtems_task_argument arg )
{
rtems_interrupt_level level;
@@ -251,6 +291,16 @@ test-support: |
rtems_task_exit();
}
+ static void ISRDisabledOnDemandThreadDispatchTask( rtems_task_argument arg )
+ {
+ rtems_interrupt_level level;
+
+ (void) arg;
+ rtems_interrupt_local_disable( level );
+ (void) level;
+ SetSelfPriority( PRIO_VERY_HIGH );
+ }
+
static void FatalBadThreadDispatchDisableLevel(
rtems_fatal_source source,
rtems_fatal_code code,