[rtems-central commit] spec: Avoid test prologue/epilogue in test cases

Sebastian Huber sebh at rtems.org
Thu Feb 4 13:26:58 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Feb  4 08:16:58 2021 +0100

spec: Avoid test prologue/epilogue in test cases

---

 spec/rtems/attr/val/attr.yml                   |  5 +--
 spec/rtems/barrier/val/ident.yml               | 30 ++++++++--------
 spec/rtems/event/val/event-constant.yml        |  7 ++--
 spec/rtems/event/val/events.yml                |  7 ++--
 spec/rtems/message/val/ident.yml               | 26 +++++++-------
 spec/rtems/mode/val/modes.yml                  |  5 +--
 spec/rtems/option/val/options.yml              |  5 +--
 spec/rtems/part/val/ident.yml                  | 36 ++++++++++---------
 spec/rtems/part/val/part.yml                   | 15 ++++----
 spec/rtems/ratemon/val/ident.yml               | 26 +++++++-------
 spec/rtems/sem/val/ident.yml                   | 32 +++++++++--------
 spec/rtems/timer/val/ident.yml                 | 26 +++++++-------
 spec/rtems/userext/val/ident.yml               | 30 ++++++++--------
 spec/testsuites/validation/c-library.yml       |  9 ++---
 spec/testsuites/validation/classic-barrier.yml | 50 ++++++++++++++++----------
 15 files changed, 172 insertions(+), 137 deletions(-)

diff --git a/spec/rtems/attr/val/attr.yml b/spec/rtems/attr/val/attr.yml
index 167948f..d5601b9 100644
--- a/spec/rtems/attr/val/attr.yml
+++ b/spec/rtems/attr/val/attr.yml
@@ -5,6 +5,8 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    rtems_attribute attributes;
+
     /* No action */
   checks:
   - check: |
@@ -254,8 +256,7 @@ test-header: null
 test-includes:
 - rtems.h
 test-local-includes: []
-test-prologue: |
-  rtems_attribute attributes;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/barrier/val/ident.yml b/spec/rtems/barrier/val/ident.yml
index 08f983e..69cf096 100644
--- a/spec/rtems/barrier/val/ident.yml
+++ b/spec/rtems/barrier/val/ident.yml
@@ -7,10 +7,24 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    rtems_status_code sc;
+    rtems_id          id_local_object;
+
+    sc = rtems_barrier_create(
+      ClassicObjectLocalIdentName,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      1,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident-local:/test-run}(
       id_local_object,
       ClassicBarrierIdentAction
     );
+
+    sc = rtems_barrier_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API partition class
@@ -20,24 +34,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_barrier_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident-local.h
-test-prologue: |
-  rtems_status_code sc;
-  rtems_id id_local_object;
-
-  sc = rtems_barrier_create(
-    ClassicObjectLocalIdentName,
-    RTEMS_DEFAULT_ATTRIBUTES,
-    1,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/event/val/event-constant.yml b/spec/rtems/event/val/event-constant.yml
index e33fd76..d06e698 100644
--- a/spec/rtems/event/val/event-constant.yml
+++ b/spec/rtems/event/val/event-constant.yml
@@ -5,6 +5,9 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    rtems_status_code sc;
+    rtems_event_set   out;
+
     /* No action */
   checks:
   - check: |
@@ -384,9 +387,7 @@ test-includes:
 - rtems.h
 test-local-includes:
 - tr-event-constant.h
-test-prologue: |
-  rtems_status_code sc;
-  rtems_event_set   out;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: null
diff --git a/spec/rtems/event/val/events.yml b/spec/rtems/event/val/events.yml
index 4c2372f..063b24e 100644
--- a/spec/rtems/event/val/events.yml
+++ b/spec/rtems/event/val/events.yml
@@ -5,6 +5,9 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    rtems_event_set all;
+    int             i;
+
     for ( i = 0; i < 32; ++i ) {
       ${event-constant:/test-run}( events[ i ], i );
       T_step( (unsigned int) i ); /* ${steps/32} */
@@ -55,9 +58,7 @@ test-includes:
 - rtems.h
 test-local-includes:
 - tr-event-constant.h
-test-prologue: |
-  rtems_event_set all;
-  int             i;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/message/val/ident.yml b/spec/rtems/message/val/ident.yml
index 628f17f..e3e9d9c 100644
--- a/spec/rtems/message/val/ident.yml
+++ b/spec/rtems/message/val/ident.yml
@@ -7,10 +7,22 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    rtems_status_code sc;
+    rtems_id          id_local_object;
+
+    sc = rtems_message_queue_construct(
+      &ClassicObjectIdentConfig,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident:/test-run}(
       id_local_object,
       ClassicMessageIdentAction
     );
+
+    sc = rtems_message_queue_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API message queue
@@ -20,22 +32,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_message_queue_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident.h
-test-prologue: |
-  rtems_status_code sc;
-  rtems_id          id_local_object;
-
-  sc = rtems_message_queue_construct(
-    &ClassicObjectIdentConfig,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/mode/val/modes.yml b/spec/rtems/mode/val/modes.yml
index b62a66b..4f42cc6 100644
--- a/spec/rtems/mode/val/modes.yml
+++ b/spec/rtems/mode/val/modes.yml
@@ -5,6 +5,8 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    rtems_mode modes;
+
     /* No action */
   checks:
   - check: |
@@ -218,8 +220,7 @@ test-header: null
 test-includes:
 - rtems.h
 test-local-includes: []
-test-prologue: |
-  rtems_mode modes;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/option/val/options.yml b/spec/rtems/option/val/options.yml
index 0364dcc..5e2e1c5 100644
--- a/spec/rtems/option/val/options.yml
+++ b/spec/rtems/option/val/options.yml
@@ -5,6 +5,8 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    rtems_option options;
+
     /* No action */
   checks:
   - check: |
@@ -93,8 +95,7 @@ test-header: null
 test-includes:
 - rtems.h
 test-local-includes: []
-test-prologue: |
-  rtems_option options;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/part/val/ident.yml b/spec/rtems/part/val/ident.yml
index ba40238..0ab8344 100644
--- a/spec/rtems/part/val/ident.yml
+++ b/spec/rtems/part/val/ident.yml
@@ -7,10 +7,27 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) long area[32];
+    rtems_status_code                                      sc;
+    rtems_id                                               id_local_object;
+
+    sc = rtems_partition_create(
+      ClassicObjectIdentName,
+      area,
+      sizeof( area ),
+      sizeof( area ),
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident:/test-run}(
       id_local_object,
       ClassicPartIdentAction
     );
+
+    sc = rtems_partition_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API partition class
@@ -20,27 +37,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_partition_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident.h
-test-prologue: |
-  static long area[32];
-  rtems_status_code sc;
-  rtems_id id_local_object;
-
-  sc = rtems_partition_create(
-    ClassicObjectIdentName,
-    area,
-    sizeof( area ),
-    sizeof( area ),
-    RTEMS_DEFAULT_ATTRIBUTES,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/part/val/part.yml b/spec/rtems/part/val/part.yml
index 43f1a71..f2514d2 100644
--- a/spec/rtems/part/val/part.yml
+++ b/spec/rtems/part/val/part.yml
@@ -5,6 +5,13 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t
+      buffers[ 4 ][ 2 * sizeof( void * ) ];
+    void              *pointers[ RTEMS_ARRAY_SIZE( buffers ) ];
+    void              *pointer;
+    rtems_status_code  sc;
+    rtems_id           id;
+
     id = 0xffffffff;
     sc = rtems_partition_create(
       rtems_build_name( 'N', 'A', 'M', 'E' ),
@@ -98,13 +105,7 @@ test-header: null
 test-includes:
 - rtems.h
 test-local-includes: []
-test-prologue: |
-  RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t
-    buffers[ 4 ][ 2 * sizeof( void * ) ];
-  void              *pointers[ RTEMS_ARRAY_SIZE( buffers ) ];
-  void              *pointer;
-  rtems_status_code  sc;
-  rtems_id           id;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: null
diff --git a/spec/rtems/ratemon/val/ident.yml b/spec/rtems/ratemon/val/ident.yml
index 0abbfe0..2a6f49e 100644
--- a/spec/rtems/ratemon/val/ident.yml
+++ b/spec/rtems/ratemon/val/ident.yml
@@ -7,10 +7,22 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    rtems_status_code sc;
+    rtems_id          id_local_object;
+
+    sc = rtems_rate_monotonic_create(
+      ClassicObjectLocalIdentName,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident-local:/test-run}(
       id_local_object,
       ClassicRatemonIdentAction
     );
+
+    sc = rtems_rate_monotonic_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API rate monotonic
@@ -20,22 +32,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_rate_monotonic_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident-local.h
-test-prologue: |
-  rtems_status_code sc;
-  rtems_id id_local_object;
-
-  sc = rtems_rate_monotonic_create(
-    ClassicObjectLocalIdentName,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/sem/val/ident.yml b/spec/rtems/sem/val/ident.yml
index ba40dfd..7b03f3d 100644
--- a/spec/rtems/sem/val/ident.yml
+++ b/spec/rtems/sem/val/ident.yml
@@ -7,10 +7,25 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    rtems_status_code sc;
+    rtems_id          id_local_object;
+
+    sc = rtems_semaphore_create(
+      ClassicObjectIdentName,
+      0,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      0,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident:/test-run}(
       id_local_object,
       ClassicSemIdentAction
     );
+
+    sc = rtems_semaphore_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API semaphore class
@@ -20,25 +35,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_semaphore_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident.h
-test-prologue: |
-  rtems_status_code sc;
-  rtems_id id_local_object;
-
-  sc = rtems_semaphore_create(
-    ClassicObjectIdentName,
-    0,
-    RTEMS_DEFAULT_ATTRIBUTES,
-    0,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/timer/val/ident.yml b/spec/rtems/timer/val/ident.yml
index 446e5dc..d69ca34 100644
--- a/spec/rtems/timer/val/ident.yml
+++ b/spec/rtems/timer/val/ident.yml
@@ -7,10 +7,22 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    rtems_status_code sc;
+    rtems_id          id_local_object;
+
+    sc = rtems_timer_create(
+      ClassicObjectLocalIdentName,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident-local:/test-run}(
       id_local_object,
       ClassicTimerIdentAction
     );
+
+    sc = rtems_timer_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API timer class
@@ -20,22 +32,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_timer_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident-local.h
-test-prologue: |
-  rtems_status_code sc;
-  rtems_id id_local_object;
-
-  sc = rtems_timer_create(
-    ClassicObjectLocalIdentName,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/rtems/userext/val/ident.yml b/spec/rtems/userext/val/ident.yml
index 03620bd..99ac879 100644
--- a/spec/rtems/userext/val/ident.yml
+++ b/spec/rtems/userext/val/ident.yml
@@ -7,10 +7,24 @@ links:
   uid: ../req/ident
 test-actions:
 - action: |
+    static const rtems_extensions_table table;
+    rtems_status_code                   sc;
+    rtems_id                            id_local_object;
+
+    sc = rtems_extension_create(
+      ClassicObjectLocalIdentName,
+      &table,
+      &id_local_object
+    );
+    T_assert_rsc_success( sc );
+
     ${../../req/ident-local:/test-run}(
       id_local_object,
       ClassicUserExtIdentAction
     );
+
+    sc = rtems_extension_delete( id_local_object );
+    T_rsc_success( sc );
   checks: []
   description: |
     Run the generic object identification tests for Classic API user extension
@@ -20,24 +34,12 @@ test-brief: Test the ${../if/ident:/name} directive.
 test-context: []
 test-context-support: null
 test-description: null
-test-epilogue: |
-  sc = rtems_extension_delete( id_local_object );
-  T_rsc_success( sc );
+test-epilogue: null
 test-header: null
 test-includes: []
 test-local-includes:
 - tr-object-ident-local.h
-test-prologue: |
-  static const rtems_extensions_table table;
-  rtems_status_code sc;
-  rtems_id id_local_object;
-
-  sc = rtems_extension_create(
-    ClassicObjectLocalIdentName,
-    &table,
-    &id_local_object
-  );
-  T_assert_rsc_success( sc );
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: |
diff --git a/spec/testsuites/validation/c-library.yml b/spec/testsuites/validation/c-library.yml
index 72cc988..5a0d41c 100644
--- a/spec/testsuites/validation/c-library.yml
+++ b/spec/testsuites/validation/c-library.yml
@@ -5,6 +5,10 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
+    void *p;
+    int s;
+    int d;
+
     p = aligned_alloc(128, 4);
   checks:
   - check: |
@@ -70,10 +74,7 @@ test-includes:
 - stdlib.h
 - rtems/malloc.h
 test-local-includes: []
-test-prologue: |
-  void *p;
-  int s;
-  int d;
+test-prologue: null
 test-setup: null
 test-stop: null
 test-support: null
diff --git a/spec/testsuites/validation/classic-barrier.yml b/spec/testsuites/validation/classic-barrier.yml
index e28795c..e4fb939 100644
--- a/spec/testsuites/validation/classic-barrier.yml
+++ b/spec/testsuites/validation/classic-barrier.yml
@@ -5,8 +5,17 @@ enabled-by: true
 links: []
 test-actions:
 - action: |
-    id = 0xffffffff;
-    sc = rtems_barrier_create(name, RTEMS_BARRIER_AUTOMATIC_RELEASE, 1, &id);
+    rtems_status_code sc;
+    rtems_id          id;
+    TestsuitesValidationClassicBarrier_Context *ctx = T_fixture_context();
+
+    ctx->id = 0xffffffff;
+    sc = rtems_barrier_create(
+      name,
+      RTEMS_BARRIER_AUTOMATIC_RELEASE,
+      1,
+      &ctx->id
+    );
   checks:
   - check: |
       T_step_rsc_success(${step}, sc);
@@ -18,8 +27,8 @@ test-actions:
     release barrier object for one task.
   links: []
 - action: |
-    id2 = 0xffffffff;
-    sc = rtems_barrier_ident(name, &id2);
+    id = 0xffffffff;
+    sc = rtems_barrier_ident(name, &id);
   checks:
   - check: |
       T_step_rsc_success(${step}, sc);
@@ -27,7 +36,7 @@ test-actions:
       Check that the barrier identification by name was successful.
     links: []
   - check: |
-      T_step_eq_u32(${step}, id, id2);
+      T_step_eq_u32(${step}, id, ctx->id);
     description: |
       Check that the second identifier is equal to the one returned by the
       barrier creation.
@@ -37,8 +46,10 @@ test-actions:
     object by its name.
   links: []
 - action: |
+    uint32_t released;
+
     released = 1;
-    sc = rtems_barrier_release(id, &released);
+    sc = rtems_barrier_release(ctx->id, &released);
   checks:
   - check: |
       T_step_rsc_success(${step}, sc);
@@ -54,7 +65,7 @@ test-actions:
     Set the count of released tasks to one and release the barrier.
   links: []
 - action: |
-    sc = rtems_barrier_wait(id, RTEMS_NO_TIMEOUT);
+    sc = rtems_barrier_wait(ctx->id, RTEMS_NO_TIMEOUT);
   checks:
   - check: |
       T_step_rsc_success(${step}, sc);
@@ -67,24 +78,27 @@ test-actions:
 test-brief: |
   This test case calls functions of the Barrier Manager which are included in
   the space profile.
-test-context: []
+test-context:
+- brief: null
+  description: null
+  member: |
+    rtems_id id
 test-context-support: null
 test-description: null
-test-epilogue: |
-  T_check_rtems_barriers(T_EVENT_RUN_INITIALIZE_EARLY, T_case_name());
+test-epilogue: null
 test-header: null
 test-includes:
 - rtems.h
 test-local-includes: []
-test-prologue: |
-  static const rtems_name name = rtems_build_name('B', 'A', 'R', 'R');
-  rtems_status_code sc;
-  rtems_id id;
-  rtems_id id2;
-  uint32_t released;
+test-prologue: null
 test-setup: null
 test-stop: null
-test-support: null
+test-support: |
+  static const rtems_name name = rtems_build_name( 'B', 'A', 'R', 'R' );
 test-target: testsuites/validation/tc-space-profile.c
-test-teardown: null
+test-teardown:
+  brief: null
+  code: |
+    T_check_rtems_barriers(T_EVENT_RUN_INITIALIZE_EARLY, T_case_name());
+  description: null
 type: test-case



More information about the vc mailing list