[rtems-central commit] spec: Harmonize partition create

Sebastian Huber sebh at rtems.org
Sat Feb 20 12:41:19 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Feb 19 20:51:04 2021 +0100

spec: Harmonize partition create

---

 spec/rtems/part/req/create.yml | 180 +++++++++++++++++++++++++----------------
 1 file changed, 111 insertions(+), 69 deletions(-)

diff --git a/spec/rtems/part/req/create.yml b/spec/rtems/part/req/create.yml
index c550177..d0bbab5 100644
--- a/spec/rtems/part/req/create.yml
+++ b/spec/rtems/part/req/create.yml
@@ -12,13 +12,69 @@ post-conditions:
   - name: Ok
     test-code: |
       T_rsc_success( ctx->status );
-      T_eq_ptr( ctx->id, &ctx->id_value );
-      T_ne_u32( ctx->id_value, 0xffffffff );
-
-      id = 0xffffffff;
-      sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
+    text: |
+      The return status of ${../if/create:/name} shall be
+      ${../../status/if/successful:/name}.
+  - name: InvAddress
+    test-code: |
+      T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+    text: |
+      The return status of ${../if/create:/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/create:/name} shall be
+      ${../../status/if/invalid-name:/name}.
+  - name: InvNumber
+    test-code: |
+      T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
+    text: |
+      The return status of ${../if/create:/name} shall be
+      ${../../status/if/invalid-number:/name}.
+  - name: InvSize
+    test-code: |
+      T_rsc( ctx->status, RTEMS_INVALID_SIZE );
+    text: |
+      The return status of ${../if/create:/name} shall be
+      ${../../status/if/invalid-size:/name}.
+  - name: TooMany
+    test-code: |
+      T_rsc( ctx->status, RTEMS_TOO_MANY );
+    text: |
+      The return status of ${../if/create:/name} shall be
+      ${../../status/if/too-many:/name}.
+  test-epilogue: null
+  test-prologue: null
+- name: Name
+  states:
+  - name: Valid
+    test-code: |
+      id = INVALID_ID;
+      sc = rtems_partition_ident( NAME, &id );
       T_rsc_success( sc );
       T_eq_u32( id, ctx->id_value );
+    text: |
+      The unique object name shall identify the partition created by the
+      ${../if/create:/name} call.
+  - name: Invalid
+    test-code: |
+      sc = rtems_partition_ident( NAME, &id );
+      T_rsc( sc, RTEMS_INVALID_NAME );
+    text: |
+      The unique object name shall not identify the partition created by the
+      ${../if/create:/name} call.
+  test-epilogue: null
+  test-prologue: |
+    rtems_status_code sc;
+    rtems_id          id;
+- name: IdValue
+  states:
+  - name: Assigned
+    test-code: |
+      T_eq_ptr( ctx->id, &ctx->id_value );
+      T_ne_u32( ctx->id_value, INVALID_ID );
 
       for ( i = 0; i < BUFFER_COUNT; ++i) {
         sc = rtems_partition_get_buffer( ctx->id_value, &buffers[ i ] );
@@ -39,46 +95,14 @@ post-conditions:
       sc = rtems_partition_delete( ctx->id_value );
       T_rsc_success( sc );
     text: |
-      The status shall be RTEMS_SUCCESSFUL.  The value of the object identifier
-      referenced by the id parameter shall identify the created partition.
-  - name: InvAddress
-    test-code: |
-      T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
-      T_eq_u32( ctx->id_value, 0xffffffff );
-    text: |
-      The status shall be RTEMS_INVALID_ADDRESS.
-  - name: InvName
+      The value of the object identifier variable shall be equal to the object
+      identifier of the partition created by the ${../if/create:/name} call.
+  - name: Unchanged
     test-code: |
-      T_rsc( ctx->status, RTEMS_INVALID_NAME );
-      T_eq_u32( ctx->id_value, 0xffffffff );
+      T_eq_u32( ctx->id_value, INVALID_ID );
     text: |
-      The status shall be RTEMS_INVALID_NAME.  If the id parameter is not NULL,
-      then the value of the object identifier referenced by the id parameter
-      shall be unchanged.
-  - name: InvNumber
-    test-code: |
-      T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
-      T_eq_u32( ctx->id_value, 0xffffffff );
-    text: |
-      The status shall be RTEMS_INVALID_NUMBER.  If the id parameter is not
-      NULL, then the value of the object identifier referenced by the id
-      parameter shall be unchanged.
-  - name: InvSize
-    test-code: |
-      T_rsc( ctx->status, RTEMS_INVALID_SIZE );
-      T_eq_u32( ctx->id_value, 0xffffffff );
-    text: |
-      The status shall be RTEMS_INVALID_SIZE.  If the id parameter is not NULL,
-      then the value of the object identifier referenced by the id parameter
-      shall be unchanged.
-  - name: TooMany
-    test-code: |
-      T_rsc( ctx->status, RTEMS_TOO_MANY );
-      T_eq_u32( ctx->id_value, 0xffffffff );
-    text: |
-      The status shall be RTEMS_TOO_MANY.  If the id parameter is not NULL,
-      then the value of the object identifier referenced by the id parameter
-      shall be unchanged.
+      The value of the object identifier variable shall be unchanged by the
+      ${../if/create:/name} call.
   test-epilogue: null
   test-prologue: |
     rtems_status_code sc;
@@ -105,7 +129,7 @@ pre-conditions:
   states:
   - name: Valid
     test-code: |
-      ctx->name = PART_NAME;
+      ctx->name = NAME;
     text: |
       The name of the partition shall be valid.
   - name: Invalid
@@ -172,14 +196,14 @@ pre-conditions:
       The buffer size shall be less than the size of two pointers.
   test-epilogue: null
   test-prologue: null
-- name: Parts
+- name: Free
   states:
-  - name: Avail
+  - name: 'Yes'
     test-code: |
       /* Nothing to do */
     text: |
       The system shall have at least one inactive partition object available.
-  - name: None
+  - name: 'No'
     test-code: |
       i = 0;
 
@@ -188,7 +212,7 @@ pre-conditions:
         rtems_id          id;
 
         sc = rtems_partition_create(
-          rtems_build_name( 'P', 'A', 'R', 'T' ),
+          rtems_build_name( 'B', 'L', 'U', 'B' ),
           exhaust_buffers[ i ],
           sizeof( exhaust_buffers[ i ] ),
           sizeof( exhaust_buffers[ i ][ 0 ] ),
@@ -204,7 +228,7 @@ pre-conditions:
           T_quiet_assert_not_null( info );
           obj = _Objects_Get_no_protection( id, info );
           T_quiet_assert_not_null( obj );
-          _Chain_Append_unprotected( &ctx->partitions, &obj->Node );
+          _Chain_Append_unprotected( &ctx->active_objects, &obj->Node );
         } else {
           T_quiet_rsc( sc, RTEMS_TOO_MANY );
           break;
@@ -234,7 +258,7 @@ test-brief: null
 test-cleanup: |
   Chain_Node *node;
 
-  while ( ( node = _Chain_Get_unprotected( &ctx->partitions ) ) ) {
+  while ( ( node = _Chain_Get_unprotected( &ctx->active_objects ) ) ) {
     Objects_Control   *obj;
     rtems_status_code  sc;
 
@@ -245,6 +269,9 @@ test-cleanup: |
 test-context:
 - brief: null
   description: null
+  member: Chain_Control active_objects
+- brief: null
+  description: null
   member: rtems_status_code status
 - brief: null
   description: null
@@ -267,9 +294,6 @@ test-context:
 - brief: null
   description: null
   member: rtems_id id_value
-- brief: null
-  description: null
-  member: Chain_Control partitions
 test-context-support: null
 test-description: null
 test-header: null
@@ -283,21 +307,23 @@ test-prepare: |
   rtems_status_code sc;
   rtems_id          id;
 
-  ctx->id_value = 0xffffffff;
+  ctx->id_value = INVALID_ID;
   ctx->attribute_set = RTEMS_DEFAULT_ATTRIBUTES;
 
-  id = 0xffffffff;
-  sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
+  id = INVALID_ID;
+  sc = rtems_partition_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
   T_rsc( sc, RTEMS_INVALID_NAME );
-  T_eq_u32( id, 0xffffffff );
+  T_eq_u32( id, INVALID_ID );
 test-setup:
   brief: null
   code: |
-    _Chain_Initialize_empty( &ctx->partitions );
+    _Chain_Initialize_empty( &ctx->active_objects );
   description: null
 test-stop: null
 test-support: |
-  #define PART_NAME rtems_build_name( 'N', 'A', 'M', 'E' )
+  #define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
+
+  #define INVALID_ID 0xffffffff
 
   #define MAX_PARTITIONS 4
 
@@ -317,6 +343,8 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: Ok
+    Name: Valid
+    IdValue: Assigned
   pre-conditions:
     Id:
     - Id
@@ -324,8 +352,8 @@ transition-map:
     - Valid
     Name:
     - Valid
-    Parts:
-    - Avail
+    Free:
+    - 'Yes'
     Size:
     - Valid
     Start:
@@ -333,42 +361,50 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: InvName
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id: all
     Length: all
     Name:
     - Invalid
-    Parts: all
+    Free: all
     Size: all
     Start: all
 - enabled-by: true
   post-conditions:
     Status: InvAddress
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id:
     - 'Null'
     Length: all
     Name:
     - Valid
-    Parts: all
+    Free: all
     Size: all
     Start: all
 - enabled-by: true
   post-conditions:
     Status: InvAddress
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id:
     - Id
     Length: all
     Name:
     - Valid
-    Parts: all
+    Free: all
     Size: all
     Start:
     - 'Null'
 - enabled-by: true
   post-conditions:
     Status: InvSize
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id:
     - Id
@@ -377,7 +413,7 @@ transition-map:
     - Invalid
     Name:
     - Valid
-    Parts: all
+    Free: all
     Size: all
     Start:
     - Valid
@@ -385,6 +421,8 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: InvSize
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id:
     - Id
@@ -392,7 +430,7 @@ transition-map:
     - Valid
     Name:
     - Valid
-    Parts: all
+    Free: all
     Size:
     - Zero
     - Small
@@ -402,6 +440,8 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: InvAddress
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id:
     - Id
@@ -409,7 +449,7 @@ transition-map:
     - Valid
     Name:
     - Valid
-    Parts: all
+    Free: all
     Size:
     - Valid
     Start:
@@ -417,6 +457,8 @@ transition-map:
 - enabled-by: true
   post-conditions:
     Status: TooMany
+    Name: Invalid
+    IdValue: Unchanged
   pre-conditions:
     Id:
     - Id
@@ -424,8 +466,8 @@ transition-map:
     - Valid
     Name:
     - Valid
-    Parts:
-    - None
+    Free:
+    - 'No'
     Size:
     - Valid
     Start:



More information about the vc mailing list