[rtems-central commit] spec: Use tc-support.h

Sebastian Huber sebh at rtems.org
Tue Mar 23 07:09:45 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 23 08:01:44 2021 +0100

spec: Use tc-support.h

---

 spec/rtems/message/req/delete.yml | 60 +++++++--------------------------------
 spec/rtems/sem/req/create.yml     | 14 ++++-----
 2 files changed, 16 insertions(+), 58 deletions(-)

diff --git a/spec/rtems/message/req/delete.yml b/spec/rtems/message/req/delete.yml
index 2b36b1c..4f4fbf3 100644
--- a/spec/rtems/message/req/delete.yml
+++ b/spec/rtems/message/req/delete.yml
@@ -126,57 +126,31 @@ test-header: null
 test-includes:
 - rtems.h
 - string.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
 test-prepare: |
-  rtems_status_code   sc;
   rtems_task_priority prio;
 
-  prio = 0;
-  sc = rtems_task_set_priority( ctx->worker_id, PRIO_HIGH, &prio );
-  T_rsc_success( sc );
+  prio = SetPriority( ctx->worker_id, PRIO_HIGH );
   T_true( prio == PRIO_LOW || prio == PRIO_HIGH );
 test-setup:
   brief: null
   code: |
-    rtems_status_code   sc;
-    rtems_task_priority prio;
-
     memset( ctx, 0, sizeof( *ctx ) );
-
-    prio = 0;
-    sc = rtems_task_set_priority( RTEMS_SELF, PRIO_NORMAL, &prio );
-    T_rsc_success( sc );
-    T_eq_u32( prio, PRIO_HIGH );
-
-    sc = rtems_task_create(
-      rtems_build_name( 'W', 'O', 'R', 'K' ),
-      PRIO_LOW,
-      RTEMS_MINIMUM_STACK_SIZE,
-      RTEMS_DEFAULT_MODES,
-      RTEMS_DEFAULT_ATTRIBUTES,
-      &ctx->worker_id
-    );
-    T_assert_rsc_success( sc );
-
-    sc = rtems_task_start( ctx->worker_id, Worker, (rtems_task_argument) ctx );
-    T_assert_rsc_success( sc );
+    SetSelfPriority( PRIO_NORMAL );
+    ctx->worker_id = CreateTask( "WORK", PRIO_LOW );
+    StartTask( ctx->worker_id, Worker, ctx );
   description: null
 test-stop: null
 test-support: |
   #define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
 
-  typedef RtemsMessageReqDelete_Context Context;
-
-  typedef enum {
-    PRIO_HIGH = 1,
-    PRIO_NORMAL,
-    PRIO_LOW
-  } Priorities;
-
   #define MAX_PENDING_MESSAGES 1
 
   #define MAX_MESSAGE_SIZE 1
 
+  typedef RtemsMessageReqDelete_Context Context;
+
   static RTEMS_MESSAGE_QUEUE_BUFFER( MAX_MESSAGE_SIZE )
     buffers[ MAX_PENDING_MESSAGES ];
 
@@ -219,9 +193,7 @@ test-support: |
 
       ++ctx->wait_done;
 
-      prio = 0;
-      sc = rtems_task_set_priority( RTEMS_SELF, PRIO_LOW, &prio );
-      T_rsc_success( sc );
+      prio = SetSelfPriority( PRIO_LOW );
       T_eq_u32( prio, PRIO_HIGH );
     }
   }
@@ -229,18 +201,8 @@ test-target: testsuites/validation/tc-message-delete.c
 test-teardown:
   brief: null
   code: |
-    rtems_status_code   sc;
-    rtems_task_priority prio;
-
-    prio = 0;
-    sc = rtems_task_set_priority( RTEMS_SELF, PRIO_HIGH, &prio );
-    T_rsc_success( sc );
-    T_eq_u32( prio, PRIO_NORMAL );
-
-    if ( ctx->worker_id != 0 ) {
-      sc = rtems_task_delete( ctx->worker_id );
-      T_rsc_success( sc );
-    }
+    DeleteTask( ctx->worker_id );
+    RestoreRunnerPriority();
   description: null
 text: ${.:text-template}
 transition-map:
diff --git a/spec/rtems/sem/req/create.yml b/spec/rtems/sem/req/create.yml
index 25c9885..3877fa3 100644
--- a/spec/rtems/sem/req/create.yml
+++ b/spec/rtems/sem/req/create.yml
@@ -184,23 +184,18 @@ post-conditions:
   states:
   - name: Ceiling
     test-code: |
-      T_eq_u32( prio, ctx->priority_ceiling );
+      T_eq_u32( GetSelfPriority(), ctx->priority_ceiling );
     text: |
       The current priority of the task which called ${../if/create:/name} shall
       be equal to the value of the ${../if/create:/params[3]/name} parameter.
   - name: Nop
     test-code: |
-      T_eq_u32( prio, 1 );
+      T_eq_u32( GetSelfPriority(), 1 );
     text: |
       The current priority of the task which called ${../if/create:/name} shall
       not be modified by the ${../if/create:/name} call.
   test-epilogue: null
-  test-prologue:
-    rtems_status_code   sc;
-    rtems_task_priority prio;
-
-    sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio );
-    T_rsc_success( sc );
+  test-prologue: null
 pre-conditions:
 - name: Name
   states:
@@ -481,7 +476,8 @@ test-includes:
 - limits.h
 - string.h
 - rtems/rtems/semimpl.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
 test-prepare: |
   rtems_status_code sc;
   rtems_id          id;



More information about the vc mailing list