[rtems-central commit] spec: Clarify scheduler of created task

Sebastian Huber sebh at rtems.org
Wed Mar 30 06:55:49 UTC 2022


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 29 10:53:51 2022 +0200

spec: Clarify scheduler of created task

---

 spec/rtems/task/if/create.yml                    |  7 ++-
 spec/rtems/task/req/construct-home-scheduler.yml | 17 ++++++
 spec/rtems/task/req/create-home-scheduler.yml    | 16 +++++
 spec/rtems/task/val/smp.yml                      | 74 ++++++++++++++++++++++++
 spec/rtems/task/val/task.yml                     | 45 +++++++++++++-
 5 files changed, 154 insertions(+), 5 deletions(-)

diff --git a/spec/rtems/task/if/create.yml b/spec/rtems/task/if/create.yml
index 4d49ac7..41ee918 100644
--- a/spec/rtems/task/if/create.yml
+++ b/spec/rtems/task/if/create.yml
@@ -24,9 +24,10 @@ description: |
   used to access the task with other task related directives.
 
   The **initial priority** of the task is specified in ${.:/params[1]/name}.
-  The scheduler of the created task is the scheduler of the calling task at
-  some point during the task creation.  The initial task priority specified in
-  ${.:/params[1]/name} shall be valid for this scheduler.
+  The ${/glossary/scheduler-home:/term} of the created task is the home
+  scheduler of the calling task at some time point during the task creation.
+  The initial task priority specified in ${.:/params[1]/name} shall be valid
+  for this scheduler.
 
   The **stack size** of the task is specified in ${.:/params[2]/name}.  If the
   requested stack size is less than the configured minimum stack size, then
diff --git a/spec/rtems/task/req/construct-home-scheduler.yml b/spec/rtems/task/req/construct-home-scheduler.yml
new file mode 100644
index 0000000..505972f
--- /dev/null
+++ b/spec/rtems/task/req/construct-home-scheduler.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: interface-function
+  uid: ../if/construct
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  When a task is constructed, the ${/glossary/scheduler-home:/term} of the
+  constructed task shall be set to the home scheduler of the task calling the
+  ${../if/construct:/name} directive at some time point during the directive
+  call.
+type: requirement
diff --git a/spec/rtems/task/req/create-home-scheduler.yml b/spec/rtems/task/req/create-home-scheduler.yml
new file mode 100644
index 0000000..b457b3f
--- /dev/null
+++ b/spec/rtems/task/req/create-home-scheduler.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: interface-function
+  uid: ../if/create
+functional-type: function
+rationale: null
+references: []
+requirement-type: functional
+text: |
+  When a task is created, the ${/glossary/scheduler-home:/term} of the created
+  task shall be set to the home scheduler of the task calling the
+  ${../if/create:/name} directive at some time point during the directive call.
+type: requirement
diff --git a/spec/rtems/task/val/smp.yml b/spec/rtems/task/val/smp.yml
new file mode 100644
index 0000000..8c5ac6f
--- /dev/null
+++ b/spec/rtems/task/val/smp.yml
@@ -0,0 +1,74 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+links: []
+test-actions:
+- action-brief: |
+    Validate the home scheduler of tasks created by ${../if/create:/name} and
+    constructed by ${../if/construct:/name} on scheduler B.
+  action-code: |
+    rtems_status_code sc;
+    rtems_status_code id;
+  checks:
+  - brief: |
+      Move runner from scheduler A to B.
+    code: |
+      T_step_eq_u32( ${step}, GetSelfScheduler(), SCHEDULER_A_ID );
+      SetSelfScheduler( SCHEDULER_B_ID, 1 );
+    links: []
+  - brief: |
+      Create a task.  Check that the home scheduler of the created task is
+      scheduler B.
+    code: |
+      sc = rtems_task_create(
+        OBJECT_NAME,
+        1,
+        TEST_MINIMUM_STACK_SIZE,
+        RTEMS_DEFAULT_MODES,
+        RTEMS_DEFAULT_ATTRIBUTES,
+        &id
+      );
+      T_step_rsc_success( ${step}, sc );
+
+      T_step_eq_u32( ${step}, GetScheduler( id ), SCHEDULER_B_ID );
+      DeleteTask( id );
+    links:
+    - role: validation
+      uid: ../req/create-home-scheduler
+  - brief: |
+      Construct a task.  Check that the home scheduler of the constructed task
+      is scheduler B.
+    code: |
+      sc = rtems_task_construct( &DefaultTaskConfig, &id );
+      T_step_rsc_success( ${step}, sc );
+
+      T_step_eq_u32( ${step}, GetScheduler( id ), SCHEDULER_B_ID );
+      DeleteTask( id );
+    links:
+    - role: validation
+      uid: ../req/construct-home-scheduler
+  - brief: |
+      Restore runner scheduler.
+    code: |
+      RestoreRunnerScheduler();
+    links: []
+  links: []
+test-brief: |
+  This test case collection provides SMP-specific validation test cases for
+  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:
+- ts-config.h
+- tx-support.h
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/validation/tc-task-smp.c
+test-teardown: null
+type: test-case
diff --git a/spec/rtems/task/val/task.yml b/spec/rtems/task/val/task.yml
index 437eccb..97bdebf 100644
--- a/spec/rtems/task/val/task.yml
+++ b/spec/rtems/task/val/task.yml
@@ -1,6 +1,6 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 copyrights:
-- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+- Copyright (C) 2021, 2022 embedded brains GmbH (http://www.embedded-brains.de)
 enabled-by: true
 links: []
 test-actions:
@@ -161,6 +161,45 @@ test-actions:
     - role: validation
       uid: ../req/self-define
   links: []
+- action-brief: |
+    Validate the home scheduler of tasks created by ${../if/create:/name} and
+    constructed by ${../if/construct:/name}.
+  action-code: |
+    rtems_status_code sc;
+    rtems_status_code id;
+  checks:
+  - brief: |
+      Create a task.  Check that the home scheduler of the created task is
+      scheduler A.
+    code: |
+      sc = rtems_task_create(
+        OBJECT_NAME,
+        1,
+        TEST_MINIMUM_STACK_SIZE,
+        RTEMS_DEFAULT_MODES,
+        RTEMS_DEFAULT_ATTRIBUTES,
+        &id
+      );
+      T_step_rsc_success( ${step}, sc );
+
+      T_step_eq_u32( ${step}, GetScheduler( id ), SCHEDULER_A_ID );
+      DeleteTask( id );
+    links:
+    - role: validation
+      uid: ../req/create-home-scheduler
+  - brief: |
+      Construct a task.  Check that the home scheduler of the constructed task
+      is scheduler A.
+    code: |
+      sc = rtems_task_construct( &DefaultTaskConfig, &id );
+      T_step_rsc_success( ${step}, sc );
+
+      T_step_eq_u32( ${step}, GetScheduler( id ), SCHEDULER_A_ID );
+      DeleteTask( id );
+    links:
+    - role: validation
+      uid: ../req/construct-home-scheduler
+  links: []
 test-brief: |
   This test case collection provides validation test cases for requirements of
   the ${../if/group:/name}.
@@ -172,7 +211,9 @@ test-includes:
 - rtems.h
 - string.h
 - rtems/score/apimutex.h
-test-local-includes: []
+test-local-includes:
+- ts-config.h
+- tx-support.h
 test-setup: null
 test-stop: null
 test-support: |



More information about the vc mailing list