[rtems-central commit] spec: Improve task construct validation

Sebastian Huber sebh at rtems.org
Mon Mar 1 09:01:33 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Feb 26 11:58:59 2021 +0100

spec: Improve task construct validation

---

 spec/rtems/task/req/construct-errors.yml | 273 +++++++++++++++++++++++++++----
 1 file changed, 240 insertions(+), 33 deletions(-)

diff --git a/spec/rtems/task/req/construct-errors.yml b/spec/rtems/task/req/construct-errors.yml
index 2322e59..c76061b 100644
--- a/spec/rtems/task/req/construct-errors.yml
+++ b/spec/rtems/task/req/construct-errors.yml
@@ -91,6 +91,22 @@ post-conditions:
       ${../if/construct:/name} call.
   test-epilogue: null
   test-prologue: null
+- name: CreateExt
+  states:
+  - name: 'Yes'
+    test-code: |
+      T_eq_u32( ctx->create_extension_calls, 1 );
+    text: |
+      The create user extensions shall be invoked during the
+      ${../if/construct:/name} call.
+  - name: 'No'
+    test-code: |
+      T_eq_u32( ctx->create_extension_calls, 0 );
+    text: |
+      The create user extensions shall not be invoked during the
+      ${../if/construct:/name} call.
+  test-epilogue: null
+  test-prologue: null
 - name: DelExt
   states:
   - name: 'Yes'
@@ -107,6 +123,22 @@ post-conditions:
       ${../if/construct:/name} call.
   test-epilogue: null
   test-prologue: null
+- name: StoFree
+  states:
+  - name: 'Yes'
+    test-code: |
+      T_eq_u32( ctx->storage_free_calls, 1 );
+    text: |
+      The storage free handler of the task configuration shall be invoked
+      during the ${../if/construct:/name} call.
+  - name: 'No'
+    test-code: |
+      T_eq_u32( ctx->storage_free_calls, 0 );
+    text: |
+      The storage free handler of the task configuration shall not be invoked
+      during the ${../if/construct:/name} call.
+  test-epilogue: null
+  test-prologue: null
 pre-conditions:
 - name: Id
   states:
@@ -136,6 +168,21 @@ pre-conditions:
       The name of the task configuration shall be invalid.
   test-epilogue: null
   test-prologue: null
+- name: SysTsk
+  states:
+  - name: 'Yes'
+    test-code: |
+      ctx->config.attributes |= RTEMS_SYSTEM_TASK;
+    text: |
+      The attributes of the task configuration shall specify a system task.
+  - name: 'No'
+    test-code: |
+      /* Nothing to do */
+    text: |
+      The attributes of the task configuration shall specify an application
+      task.
+  test-epilogue: null
+  test-prologue: null
 - name: Prio
   states:
   - name: Valid
@@ -197,7 +244,7 @@ pre-conditions:
     test-code: |
       ctx->stack_size = 0;
     text: |
-      The task stack size of the task configuration shall be less than to the
+      The task stack size of the task configuration shall be less than the
       configured minimum size.
   test-epilogue: null
   test-prologue: null
@@ -215,30 +262,14 @@ pre-conditions:
       At least one of the task create extensions shall fail.
   test-epilogue: null
   test-prologue: null
-- name: Preempt
-  states:
-  - name: 'Yes'
-    test-code: |
-      ctx->config.initial_modes &= ~RTEMS_PREEMPT_MASK;
-      ctx->config.initial_modes |= RTEMS_PREEMPT;
-    text: |
-      The preemptible mode in the initial modes of the task configuration shall
-      be set to preemptible.
-  - name: 'No'
-    test-code: |
-      ctx->config.initial_modes &= ~RTEMS_PREEMPT_MASK;
-      ctx->config.initial_modes |= RTEMS_NO_PREEMPT;
-    text: |
-      The preemptible mode in the initial modes of the task configuration shall
-      be set to non-preemptible.
-  test-epilogue: null
-  test-prologue: null
 rationale: null
 references: []
 requirement-type: functional
 skip-reasons: {}
 test-action: |
+  ctx->create_extension_calls = 0;
   ctx->delete_extension_calls = 0;
+  ctx->storage_free_calls = 0;
   ctx->config.storage_size = RTEMS_TASK_STORAGE_SIZE(
     ctx->config.maximum_thread_local_storage_size + ctx->stack_size,
     ctx->config.attributes
@@ -280,10 +311,18 @@ test-context:
 - brief: null
   description: null
   member: |
+    uint32_t create_extension_calls
+- brief: null
+  description: null
+  member: |
     uint32_t delete_extension_calls
 - brief: null
   description: null
   member: |
+    uint32_t storage_free_calls
+- brief: null
+  description: null
+  member: |
     size_t stack_size
 - brief: null
   description: null
@@ -309,6 +348,8 @@ test-prepare: |
 
   ctx->id_value = INVALID_ID;
   memset( &ctx->config, 0, sizeof( ctx->config ) );
+  ctx->config.storage_area = task_storage,
+  ctx->config.storage_free = StorageFree;
 test-setup:
   brief: null
   code: |
@@ -320,7 +361,7 @@ test-setup:
     tls_variable = var;
 
     sc = rtems_extension_create(
-      rtems_build_name( 'T', 'C', 'F', 'C' ),
+      rtems_build_name( 'T', 'E', 'X', 'T' ),
       &extensions,
       &ctx->extension_id
     );
@@ -355,6 +396,12 @@ test-support: |
     .attributes = RTEMS_DEFAULT_MODES
   };
 
+  static void StorageFree( void *ptr )
+  {
+    T_eq_ptr( ptr, task_storage );
+    ++RtemsTaskReqConstructErrors_Instance.storage_free_calls;
+  }
+
   static rtems_status_code Create( void *arg, uint32_t *id )
   {
     Context          *ctx;
@@ -375,6 +422,7 @@ test-support: |
     (void) executing;
     (void) created;
 
+    ++RtemsTaskReqConstructErrors_Instance.create_extension_calls;
     return RtemsTaskReqConstructErrors_Instance.create_extension_status;
   }
 
@@ -406,7 +454,9 @@ transition-map:
     Status: Ok
     Name: Valid
     IdValue: Assigned
+    CreateExt: 'Yes'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext:
     - Ok
@@ -414,7 +464,7 @@ transition-map:
     - Valid
     Name:
     - Valid
-    Preempt: all
+    SysTsk: all
     Prio:
     - Valid
     Stack:
@@ -425,16 +475,115 @@ transition-map:
     - 'Yes'
 - enabled-by: true
   post-conditions:
+    Status: Ok
+    Name: Valid
+    IdValue: Assigned
+    CreateExt: 'Yes'
+    DelExt: 'No'
+    StoFree: 'No'
+  pre-conditions:
+    Ext:
+    - Ok
+    Id:
+    - Valid
+    Name:
+    - Valid
+    SysTsk:
+    - 'Yes'
+    Prio:
+    - Zero
+    Stack:
+    - Enough
+    TLS:
+    - Enough
+    Free:
+    - 'Yes'
+- enabled-by: true
+  post-conditions:
+    Status: InvSize
+    Name: Invalid
+    IdValue: Unchanged
+    CreateExt: 'No'
+    DelExt: 'No'
+    StoFree: 'No'
+  pre-conditions:
+    Ext: all
+    Id:
+    - Valid
+    Name:
+    - Valid
+    SysTsk:
+    - 'Yes'
+    Prio:
+    - Zero
+    Stack:
+    - Small
+    TLS:
+    - Enough
+    Free:
+    - 'Yes'
+- enabled-by: true
+  post-conditions:
+    Status: InvSize
+    Name: Invalid
+    IdValue: Unchanged
+    CreateExt: 'No'
+    DelExt: 'No'
+    StoFree: 'No'
+  pre-conditions:
+    Ext: all
+    Id:
+    - Valid
+    Name:
+    - Valid
+    SysTsk:
+    - 'Yes'
+    Prio:
+    - Zero
+    Stack:
+    - Enough
+    TLS:
+    - Small
+    Free:
+    - 'Yes'
+- enabled-by: true
+  post-conditions:
+    Status: InvSize
+    Name: Invalid
+    IdValue: Unchanged
+    CreateExt: 'No'
+    DelExt: 'No'
+    StoFree: 'No'
+  pre-conditions:
+    Ext: all
+    Id:
+    - Valid
+    Name:
+    - Valid
+    SysTsk:
+    - 'Yes'
+    Prio:
+    - Zero
+    Stack:
+    - Small
+    TLS:
+    - Small
+    Free:
+    - 'Yes'
+- enabled-by: true
+  post-conditions:
     Status: InvName
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'No'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext: all
     Id: all
     Name:
     - Inv
-    Preempt: all
+    SysTsk: all
     Prio: all
     Stack: all
     TLS: all
@@ -444,14 +593,16 @@ transition-map:
     Status: InvAddr
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'No'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext: all
     Id:
     - 'Null'
     Name:
     - Valid
-    Preempt: all
+    SysTsk: all
     Prio: all
     Stack: all
     TLS: all
@@ -461,14 +612,38 @@ transition-map:
     Status: InvPrio
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'No'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext: all
     Id:
     - Valid
     Name:
     - Valid
-    Preempt: all
+    SysTsk:
+    - 'Yes'
+    Prio:
+    - Inv
+    Stack: all
+    TLS: all
+    Free: all
+- enabled-by: true
+  post-conditions:
+    Status: InvPrio
+    Name: Invalid
+    IdValue: Unchanged
+    CreateExt: 'No'
+    DelExt: 'No'
+    StoFree: 'No'
+  pre-conditions:
+    Ext: all
+    Id:
+    - Valid
+    Name:
+    - Valid
+    SysTsk:
+    - 'No'
     Prio:
     - Zero
     - Inv
@@ -480,14 +655,16 @@ transition-map:
     Status: TooMany
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'No'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext: all
     Id:
     - Valid
     Name:
     - Valid
-    Preempt: all
+    SysTsk: all
     Prio:
     - Valid
     Stack: all
@@ -496,17 +673,41 @@ transition-map:
     - 'No'
 - enabled-by: true
   post-conditions:
+    Status: TooMany
+    Name: Invalid
+    IdValue: Unchanged
+    CreateExt: 'No'
+    DelExt: 'No'
+    StoFree: 'No'
+  pre-conditions:
+    Ext: all
+    Id:
+    - Valid
+    Name:
+    - Valid
+    SysTsk:
+    - 'Yes'
+    Prio:
+    - Zero
+    Stack: all
+    TLS: all
+    Free:
+    - 'No'
+- enabled-by: true
+  post-conditions:
     Status: InvSize
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'No'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext: all
     Id:
     - Valid
     Name:
     - Valid
-    Preempt: all
+    SysTsk: all
     Prio:
     - Valid
     Stack: all
@@ -519,14 +720,16 @@ transition-map:
     Status: InvSize
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'No'
     DelExt: 'No'
+    StoFree: 'No'
   pre-conditions:
     Ext: all
     Id:
     - Valid
     Name:
     - Valid
-    Preempt: all
+    SysTsk: all
     Prio:
     - Valid
     Stack:
@@ -540,7 +743,9 @@ transition-map:
     Status: Unsat
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'Yes'
     DelExt: 'Yes'
+    StoFree: 'Yes'
   pre-conditions:
     Ext:
     - Err
@@ -548,7 +753,7 @@ transition-map:
     - Valid
     Name:
     - Valid
-    Preempt: all
+    SysTsk: all
     Prio:
     - Valid
     Stack:
@@ -557,23 +762,25 @@ transition-map:
     - Enough
     Free:
     - 'Yes'
-- enabled-by: RTEMS_SMP
+- enabled-by: true
   post-conditions:
     Status: Unsat
     Name: Invalid
     IdValue: Unchanged
+    CreateExt: 'Yes'
     DelExt: 'Yes'
+    StoFree: 'Yes'
   pre-conditions:
     Ext:
-    - Ok
+    - Err
     Id:
     - Valid
     Name:
     - Valid
-    Preempt:
-    - 'No'
+    SysTsk:
+    - 'Yes'
     Prio:
-    - Valid
+    - Zero
     Stack:
     - Enough
     TLS:



More information about the vc mailing list