summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-05 09:20:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-07 10:15:45 +0200
commitd1b869bee6f1fc60812f5ea26d81de6c2ff52835 (patch)
tree16594b8750c5248a3a74730f1452a77fe900f985
parentspec: Add SMP-only and non-SMP test suites (diff)
downloadrtems-central-d1b869bee6f1fc60812f5ea26d81de6c2ff52835.tar.bz2
spec: Specify scheduler manager directives
-rw-r--r--spec/rtems/scheduler/req/add-processor.yml445
-rw-r--r--spec/rtems/scheduler/req/get-processor-maximum-non-smp.yml16
-rw-r--r--spec/rtems/scheduler/req/get-processor-maximum-smp-only.yml16
-rw-r--r--spec/rtems/scheduler/req/get-processor-non-smp.yml16
-rw-r--r--spec/rtems/scheduler/req/get-processor-set.yml240
-rw-r--r--spec/rtems/scheduler/req/get-processor-smp-only.yml16
-rw-r--r--spec/rtems/scheduler/req/ident-by-processor-set.yml441
-rw-r--r--spec/rtems/scheduler/req/ident-by-processor.yml282
-rw-r--r--spec/rtems/scheduler/req/ident.yml161
-rw-r--r--spec/rtems/scheduler/req/remove-processor.yml303
-rw-r--r--spec/rtems/scheduler/val/non-smp.yml44
-rw-r--r--spec/rtems/scheduler/val/smp-only.yml81
-rw-r--r--spec/testsuites/validation-0.yml2
13 files changed, 2062 insertions, 1 deletions
diff --git a/spec/rtems/scheduler/req/add-processor.yml b/spec/rtems/scheduler/req/add-processor.yml
new file mode 100644
index 00000000..0044cd1b
--- /dev/null
+++ b/spec/rtems/scheduler/req/add-processor.yml
@@ -0,0 +1,445 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: action
+links:
+- role: interface-function
+ uid: ../if/add-processor
+post-conditions:
+- name: Status
+ states:
+ - name: Ok
+ test-code: |
+ T_rsc_success( ctx->status );
+ text: |
+ The return status of ${../if/add-processor:/name} shall be
+ ${../../status/if/successful:/name}.
+ - name: InvId
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ text: |
+ The return status of ${../if/add-processor:/name} shall be
+ ${../../status/if/invalid-id:/name}.
+ - name: NotConf
+ test-code: |
+ T_rsc( ctx->status, RTEMS_NOT_CONFIGURED );
+ text: |
+ The return status of ${../if/add-processor:/name} shall be
+ ${../../status/if/not-configured:/name}.
+ - name: IncStat
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
+ text: |
+ The return status of ${../if/add-processor:/name} shall be
+ ${../../status/if/incorrect-state:/name}.
+ - name: InUse
+ test-code: |
+ T_rsc( ctx->status, RTEMS_RESOURCE_IN_USE );
+ text: |
+ The return status of ${../if/add-processor:/name} shall be
+ ${../../status/if/resource-in-use:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: Added
+ states:
+ - name: 'Yes'
+ test-code: |
+ T_eq_sz( ctx->scheduler_log.header.recorded, 2 );
+ T_eq_int(
+ ctx->scheduler_log.events[ 0 ].operation,
+ T_SCHEDULER_MAP_PRIORITY
+ );
+ T_eq_int(
+ ctx->scheduler_log.events[ 1 ].operation,
+ T_SCHEDULER_ADD_PROCESSOR
+ );
+
+ priority = GetSelfPriority();
+
+ if ( ctx->scheduler_id == ctx->scheduler_c_id ) {
+ SetSelfScheduler( ctx->scheduler_c_id, priority );
+ }
+
+ SetSelfAffinityOne( CPU_TO_ADD );
+ T_eq_u32( rtems_scheduler_get_processor(), CPU_TO_ADD );
+ SetSelfAffinityAll();
+
+ if ( ctx->scheduler_id == ctx->scheduler_c_id ) {
+ SetSelfScheduler( ctx->scheduler_a_id, priority );
+ }
+ text: |
+ The processor specified by the ${../if/add-processor:/params[1]/name}
+ parameter shall be added to the scheduler specified by the
+ ${../if/add-processor:/params[0]/name} by the
+ ${../if/add-processor:/name} call.
+ - name: Nop
+ test-code: |
+ T_eq_sz( ctx->scheduler_log.header.recorded, 0 );
+
+ CPU_ZERO( &set );
+ CPU_SET( CPU_TO_ADD, &set );
+ sc = rtems_task_set_affinity( RTEMS_SELF, sizeof( set ), &set );
+ T_rsc( sc, RTEMS_INVALID_NUMBER );
+ text: |
+ No processor shall be added to a scheduler by the
+ ${../if/add-processor:/name} call.
+ test-epilogue: null
+ test-prologue: |
+ rtems_status_code sc;
+ cpu_set_t set;
+ rtems_task_priority priority;
+pre-conditions:
+- name: HasReady
+ states:
+ - name: Ready
+ test-code: |
+ ctx->scheduler_id = ctx->scheduler_a_id;
+ text: |
+ While the scheduler has at least one ready thread.
+ - name: Empty
+ test-code: |
+ #if defined(RTEMS_SMP)
+ ctx->scheduler_id = ctx->scheduler_c_id;
+ #else
+ ctx->scheduler_id = ctx->scheduler_a_id;
+ #endif
+ text: |
+ While the scheduler has no ready threads.
+ test-epilogue: null
+ test-prologue: null
+- name: Id
+ states:
+ - name: Invalid
+ test-code: |
+ ctx->id = INVALID_ID;
+ text: |
+ While the ${../if/add-processor:/params[0]/name} parameter is not
+ associated with a scheduler.
+ - name: Scheduler
+ test-code: |
+ ctx->id = ctx->scheduler_id;
+ text: |
+ While the ${../if/add-processor:/params[0]/name} parameter is
+ associated with a scheduler.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUIndex
+ states:
+ - name: Valid
+ test-code: |
+ #if defined(RTEMS_SMP)
+ ctx->cpu_index = CPU_TO_ADD;
+ #else
+ ctx->cpu_index = 0;
+ #endif
+ text: |
+ While the ${../if/add-processor:/params[1]/name} parameter is less than
+ the configured processor maximum.
+ - name: Invalid
+ test-code: |
+ ctx->cpu_index = rtems_configuration_get_maximum_processors();
+ text: |
+ While the ${../if/add-processor:/params[1]/name} parameter is greater
+ than or equal to the configured processor maximum.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUState
+ states:
+ - name: Idle
+ test-code: |
+ sc = rtems_scheduler_remove_processor(
+ ctx->scheduler_b_id,
+ CPU_TO_ADD
+ );
+ T_rsc_success( sc );
+ ctx->add_cpu_to_scheduler_b = true;
+ text: |
+ While the processor associated with the
+ ${../if/add-processor:/params[1]/name} parameter is configured to be used
+ by a scheduler, while the processor associated with the
+ ${../if/add-processor:/params[1]/name} parameter is online, while the
+ processor associated with the ${../if/add-processor:/params[1]/name}
+ parameter is not owned by a scheduler.
+ - name: InUse
+ test-code: |
+ /* Nothing to do */
+ text: |
+ While the processor associated with the
+ ${../if/add-processor:/params[1]/name} parameter is owned by a scheduler.
+ - name: NotOnline
+ test-code: |
+ sc = rtems_scheduler_remove_processor(
+ ctx->scheduler_b_id,
+ CPU_TO_ADD
+ );
+ T_rsc_success( sc );
+ ctx->add_cpu_to_scheduler_b = true;
+ #if defined(RTEMS_SMP)
+ ctx->cpu->online = false;
+ #endif
+ text: |
+ While the processor associated with the
+ ${../if/add-processor:/params[1]/name} parameter is not online.
+ - name: NotUsable
+ test-code: |
+ ctx->cpu_index = rtems_configuration_get_maximum_processors() - 1;
+ text: |
+ While the processor associated with the
+ ${../if/add-processor:/params[1]/name} parameter is not configured to be
+ used by a scheduler.
+ test-epilogue: null
+ test-prologue: |
+ rtems_status_code sc;
+rationale: null
+references: []
+requirement-type: functional
+skip-reasons:
+ OnlyOneCPU: |
+ Where the system is build with SMP support disabled, the system has exactly
+ one processor and there is no other processor available to add to a
+ scheduler.
+test-action: |
+ T_scheduler_log *log;
+
+ log = T_scheduler_record_2( &ctx->scheduler_log );
+ T_null( log );
+
+ ctx->status = rtems_scheduler_add_processor( ctx->id, ctx->cpu_index );
+
+ log = T_scheduler_record( NULL );
+ T_eq_ptr( &log->header, &ctx->scheduler_log.header );
+test-brief: null
+test-cleanup: |
+ #if defined(RTEMS_SMP)
+ rtems_status_code sc;
+
+ ctx->cpu->online = ctx->online;
+
+ if ( ctx->status == RTEMS_SUCCESSFUL ) {
+ sc = rtems_scheduler_remove_processor( ctx->scheduler_id, CPU_TO_ADD );
+ T_rsc_success( sc );
+ }
+
+ if ( ctx->add_cpu_to_scheduler_b ) {
+ sc = rtems_scheduler_add_processor( ctx->scheduler_b_id, CPU_TO_ADD );
+ T_rsc_success( sc );
+ }
+ #endif
+test-context:
+- brief: |
+ This member specifies the scheduler used to add the processor.
+ description: null
+ member: |
+ rtems_id scheduler_id
+- brief: |
+ This member contains the identifier of scheduler A.
+ description: null
+ member: |
+ rtems_id scheduler_a_id
+- brief: |
+ This member contains the identifier of scheduler B.
+ description: null
+ member: |
+ rtems_id scheduler_b_id
+- brief: |
+ This member contains the identifier of scheduler C.
+ description: null
+ member: |
+ rtems_id scheduler_c_id
+- brief: |
+ This member references the processor control of the processor to add.
+ description: null
+ member: |
+ Per_CPU_Control *cpu
+- brief: |
+ This member contains the online status of the processor to add before the
+ ${../if/add-processor:/name} call is prepared.
+ description: null
+ member: |
+ bool online;
+- brief: |
+ If this member is true, then the processor should be added to the scheduler
+ B during cleanup.
+ description: null
+ member: |
+ bool add_cpu_to_scheduler_b;
+- brief: |
+ This member provides the scheduler operation records.
+ description: null
+ member: |
+ T_scheduler_log_2 scheduler_log;
+- brief: |
+ This member contains the return value of the
+ ${../if/add-processor:/name} call.
+ description: null
+ member: |
+ rtems_status_code status
+- brief: |
+ This member specifies if the ${../if/add-processor:/params[0]/name}
+ parameter value.
+ description: null
+ member: |
+ rtems_id id
+- brief: |
+ This member specifies if the ${../if/add-processor:/params[1]/name}
+ parameter value.
+ description: null
+ member: |
+ uint32_t cpu_index
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+- rtems/test-scheduler.h
+- rtems/score/percpu.h
+test-local-includes:
+- ts-config.h
+- tx-support.h
+test-prepare: |
+ #if defined(RTEMS_SMP)
+ ctx->add_cpu_to_scheduler_b = false;
+ ctx->online = _Per_CPU_Is_processor_online( ctx->cpu );
+ #endif
+test-setup:
+ brief: null
+ code: |
+ rtems_status_code sc;
+
+ sc = rtems_scheduler_ident(
+ TEST_SCHEDULER_A_NAME,
+ &ctx->scheduler_a_id
+ );
+ T_rsc_success( sc );
+
+ #if defined(RTEMS_SMP)
+ ctx->cpu = _Per_CPU_Get_by_index( CPU_TO_ADD );
+
+ sc = rtems_scheduler_ident( TEST_SCHEDULER_B_NAME, &ctx->scheduler_b_id );
+ T_rsc_success( sc );
+
+ sc = rtems_scheduler_ident( TEST_SCHEDULER_C_NAME, &ctx->scheduler_c_id );
+ T_rsc_success( sc );
+ #else
+ ctx->scheduler_b_id = INVALID_ID;
+ ctx->scheduler_c_id = INVALID_ID;
+ #endif
+ description: null
+test-stop: null
+test-support: |
+ #define INVALID_ID 0xffffffff
+
+ #define CPU_TO_ADD 1
+test-target: testsuites/validation/tc-scheduler-add-processor.c
+test-teardown: null
+text: ${.:text-template}
+transition-map:
+- enabled-by: true
+ post-conditions:
+ Status: InvId
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Invalid
+ CPUIndex:
+ - Valid
+ CPUState:
+ - InUse
+- enabled-by: true
+ post-conditions:
+ Status: InvId
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Invalid
+ CPUIndex:
+ - Invalid
+ CPUState: N/A
+- enabled-by: true
+ post-conditions:
+ Status: NotConf
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Invalid
+ CPUState: N/A
+- enabled-by: true
+ post-conditions:
+ Status: InUse
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+ CPUState:
+ - InUse
+- enabled-by: true
+ post-conditions: OnlyOneCPU
+ pre-conditions:
+ HasReady: all
+ Id: all
+ CPUIndex:
+ - Valid
+ CPUState:
+ - Idle
+ - NotOnline
+ - NotUsable
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: Ok
+ Added: 'Yes'
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+ CPUState:
+ - Idle
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: InvId
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Invalid
+ CPUIndex:
+ - Valid
+ CPUState:
+ - Idle
+ - NotOnline
+ - NotUsable
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: NotConf
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+ CPUState:
+ - NotUsable
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: IncStat
+ Added: Nop
+ pre-conditions:
+ HasReady: all
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+ CPUState:
+ - NotOnline
+type: requirement
diff --git a/spec/rtems/scheduler/req/get-processor-maximum-non-smp.yml b/spec/rtems/scheduler/req/get-processor-maximum-non-smp.yml
new file mode 100644
index 00000000..1b8057d6
--- /dev/null
+++ b/spec/rtems/scheduler/req/get-processor-maximum-non-smp.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by:
+ not: RTEMS_SMP
+links:
+- role: interface-function
+ uid: ../if/get-processor-maximum
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ The ${../if/get-processor-maximum:/name} directive call shall be a constant
+ expression which evaluates to one.
+type: requirement
diff --git a/spec/rtems/scheduler/req/get-processor-maximum-smp-only.yml b/spec/rtems/scheduler/req/get-processor-maximum-smp-only.yml
new file mode 100644
index 00000000..e7f46ea8
--- /dev/null
+++ b/spec/rtems/scheduler/req/get-processor-maximum-smp-only.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+links:
+- role: interface-function
+ uid: ../if/get-processor-maximum
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ The return value of the ${../if/get-processor-maximum:/name} directive shall
+ be the minimum of the processors available at the ${/glossary/target:/term}
+ and the ${/acfg/if/max-processors} application configuration option value.
+type: requirement
diff --git a/spec/rtems/scheduler/req/get-processor-non-smp.yml b/spec/rtems/scheduler/req/get-processor-non-smp.yml
new file mode 100644
index 00000000..4e9dd035
--- /dev/null
+++ b/spec/rtems/scheduler/req/get-processor-non-smp.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by:
+ not: RTEMS_SMP
+links:
+- role: interface-function
+ uid: ../if/get-processor
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ The ${../if/get-processor:/name} directive call shall be a constant
+ expression which evaluates to zero.
+type: requirement
diff --git a/spec/rtems/scheduler/req/get-processor-set.yml b/spec/rtems/scheduler/req/get-processor-set.yml
new file mode 100644
index 00000000..db3b1d88
--- /dev/null
+++ b/spec/rtems/scheduler/req/get-processor-set.yml
@@ -0,0 +1,240 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: action
+links:
+- role: interface-function
+ uid: ../if/get-processor-set
+post-conditions:
+- name: Status
+ states:
+ - name: Ok
+ test-code: |
+ T_rsc_success( ctx->status );
+ text: |
+ The return status of ${../if/get-processor-set:/name} shall be
+ ${../../status/if/successful:/name}.
+ - name: InvAddr
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ text: |
+ The return status of ${../if/get-processor-set:/name} shall be
+ ${../../status/if/invalid-address:/name}.
+ - name: InvId
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ text: |
+ The return status of ${../if/get-processor-set:/name} shall be
+ ${../../status/if/invalid-id:/name}.
+ - name: InvSize
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_SIZE );
+ text: |
+ The return status of ${../if/get-processor-set:/name} shall be
+ ${../../status/if/invalid-size:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSetVar
+ states:
+ - name: Set
+ test-code: |
+ CPU_ZERO( &set );
+ CPU_SET( 0, &set );
+ T_eq_int( CPU_CMP( &ctx->cpuset_value, &set ), 0 );
+ text: |
+ The value of the object referenced by the
+ ${../if/get-processor-set:/params[2]/name} parameter shall be set to the
+ processor set owned by the scheduler specified by the
+ ${../if/get-processor-set:/params[0]/name} parameter at some point during
+ the call after the return of the ${../if/get-processor-set:/name} call.
+ - name: Nop
+ test-code: |
+ CPU_FILL( &set );
+ T_eq_int( CPU_CMP( &ctx->cpuset_value, &set ), 0 );
+ text: |
+ Objects referenced by the ${../if/get-processor-set:/params[2]/name}
+ parameter in past calls to ${../if/get-processor-set:/name} shall
+ not be accessed by the ${../if/get-processor-set:/name} call.
+ test-epilogue: null
+ test-prologue: |
+ cpu_set_t set;
+pre-conditions:
+- name: Id
+ states:
+ - name: Invalid
+ test-code: |
+ ctx->id = INVALID_ID;
+ text: |
+ While the ${../if/get-processor-set:/params[0]/name} parameter is not
+ associated with a scheduler.
+ - name: Scheduler
+ test-code: |
+ ctx->id = ctx->scheduler_id;
+ text: |
+ While the ${../if/get-processor-set:/params[0]/name} parameter is
+ associated with a scheduler.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSetSize
+ states:
+ - name: Valid
+ test-code: |
+ ctx->cpusetsize = sizeof( ctx->cpuset_value );
+ text: |
+ While the ${../if/get-processor-set:/params[1]/name} parameter is an
+ integral multiple of the size of long, while the
+ ${../if/get-processor-set:/params[1]/name} parameter specifies a
+ processor set which is large enough to contain the processor set of the
+ scheduler.
+ - name: TooSmall
+ test-code: |
+ ctx->cpusetsize = 0;
+ text: |
+ While the ${../if/get-processor-set:/params[1]/name} parameter is an
+ integral multiple of the size of long, while the
+ ${../if/get-processor-set:/params[1]/name} parameter specifies a
+ processor set which is not large enough to contain the processor set of
+ the scheduler.
+ - name: Askew
+ test-code: |
+ ctx->cpusetsize = SIZE_MAX;
+ text: |
+ While the ${../if/get-processor-set:/params[1]/name} parameter is not an
+ integral multiple of the size of long.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSet
+ states:
+ - name: Valid
+ test-code: |
+ ctx->cpuset = &ctx->cpuset_value;
+ text: |
+ While the ${../if/get-processor-set:/params[2]/name} parameter
+ references an object of type ${/c/if/cpu_set_t:/name}.
+ - name: 'Null'
+ test-code: |
+ ctx->cpuset = NULL;
+ text: |
+ While the ${../if/get-processor-set:/params[2]/name} parameter is
+ equal to ${/c/if/null:/name}.
+ test-epilogue: null
+ test-prologue: null
+rationale: null
+references: []
+requirement-type: functional
+skip-reasons: {}
+test-action: |
+ ctx->status = rtems_scheduler_get_processor_set(
+ ctx->id,
+ ctx->cpusetsize,
+ ctx->cpuset
+ );
+test-brief: null
+test-cleanup: null
+test-context:
+- brief: |
+ This member contains the identifier of a scheduler.
+ description: null
+ member: |
+ rtems_id scheduler_id
+- brief: |
+ This member provides the object referenced by the
+ ${../if/get-processor-set:/params[1]/name} parameter.
+ description: null
+ member: |
+ cpu_set_t cpuset_value
+- brief: |
+ This member contains the return value of the
+ ${../if/get-processor-set:/name} call.
+ description: null
+ member: |
+ rtems_status_code status
+- brief: |
+ This member specifies if the ${../if/get-processor-set:/params[0]/name}
+ parameter value.
+ description: null
+ member: |
+ rtems_id id
+- brief: |
+ This member specifies if the ${../if/get-processor-set:/params[1]/name}
+ parameter value.
+ description: null
+ member: |
+ size_t cpusetsize
+- brief: |
+ This member specifies if the ${../if/get-processor-set:/params[2]/name}
+ parameter value.
+ description: null
+ member: |
+ cpu_set_t *cpuset
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes:
+- ts-config.h
+test-prepare: |
+ CPU_FILL( &ctx->cpuset_value );
+test-setup:
+ brief: null
+ code: |
+ rtems_status_code sc;
+
+ sc = rtems_scheduler_ident(
+ TEST_SCHEDULER_A_NAME,
+ &ctx->scheduler_id
+ );
+ T_rsc_success( sc );
+ description: null
+test-stop: null
+test-support: |
+ #define INVALID_ID 0xffffffff
+test-target: testsuites/validation/tc-scheduler-get-processor-set.c
+test-teardown: null
+text: ${.:text-template}
+transition-map:
+- enabled-by: true
+ post-conditions:
+ Status: Ok
+ CPUSetVar: Set
+ pre-conditions:
+ Id:
+ - Scheduler
+ CPUSetSize:
+ - Valid
+ CPUSet:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ CPUSetVar: Nop
+ pre-conditions:
+ Id: all
+ CPUSetSize: all
+ CPUSet:
+ - 'Null'
+- enabled-by: true
+ post-conditions:
+ Status: InvId
+ CPUSetVar: Nop
+ pre-conditions:
+ Id:
+ - Invalid
+ CPUSetSize: all
+ CPUSet:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvSize
+ CPUSetVar: Nop
+ pre-conditions:
+ Id:
+ - Scheduler
+ CPUSetSize:
+ - TooSmall
+ - Askew
+ CPUSet:
+ - Valid
+type: requirement
diff --git a/spec/rtems/scheduler/req/get-processor-smp-only.yml b/spec/rtems/scheduler/req/get-processor-smp-only.yml
new file mode 100644
index 00000000..0fc3030b
--- /dev/null
+++ b/spec/rtems/scheduler/req/get-processor-smp-only.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+links:
+- role: interface-function
+ uid: ../if/get-processor
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+ The return value of the ${../if/get-processor:/name} directive shall be the
+ index of a processor which executed at least one instruction of the directive
+ call.
+type: requirement
diff --git a/spec/rtems/scheduler/req/ident-by-processor-set.yml b/spec/rtems/scheduler/req/ident-by-processor-set.yml
new file mode 100644
index 00000000..65e1cc35
--- /dev/null
+++ b/spec/rtems/scheduler/req/ident-by-processor-set.yml
@@ -0,0 +1,441 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: action
+links:
+- role: interface-function
+ uid: ../if/ident-by-processor-set
+post-conditions:
+- name: Status
+ states:
+ - name: Ok
+ test-code: |
+ T_rsc_success( ctx->status );
+ text: |
+ The return status of ${../if/ident-by-processor-set:/name} shall be
+ ${../../status/if/successful:/name}.
+ - name: InvAddr
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ text: |
+ The return status of ${../if/ident-by-processor-set:/name} shall be
+ ${../../status/if/invalid-address:/name}.
+ - name: InvSize
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_SIZE );
+ text: |
+ The return status of ${../if/ident-by-processor-set:/name} shall be
+ ${../../status/if/invalid-size:/name}.
+ - name: InvName
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_NAME );
+ text: |
+ The return status of ${../if/ident-by-processor-set:/name} shall be
+ ${../../status/if/invalid-name:/name}.
+ - name: IncStat
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
+ text: |
+ The return status of ${../if/ident-by-processor-set:/name} shall be
+ ${../../status/if/invalid-name:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: IdVar
+ states:
+ - name: Set
+ test-code: |
+ T_eq_u32( ctx->id_value, 0x0f010001 );
+ text: |
+ The value of the object referenced by the
+ ${../if/ident-by-processor-set:/params[2]/name} parameter shall be set to
+ the identifier of the scheduler which owned the highest numbered online
+ processor specified by the
+ ${../if/ident-by-processor-set:/params[0]/name}
+ ${../if/ident-by-processor-set:/params[1]/name} parameters at some point
+ during the call after the return of the
+ ${../if/ident-by-processor-set:/name} call.
+ - name: Nop
+ test-code: |
+ T_eq_u32( ctx->id_value, INVALID_ID );
+ text: |
+ Objects referenced by the ${../if/ident-by-processor-set:/params[2]/name}
+ parameter in past calls to ${../if/ident-by-processor-set:/name} shall
+ not be accessed by the ${../if/ident-by-processor-set:/name} call.
+ test-epilogue: null
+ test-prologue: null
+pre-conditions:
+- name: CPUOwnedByScheduler
+ states:
+ - name: 'Yes'
+ test-code: |
+ ctx->cpu_has_scheduler = true;
+ text: |
+ While the highest numbered online processor specified by the processor
+ set is owned by a scheduler.
+ - name: 'No'
+ test-code: |
+ ctx->cpu_has_scheduler = false;
+ text: |
+ While the highest numbered online processor specified by the processor
+ set is not owned by a scheduler.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSetObj
+ states:
+ - name: Invalid
+ test-code: |
+ CPU_ZERO( &ctx->cpuset_value );
+ text: |
+ While the processor set contains no online processor.
+ - name: Valid
+ test-code: |
+ CPU_ZERO( &ctx->cpuset_value );
+
+ if ( ctx->cpu_has_scheduler ) {
+ CPU_SET( 0, &ctx->cpuset_value );
+ } else {
+ CPU_SET( 1, &ctx->cpuset_value );
+ }
+ text: |
+ While the processor set contains at least one online processor.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSetSize
+ states:
+ - name: Valid
+ test-code: |
+ ctx->cpusetsize = sizeof( ctx->cpuset_value );
+ text: |
+ While the ${../if/ident-by-processor-set:/params[0]/name} parameter is
+ an integral multiple of the size of long.
+ - name: Invalid
+ test-code: |
+ ctx->cpusetsize = 1;
+ text: |
+ While the ${../if/ident-by-processor-set:/params[0]/name} parameter is
+ not an integral multiple of the size of long.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUSet
+ states:
+ - name: Valid
+ test-code: |
+ ctx->cpuset = &ctx->cpuset_value;
+ text: |
+ While the ${../if/ident-by-processor-set:/params[1]/name} parameter
+ references an object of type ${/c/if/cpu_set_t:/name}.
+ - name: 'Null'
+ test-code: |
+ ctx->cpuset = NULL;
+ text: |
+ While the ${../if/ident-by-processor-set:/params[1]/name} parameter is
+ equal to ${/c/if/null:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: Id
+ states:
+ - name: Valid
+ test-code: |
+ ctx->id_value = INVALID_ID;
+ ctx->id = &ctx->id_value;
+ text: |
+ While the ${../if/ident-by-processor-set:/params[2]/name} parameter
+ references an object of type ${../../type/if/id:/name}.
+ - name: 'Null'
+ test-code: |
+ ctx->id = NULL;
+ text: |
+ While the ${../if/ident-by-processor-set:/params[2]/name} parameter is
+ equal to ${/c/if/null:/name}.
+ test-epilogue: null
+ test-prologue: null
+rationale: null
+references: []
+requirement-type: functional
+skip-reasons:
+ OnlyOneCPU: |
+ Where the system is build with SMP support disabled, the system has exactly
+ one processor available and this processor is always owned by a scheduler.
+test-action: |
+ #if defined(RTEMS_SMP)
+ rtems_status_code sc;
+
+ if ( !ctx->cpu_has_scheduler ) {
+ sc = rtems_scheduler_remove_processor( ctx->second_scheduler_id, 1 );
+ T_rsc_success( sc );
+ }
+ #endif
+
+ ctx->status = rtems_scheduler_ident_by_processor_set(
+ ctx->cpusetsize,
+ ctx->cpuset,
+ ctx->id
+ );
+
+ #if defined(RTEMS_SMP)
+ if ( !ctx->cpu_has_scheduler ) {
+ sc = rtems_scheduler_add_processor( ctx->second_scheduler_id, 1 );
+ T_rsc_success( sc );
+ }
+ #endif
+test-brief: null
+test-cleanup: null
+test-context:
+- brief: |
+ This member contains the identifier of a second scheduler.
+ description: null
+ member: |
+ rtems_id second_scheduler_id
+- brief: |
+ This member provides the object referenced by the
+ ${../if/ident-by-processor-set:/params[1]/name} parameter.
+ description: null
+ member: |
+ cpu_set_t cpuset_value
+- brief: |
+ This member provides the object referenced by the
+ ${../if/ident-by-processor-set:/params[2]/name} parameter.
+ description: null
+ member: |
+ rtems_id id_value
+- brief: |
+ If this member is true, then the processor specified by the
+ ${../if/ident-by-processor-set:/params[0]/name} parameter shall be owned by a
+ scheduler.
+ description: null
+ member: |
+ bool cpu_has_scheduler
+- brief: |
+ This member contains the return value of the
+ ${../if/ident-by-processor-set:/name} call.
+ description: null
+ member: |
+ rtems_status_code status
+- brief: |
+ This member specifies if the
+ ${../if/ident-by-processor-set:/params[0]/name} parameter value.
+ description: null
+ member: |
+ size_t cpusetsize
+- brief: |
+ This member specifies if the
+ ${../if/ident-by-processor-set:/params[1]/name} parameter value.
+ description: null
+ member: |
+ const cpu_set_t *cpuset
+- brief: |
+ This member specifies if the
+ ${../if/ident-by-processor-set:/params[2]/name} parameter value.
+ description: null
+ member: |
+ rtems_id *id
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes:
+- ts-config.h
+test-prepare: |
+ ctx->id_value = INVALID_ID;
+test-setup:
+ brief: null
+ code: |
+ #if defined(RTEMS_SMP)
+ rtems_status_code sc;
+
+ sc = rtems_scheduler_ident(
+ TEST_SCHEDULER_B_NAME,
+ &ctx->second_scheduler_id
+ );
+ T_rsc_success( sc );
+ #else
+ ctx->second_scheduler_id = INVALID_ID;
+ #endif
+ description: null
+test-stop: null
+test-support: |
+ #define INVALID_ID 0xffffffff
+test-target: testsuites/validation/tc-scheduler-ident-by-processor-set.c
+test-teardown: null
+text: ${.:text-template}
+transition-map:
+- enabled-by: true
+ post-conditions:
+ Status: Ok
+ IdVar: Set
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'Yes'
+ CPUSetObj:
+ - Valid
+ CPUSetSize:
+ - Valid
+ CPUSet:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'Yes'
+ CPUSetObj:
+ - Valid
+ CPUSetSize: all
+ CPUSet: all
+ Id:
+ - 'Null'
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler: N/A
+ CPUSetObj:
+ - Invalid
+ CPUSetSize: all
+ CPUSet: all
+ Id:
+ - 'Null'
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'Yes'
+ CPUSetObj:
+ - Valid
+ CPUSetSize: all
+ CPUSet:
+ - 'Null'
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler: N/A
+ CPUSetObj:
+ - Invalid
+ CPUSetSize: all
+ CPUSet:
+ - 'Null'
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvSize
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'Yes'
+ CPUSetObj:
+ - Valid
+ CPUSetSize:
+ - Invalid
+ CPUSet:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvSize
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler: N/A
+ CPUSetObj:
+ - Invalid
+ CPUSetSize:
+ - Invalid
+ CPUSet:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvName
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler: N/A
+ CPUSetObj:
+ - Invalid
+ CPUSetSize:
+ - Valid
+ CPUSet:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions: OnlyOneCPU
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUSetObj:
+ - Valid
+ CPUSetSize: all
+ CPUSet: all
+ Id: all
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUSetObj:
+ - Valid
+ CPUSetSize: all
+ CPUSet: all
+ Id:
+ - 'Null'
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUSetObj:
+ - Valid
+ CPUSetSize: all
+ CPUSet:
+ - 'Null'
+ Id:
+ - Valid
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: InvSize
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUSetObj:
+ - Valid
+ CPUSetSize:
+ - Invalid
+ CPUSet:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: IncStat
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUSetObj:
+ - Valid
+ CPUSetSize:
+ - Valid
+ CPUSet:
+ - Valid
+ Id:
+ - Valid
+type: requirement
diff --git a/spec/rtems/scheduler/req/ident-by-processor.yml b/spec/rtems/scheduler/req/ident-by-processor.yml
new file mode 100644
index 00000000..553fa572
--- /dev/null
+++ b/spec/rtems/scheduler/req/ident-by-processor.yml
@@ -0,0 +1,282 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: action
+links:
+- role: interface-function
+ uid: ../if/ident-by-processor
+post-conditions:
+- name: Status
+ states:
+ - name: Ok
+ test-code: |
+ T_rsc_success( ctx->status );
+ text: |
+ The return status of ${../if/ident-by-processor:/name} shall be
+ ${../../status/if/successful:/name}.
+ - name: InvAddr
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ text: |
+ The return status of ${../if/ident-by-processor:/name} shall be
+ ${../../status/if/invalid-address:/name}.
+ - name: InvName
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_NAME );
+ text: |
+ The return status of ${../if/ident-by-processor:/name} shall be
+ ${../../status/if/invalid-name:/name}.
+ - name: IncStat
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
+ text: |
+ The return status of ${../if/ident-by-processor:/name} shall be
+ ${../../status/if/invalid-name:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: IdVar
+ states:
+ - name: Set
+ test-code: |
+ T_eq_ptr( ctx->id, &ctx->id_value );
+ T_eq_u32( ctx->id_value, 0x0f010001 );
+ text: |
+ The value of the object referenced by the
+ ${../if/ident-by-processor:/params[1]/name} parameter shall be set to the
+ identifier of the scheduler which owned the processor specified by the
+ ${../if/ident-by-processor:/params[0]/name} parameter at some point
+ during the call after the return of the ${../if/ident-by-processor:/name}
+ call.
+ - name: Nop
+ test-code: |
+ T_eq_u32( ctx->id_value, INVALID_ID );
+ text: |
+ Objects referenced by the ${../if/ident-by-processor:/params[1]/name} parameter in
+ past calls to ${../if/ident-by-processor:/name} shall not be accessed by the
+ ${../if/ident-by-processor:/name} call.
+ test-epilogue: null
+ test-prologue: null
+pre-conditions:
+- name: CPUOwnedByScheduler
+ states:
+ - name: 'Yes'
+ test-code: |
+ ctx->cpu_has_scheduler = true;
+ text: |
+ While the processor specified by the
+ ${../if/ident-by-processor:/params[0]/name} parameter is owned by a
+ scheduler.
+ - name: 'No'
+ test-code: |
+ ctx->cpu_has_scheduler = false;
+ text: |
+ While the processor specified by the
+ ${../if/ident-by-processor:/params[0]/name} parameter is not owned by a
+ scheduler.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUIndex
+ states:
+ - name: Invalid
+ test-code: |
+ ctx->cpu_index = rtems_scheduler_get_processor_maximum();
+ text: |
+ While the ${../if/ident-by-processor:/params[0]/name} parameter greater
+ than or equal to the processor maximum.
+ - name: Valid
+ test-code: |
+ if ( ctx->cpu_has_scheduler ) {
+ ctx->cpu_index = 0;
+ } else {
+ ctx->cpu_index = 1;
+ }
+ text: |
+ While the ${../if/ident-by-processor:/params[0]/name} parameter less than
+ the processor maximum.
+ test-epilogue: null
+ test-prologue: null
+- name: Id
+ states:
+ - name: Valid
+ test-code: |
+ ctx->id_value = INVALID_ID;
+ ctx->id = &ctx->id_value;
+ text: |
+ While the ${../if/ident-by-processor:/params[1]/name} parameter references an object
+ of type ${../../type/if/id:/name}.
+ - name: 'Null'
+ test-code: |
+ ctx->id = NULL;
+ text: |
+ While the ${../if/ident-by-processor:/params[1]/name} parameter is equal to
+ ${/c/if/null:/name}.
+ test-epilogue: null
+ test-prologue: null
+rationale: null
+references: []
+requirement-type: functional
+skip-reasons:
+ NoSecondCPU: |
+ Where the system is build with SMP support disabled, the system has exactly
+ one processor available and this processor is always owned by a scheduler.
+test-action: |
+ #if defined(RTEMS_SMP)
+ rtems_status_code sc;
+
+ if ( !ctx->cpu_has_scheduler ) {
+ sc = rtems_scheduler_remove_processor( ctx->second_scheduler_id, 1 );
+ T_rsc_success( sc );
+ }
+ #endif
+
+ ctx->status = rtems_scheduler_ident_by_processor( ctx->cpu_index, ctx->id );
+
+ #if defined(RTEMS_SMP)
+ if ( !ctx->cpu_has_scheduler ) {
+ sc = rtems_scheduler_add_processor( ctx->second_scheduler_id, 1 );
+ T_rsc_success( sc );
+ }
+ #endif
+test-brief: null
+test-cleanup: null
+test-context:
+- brief: |
+ This member contains the identifier of a second scheduler.
+ description: null
+ member: |
+ rtems_id second_scheduler_id
+- brief: |
+ This member provides the object referenced by the
+ ${../if/ident-by-processor:/params[1]/name} parameter.
+ description: null
+ member: |
+ rtems_id id_value
+- brief: |
+ If this member is true, then the processor specified by the
+ ${../if/ident-by-processor:/params[0]/name} parameter shall be owned by a
+ scheduler.
+ description: null
+ member: |
+ bool cpu_has_scheduler
+- brief: |
+ This member contains the return value of the ${../if/ident-by-processor:/name} call.
+ description: null
+ member: |
+ rtems_status_code status
+- brief: |
+ This member specifies if the ${../if/ident-by-processor:/params[0]/name} parameter
+ value.
+ description: null
+ member: |
+ uint32_t cpu_index
+- brief: |
+ This member specifies if the ${../if/ident-by-processor:/params[1]/name} parameter
+ value.
+ description: null
+ member: |
+ rtems_id *id
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes:
+- ts-config.h
+test-prepare: |
+ ctx->id_value = INVALID_ID;
+test-setup:
+ brief: null
+ code: |
+ #if defined(RTEMS_SMP)
+ rtems_status_code sc;
+
+ sc = rtems_scheduler_ident(
+ TEST_SCHEDULER_B_NAME,
+ &ctx->second_scheduler_id
+ );
+ T_rsc_success( sc );
+ #else
+ ctx->second_scheduler_id = INVALID_ID;
+ #endif
+ description: null
+test-stop: null
+test-support: |
+ #define INVALID_ID 0xffffffff
+test-target: testsuites/validation/tc-scheduler-ident-by-processor.c
+test-teardown: null
+text: ${.:text-template}
+transition-map:
+- enabled-by: true
+ post-conditions:
+ Status: Ok
+ IdVar: Set
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'Yes'
+ CPUIndex:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'Yes'
+ CPUIndex:
+ - Valid
+ Id:
+ - 'Null'
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler: N/A
+ CPUIndex:
+ - Invalid
+ Id:
+ - 'Null'
+- enabled-by: true
+ post-conditions:
+ Status: InvName
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler: N/A
+ CPUIndex:
+ - Invalid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions: NoSecondCPU
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUIndex:
+ - Valid
+ Id: all
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUIndex:
+ - Valid
+ Id:
+ - 'Null'
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: IncStat
+ IdVar: Nop
+ pre-conditions:
+ CPUOwnedByScheduler:
+ - 'No'
+ CPUIndex:
+ - Valid
+ Id:
+ - Valid
+type: requirement
diff --git a/spec/rtems/scheduler/req/ident.yml b/spec/rtems/scheduler/req/ident.yml
new file mode 100644
index 00000000..d5444453
--- /dev/null
+++ b/spec/rtems/scheduler/req/ident.yml
@@ -0,0 +1,161 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: action
+links:
+- role: interface-function
+ uid: ../if/ident
+post-conditions:
+- name: Status
+ states:
+ - name: Ok
+ test-code: |
+ T_rsc_success( ctx->status );
+ text: |
+ The return status of ${../if/ident:/name} shall be
+ ${../../status/if/successful:/name}.
+ - name: InvAddr
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ text: |
+ The return status of ${../if/ident:/name} shall be
+ ${../../status/if/invalid-address:/name}.
+ - name: InvName
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_NAME );
+ text: |
+ The return status of ${../if/ident:/name} shall be
+ ${../../status/if/invalid-name:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: IdVar
+ states:
+ - name: Set
+ test-code: |
+ T_eq_ptr( ctx->id, &ctx->id_value );
+ T_eq_u32( ctx->id_value, 0x0f010001 );
+ text: |
+ The value of the object referenced by the ${../if/ident:/params[1]/name}
+ parameter shall be set to the identifier of the scheduler with the lowest
+ scheduler index and a name equal to the ${../if/ident:/params[0]/name}
+ parameter after the return of the ${../if/ident:/name} call.
+ - name: Nop
+ test-code: |
+ T_eq_u32( ctx->id_value, INVALID_ID );
+ text: |
+ Objects referenced by the ${../if/ident:/params[1]/name} parameter in
+ past calls to ${../if/ident:/name} shall not be accessed by the
+ ${../if/ident:/name} call.
+ test-epilogue: null
+ test-prologue: null
+pre-conditions:
+- name: Name
+ states:
+ - name: Invalid
+ test-code: |
+ ctx->name = 0;
+ text: |
+ While the ${../if/ident:/params[0]/name} parameter is not associated with
+ a scheduler.
+ - name: Valid
+ test-code: |
+ ctx->name = TEST_SCHEDULER_A_NAME;
+ text: |
+ While the ${../if/ident:/params[0]/name} parameter is associated with a
+ scheduler.
+ test-epilogue: null
+ test-prologue: null
+- name: Id
+ states:
+ - name: Valid
+ test-code: |
+ ctx->id_value = 0xffffffff;
+ ctx->id = &ctx->id_value;
+ text: |
+ While the ${../if/ident:/params[1]/name} parameter references an object
+ of type ${../../type/if/id:/name}.
+ - name: 'Null'
+ test-code: |
+ ctx->id = NULL;
+ text: |
+ While the ${../if/ident:/params[1]/name} parameter is equal to
+ ${/c/if/null:/name}.
+ test-epilogue: null
+ test-prologue: null
+rationale: null
+references: []
+requirement-type: functional
+skip-reasons: {}
+test-action: |
+ ctx->status = rtems_scheduler_ident( ctx->name, ctx->id );
+test-brief: null
+test-cleanup: null
+test-context:
+- brief: |
+ This member provides the object referenced by the
+ ${../if/ident:/params[1]/name} parameter.
+ description: null
+ member: |
+ rtems_id id_value
+- brief: |
+ This member contains the return value of the ${../if/ident:/name} call.
+ description: null
+ member: |
+ rtems_status_code status
+- brief: |
+ This member specifies if the ${../if/ident:/params[0]/name} parameter
+ value.
+ description: null
+ member: |
+ rtems_name name
+- brief: |
+ This member specifies if the ${../if/ident:/params[1]/name} parameter
+ value.
+ description: null
+ member: |
+ rtems_id *id
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes:
+- ts-config.h
+test-prepare: |
+ ctx->id_value = INVALID_ID;
+test-setup: null
+test-stop: null
+test-support: |
+ #define INVALID_ID 0xffffffff
+test-target: testsuites/validation/tc-scheduler-ident.c
+test-teardown: null
+text: ${.:text-template}
+transition-map:
+- enabled-by: true
+ post-conditions:
+ Status: Ok
+ IdVar: Set
+ pre-conditions:
+ Name:
+ - Valid
+ Id:
+ - Valid
+- enabled-by: true
+ post-conditions:
+ Status: InvAddr
+ IdVar: Nop
+ pre-conditions:
+ Name: all
+ Id:
+ - 'Null'
+- enabled-by: true
+ post-conditions:
+ Status: InvName
+ IdVar: Nop
+ pre-conditions:
+ Name:
+ - Invalid
+ Id:
+ - Valid
+type: requirement
diff --git a/spec/rtems/scheduler/req/remove-processor.yml b/spec/rtems/scheduler/req/remove-processor.yml
new file mode 100644
index 00000000..f04e72be
--- /dev/null
+++ b/spec/rtems/scheduler/req/remove-processor.yml
@@ -0,0 +1,303 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+functional-type: action
+links:
+- role: interface-function
+ uid: ../if/remove-processor
+post-conditions:
+- name: Status
+ states:
+ - name: Ok
+ test-code: |
+ T_rsc_success( ctx->status );
+ text: |
+ The return status of ${../if/remove-processor:/name} shall be
+ ${../../status/if/successful:/name}.
+ - name: InvId
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ text: |
+ The return status of ${../if/remove-processor:/name} shall be
+ ${../../status/if/invalid-id:/name}.
+ - name: InvNum
+ test-code: |
+ T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
+ text: |
+ The return status of ${../if/remove-processor:/name} shall be
+ ${../../status/if/invalid-number:/name}.
+ - name: InUse
+ test-code: |
+ T_rsc( ctx->status, RTEMS_RESOURCE_IN_USE );
+ text: |
+ The return status of ${../if/remove-processor:/name} shall be
+ ${../../status/if/resource-in-use:/name}.
+ test-epilogue: null
+ test-prologue: null
+- name: Removed
+ states:
+ - name: 'Yes'
+ test-code: |
+ T_eq_sz( ctx->scheduler_log.header.recorded, 1 );
+ T_eq_int(
+ ctx->scheduler_log.events[ 0 ].operation,
+ T_SCHEDULER_REMOVE_PROCESSOR
+ );
+ text: |
+ The processor specified by the ${../if/remove-processor:/params[1]/name}
+ parameter shall be removed from the scheduler specified by the
+ ${../if/remove-processor:/params[0]/name} by the
+ ${../if/remove-processor:/name} call.
+ - name: Nop
+ test-code: |
+ T_eq_sz( ctx->scheduler_log.header.recorded, 0 );
+ text: |
+ No processor shall be removed from a scheduler by the
+ ${../if/remove-processor:/name} call.
+ test-epilogue: null
+ test-prologue: null
+pre-conditions:
+- name: CPUState
+ states:
+ - name: Idle
+ test-code: |
+ ctx->scheduler_id = ctx->scheduler_b_id;
+ ctx->cpu_to_remove = 1;
+ text: |
+ While the processor associated with the
+ ${../if/remove-processor:/params[1]/name} parameter is owned by the
+ scheduler specified by the ${../if/remove-processor:/params[0]/name}
+ parameter, while no task exists which uses the scheduler as its
+ ${/glossary/scheduler-home:/term} and the affinity set of this task would
+ require the processor specified by the
+ ${../if/remove-processor:/params[1]/name} parameter.
+ - name: InUse
+ test-code: |
+ /* Set by prologue */
+ text: |
+ While the processor associated with the
+ ${../if/remove-processor:/params[1]/name} parameter is owned by the
+ scheduler specified by the ${../if/remove-processor:/params[0]/name}
+ parameter, while the scheduler is used by at least one task as its
+ ${/glossary/scheduler-home:/term} and the affinity set of this task
+ requires the processor specified by the
+ ${../if/remove-processor:/params[1]/name} parameter.
+ - name: NotOwned
+ test-code: |
+ ctx->scheduler_id = ctx->scheduler_a_id;
+ ctx->cpu_to_remove = 1;
+ text: |
+ While the processor associated with the
+ ${../if/remove-processor:/params[1]/name} parameter is not owned by the
+ scheduler specified by the ${../if/remove-processor:/params[0]/name}
+ parameter.
+ test-epilogue: null
+ test-prologue: |
+ ctx->scheduler_id = ctx->scheduler_a_id;
+ ctx->cpu_to_remove = 0;
+- name: Id
+ states:
+ - name: Invalid
+ test-code: |
+ ctx->id = INVALID_ID;
+ text: |
+ While the ${../if/remove-processor:/params[0]/name} parameter is not
+ associated with a scheduler.
+ - name: Scheduler
+ test-code: |
+ ctx->id = ctx->scheduler_id;
+ text: |
+ While the ${../if/remove-processor:/params[0]/name} parameter is
+ associated with a scheduler.
+ test-epilogue: null
+ test-prologue: null
+- name: CPUIndex
+ states:
+ - name: Valid
+ test-code: |
+ ctx->cpu_index = ctx->cpu_to_remove;
+ text: |
+ While the ${../if/remove-processor:/params[1]/name} parameter is less than
+ the configured processor maximum.
+ - name: Invalid
+ test-code: |
+ ctx->cpu_index = rtems_configuration_get_maximum_processors();
+ text: |
+ While the ${../if/remove-processor:/params[1]/name} parameter is greater
+ than or equal to the configured processor maximum.
+ test-epilogue: null
+ test-prologue: null
+rationale: null
+references: []
+requirement-type: functional
+skip-reasons:
+ OnlyOneCPU: |
+ Where the system is build with SMP support disabled, the system has exactly
+ one processor and there is no processor available to remove from a
+ scheduler.
+test-action: |
+ T_scheduler_log *log;
+
+ log = T_scheduler_record_2( &ctx->scheduler_log );
+ T_null( log );
+
+ ctx->status = rtems_scheduler_remove_processor( ctx->id, ctx->cpu_index );
+
+ log = T_scheduler_record( NULL );
+ T_eq_ptr( &log->header, &ctx->scheduler_log.header );
+test-brief: null
+test-cleanup: |
+ #if defined(RTEMS_SMP)
+ if ( ctx->status == RTEMS_SUCCESSFUL ) {
+ rtems_status_code sc;
+
+ sc = rtems_scheduler_add_processor(
+ ctx->scheduler_id,
+ ctx->cpu_to_remove
+ );
+ T_rsc_success( sc );
+ }
+ #endif
+test-context:
+- brief: |
+ This member specifies the scheduler used to add the processor.
+ description: null
+ member: |
+ rtems_id scheduler_id
+- brief: |
+ This member contains the identifier of scheduler A.
+ description: null
+ member: |
+ rtems_id scheduler_a_id
+- brief: |
+ This member contains the identifier of scheduler B.
+ description: null
+ member: |
+ rtems_id scheduler_b_id
+- brief: |
+ This member specifies the processor to remove.
+ description: null
+ member: |
+ uint32_t cpu_to_remove
+- brief: |
+ This member provides the scheduler operation records.
+ description: null
+ member: |
+ T_scheduler_log_2 scheduler_log;
+- brief: |
+ This member contains the return value of the
+ ${../if/remove-processor:/name} call.
+ description: null
+ member: |
+ rtems_status_code status
+- brief: |
+ This member specifies if the ${../if/remove-processor:/params[0]/name}
+ parameter value.
+ description: null
+ member: |
+ rtems_id id
+- brief: |
+ This member specifies if the ${../if/remove-processor:/params[1]/name}
+ parameter value.
+ description: null
+ member: |
+ uint32_t cpu_index
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+- rtems/test-scheduler.h
+test-local-includes:
+- ts-config.h
+- tx-support.h
+test-prepare: null
+test-setup:
+ brief: null
+ code: |
+ rtems_status_code sc;
+
+ sc = rtems_scheduler_ident(
+ TEST_SCHEDULER_A_NAME,
+ &ctx->scheduler_a_id
+ );
+ T_rsc_success( sc );
+
+ #if defined(RTEMS_SMP)
+ sc = rtems_scheduler_ident( TEST_SCHEDULER_B_NAME, &ctx->scheduler_b_id );
+ T_rsc_success( sc );
+ #else
+ ctx->scheduler_b_id = INVALID_ID;
+ #endif
+ description: null
+test-stop: null
+test-support: |
+ #define INVALID_ID 0xffffffff
+test-target: testsuites/validation/tc-scheduler-remove-processor.c
+test-teardown: null
+text: ${.:text-template}
+transition-map:
+- enabled-by: true
+ post-conditions:
+ Status: InvId
+ Removed: Nop
+ pre-conditions:
+ CPUState: N/A
+ Id:
+ - Invalid
+ CPUIndex: all
+- enabled-by: true
+ post-conditions:
+ Status: InvNum
+ Removed: Nop
+ pre-conditions:
+ CPUState: N/A
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Invalid
+- enabled-by: true
+ post-conditions:
+ Status: InUse
+ Removed: Nop
+ pre-conditions:
+ CPUState:
+ - InUse
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+- enabled-by: true
+ post-conditions: OnlyOneCPU
+ pre-conditions:
+ CPUState:
+ - Idle
+ - NotOwned
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: Ok
+ Removed: 'Yes'
+ pre-conditions:
+ CPUState:
+ - Idle
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+- enabled-by: RTEMS_SMP
+ post-conditions:
+ Status: InvNum
+ Removed: Nop
+ pre-conditions:
+ CPUState:
+ - NotOwned
+ Id:
+ - Scheduler
+ CPUIndex:
+ - Valid
+type: requirement
diff --git a/spec/rtems/scheduler/val/non-smp.yml b/spec/rtems/scheduler/val/non-smp.yml
new file mode 100644
index 00000000..526c6156
--- /dev/null
+++ b/spec/rtems/scheduler/val/non-smp.yml
@@ -0,0 +1,44 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by:
+ not: RTEMS_SMP
+links: []
+test-actions:
+- action-brief: |
+ Check that calling ${../if/get-processor:/name} is a constant expression
+ which evaluates to zero.
+ action-code: |
+ RTEMS_STATIC_ASSERT( rtems_scheduler_get_processor() == 0, GET_PROCESSOR );
+ checks: []
+ links:
+ - role: validation
+ uid: ../req/get-processor
+- action-brief: |
+ Check that calling ${../if/get-processor-maximum:/name} is a constant
+ expression which evaluates to zero.
+ action-code: |
+ RTEMS_STATIC_ASSERT(
+ rtems_scheduler_get_processor_maximum() == 1,
+ GET_PROCESSOR_MAXIMUM
+ );
+ checks: []
+ links:
+ - role: validation
+ uid: ../req/get-processor-maximum
+test-brief: |
+ This test case collection provides validation test cases for non-SMP
+ requirements of the ${../if/group:/name}.
+test-context: []
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes: []
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/validation/tc-scheduler-non-smp.c
+test-teardown: null
+type: test-case
diff --git a/spec/rtems/scheduler/val/smp-only.yml b/spec/rtems/scheduler/val/smp-only.yml
new file mode 100644
index 00000000..e7d50a77
--- /dev/null
+++ b/spec/rtems/scheduler/val/smp-only.yml
@@ -0,0 +1,81 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+links: []
+test-actions:
+- action-brief: |
+ Call ${../if/get-processor:/name} on all online processors and check the
+ returned value.
+ action-code: |
+ rtems_id scheduler_id;
+ rtems_task_priority priority;
+ uint32_t cpu_index;
+ uint32_t cpu_max;
+
+ scheduler_id = GetSelfScheduler();
+ priority = GetSelfPriority();
+ cpu_max = rtems_scheduler_get_processor_maximum();
+ T_step_ge_u32( ${step}, cpu_max, 1 );
+
+ for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) {
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_scheduler_ident_by_processor( cpu_index, &id );
+ T_quiet_rsc_success( sc );
+
+ SetSelfScheduler( id, priority );
+ SetSelfAffinityOne( cpu_index );
+
+ T_quiet_eq_u32( rtems_scheduler_get_processor(), cpu_index );
+ }
+
+ SetSelfScheduler( scheduler_id, priority );
+ SetSelfAffinityAll();
+ checks: []
+ links:
+ - role: validation
+ uid: ../req/get-processor
+- action-brief: |
+ Call ${../if/get-processor-maximum:/name} and check the returned value.
+ action-code: |
+ uint32_t cpu_max;
+
+ cpu_max = rtems_scheduler_get_processor_maximum();
+ checks:
+ - brief: |
+ Check that the returned value is greater than or equal to one.
+ code: |
+ T_step_ge_u32( ${step}, cpu_max, 1 );
+ links: []
+ - brief: |
+ Check that the returned value is less than or equal to
+ ${../../config/if/get-maximum-processors:/name}.
+ code: |
+ T_step_le_u32(
+ ${step},
+ cpu_max,
+ rtems_configuration_get_maximum_processors()
+ );
+ links: []
+ links:
+ - role: validation
+ uid: ../req/get-processor-maximum
+test-brief: |
+ This test case collection provides validation test cases for SMP-only
+ requirements of the ${../if/group:/name}.
+test-context: []
+test-context-support: null
+test-description: null
+test-header: null
+test-includes:
+- rtems.h
+test-local-includes:
+- tx-support.h
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/validation/tc-scheduler-smp-only.c
+test-teardown: null
+type: test-case
diff --git a/spec/testsuites/validation-0.yml b/spec/testsuites/validation-0.yml
index 735a130b..2204e869 100644
--- a/spec/testsuites/validation-0.yml
+++ b/spec/testsuites/validation-0.yml
@@ -11,7 +11,7 @@ test-brief: |
test-code: |
const char rtems_test_name[] = "${.:/test-suite-name}";
- #define CONFIGURE_MAXIMUM_PROCESSORS 4
+ #define CONFIGURE_MAXIMUM_PROCESSORS 5
#include "ts-default.h"
test-description: |