[rtems-central commit] spec: Use tc-support.h
Sebastian Huber
sebh at rtems.org
Mon Mar 22 10:12:16 UTC 2021
Module: rtems-central
Branch: master
Commit: c36622ff5b14dd8f64eb61eb488f7a405f4bbd77
Changeset: http://git.rtems.org/rtems-central/commit/?id=c36622ff5b14dd8f64eb61eb488f7a405f4bbd77
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Sun Mar 21 16:04:44 2021 +0100
spec: Use tc-support.h
---
spec/rtems/barrier/req/create.yml | 32 ++---------
spec/rtems/barrier/req/delete.yml | 56 +++----------------
spec/rtems/barrier/req/release.yml | 73 +++++-------------------
spec/rtems/barrier/req/wait.yml | 101 ++++++----------------------------
spec/rtems/event/req/send-receive.yml | 76 +++++--------------------
spec/rtems/signal/req/catch.yml | 31 ++---------
spec/rtems/signal/req/send.yml | 83 +++++-----------------------
spec/rtems/task/req/mode.yml | 88 ++++++-----------------------
8 files changed, 94 insertions(+), 446 deletions(-)
diff --git a/spec/rtems/barrier/req/create.yml b/spec/rtems/barrier/req/create.yml
index 815f1eb..6fb6cf3 100644
--- a/spec/rtems/barrier/req/create.yml
+++ b/spec/rtems/barrier/req/create.yml
@@ -256,28 +256,16 @@ test-header: null
test-includes:
- rtems.h
- string.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
test-prepare: null
test-setup:
brief: null
code: |
- rtems_status_code sc;
-
memset( ctx, 0, sizeof( *ctx ) );
ctx->id_value = INVALID_ID;
-
- 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 );
+ ctx->worker_id = CreateTask( "WORK", PRIO_LOW );
+ StartTask( ctx->worker_id, Worker, ctx );
description: null
test-stop: null
test-support: |
@@ -287,11 +275,6 @@ test-support: |
typedef RtemsBarrierReqCreate_Context Context;
- typedef enum {
- PRIO_NORMAL = 1,
- PRIO_LOW
- } Priorities;
-
static void Worker( rtems_task_argument arg )
{
Context *ctx;
@@ -324,12 +307,7 @@ test-target: testsuites/validation/tc-barrier-create.c
test-teardown:
brief: null
code: |
- rtems_status_code sc;
-
- if ( ctx->worker_id != 0 ) {
- sc = rtems_task_delete( ctx->worker_id );
- T_rsc_success( sc );
- }
+ DeleteTask( ctx->worker_id );
description: null
text: ${.:text-template}
transition-map:
diff --git a/spec/rtems/barrier/req/delete.yml b/spec/rtems/barrier/req/delete.yml
index f961d8e..e8edc63 100644
--- a/spec/rtems/barrier/req/delete.yml
+++ b/spec/rtems/barrier/req/delete.yml
@@ -126,40 +126,20 @@ 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: |
@@ -167,12 +147,6 @@ test-support: |
typedef RtemsBarrierReqDelete_Context Context;
- typedef enum {
- PRIO_HIGH = 1,
- PRIO_NORMAL,
- PRIO_LOW
- } Priorities;
-
static void Worker( rtems_task_argument arg )
{
Context *ctx;
@@ -201,9 +175,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 );
}
}
@@ -211,18 +183,8 @@ test-target: testsuites/validation/tc-barrier-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/barrier/req/release.yml b/spec/rtems/barrier/req/release.yml
index 7c04606..aec50a3 100644
--- a/spec/rtems/barrier/req/release.yml
+++ b/spec/rtems/barrier/req/release.yml
@@ -149,37 +149,18 @@ test-header: null
test-includes:
- rtems.h
- string.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
test-prepare: null
test-setup:
brief: null
code: |
- rtems_status_code sc;
- rtems_task_priority prio;
+ rtems_status_code sc;
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_HIGH,
- 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_HIGH );
+ StartTask( ctx->worker_id, Worker, ctx );
sc = rtems_barrier_create(
NAME,
@@ -207,19 +188,6 @@ test-support: |
typedef RtemsBarrierReqRelease_Context Context;
- typedef enum {
- PRIO_HIGH = 1,
- PRIO_NORMAL
- } Priorities;
-
- static void SendEvents( rtems_id id, rtems_event_set events )
- {
- rtems_status_code sc;
-
- sc = rtems_event_send( id, events );
- T_rsc_success( sc );
- }
-
static void Worker( rtems_task_argument arg )
{
Context *ctx;
@@ -227,19 +195,13 @@ test-support: |
ctx = (Context *) arg;
while ( true ) {
- rtems_status_code sc;
- rtems_event_set events;
+ rtems_event_set events;
- events = 0;
- sc = rtems_event_receive(
- RTEMS_ALL_EVENTS,
- RTEMS_EVENT_ANY | RTEMS_WAIT,
- RTEMS_NO_TIMEOUT,
- &events
- );
- T_rsc_success( sc );
+ events = ReceiveAnyEvents();
if ( ( events & EVENT_WAIT ) != 0 ) {
+ rtems_status_code sc;
+
sc = rtems_barrier_wait( ctx->id, RTEMS_NO_TIMEOUT );
T_rsc_success( sc );
}
@@ -249,18 +211,9 @@ test-target: testsuites/validation/tc-barrier-release.c
test-teardown:
brief: null
code: |
- rtems_status_code sc;
- rtems_task_priority prio;
+ rtems_status_code sc;
- 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 );
if ( ctx->manual_release_id != 0 ) {
sc = rtems_barrier_delete( ctx->manual_release_id );
@@ -271,6 +224,8 @@ test-teardown:
sc = rtems_barrier_delete( ctx->auto_release_id );
T_rsc_success( sc );
}
+
+ RestoreRunnerPriority();
description: null
text: ${.:text-template}
transition-map:
diff --git a/spec/rtems/barrier/req/wait.yml b/spec/rtems/barrier/req/wait.yml
index 3082701..40f4be8 100644
--- a/spec/rtems/barrier/req/wait.yml
+++ b/spec/rtems/barrier/req/wait.yml
@@ -157,55 +157,21 @@ test-header: null
test-includes:
- rtems.h
- string.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
test-prepare: null
test-setup:
brief: null
code: |
- rtems_status_code sc;
- rtems_task_priority prio;
+ rtems_status_code sc;
memset( ctx, 0, sizeof( *ctx ) );
ctx->main_id = rtems_task_self();
-
- 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_HIGH,
- RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &ctx->high_worker_id
- );
- T_assert_rsc_success( sc );
-
- sc = rtems_task_start(
- ctx->high_worker_id,
- Worker,
- (rtems_task_argument) ctx
- );
- T_assert_rsc_success( sc );
-
- sc = rtems_task_create(
- rtems_build_name( 'W', 'O', 'R', 'K' ),
- PRIO_LOW,
- RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &ctx->low_worker_id
- );
- T_assert_rsc_success( sc );
-
- sc = rtems_task_start(
- ctx->low_worker_id,
- Worker,
- (rtems_task_argument) ctx
- );
- T_assert_rsc_success( sc );
+ SetSelfPriority( PRIO_NORMAL );
+ ctx->high_worker_id = CreateTask( "WRKH", PRIO_HIGH );
+ StartTask( ctx->high_worker_id, Worker, ctx );
+ ctx->low_worker_id = CreateTask( "WRKL", PRIO_LOW );
+ StartTask( ctx->low_worker_id, Worker, ctx );
sc = rtems_barrier_create(
NAME,
@@ -237,20 +203,6 @@ test-support: |
typedef RtemsBarrierReqWait_Context Context;
- typedef enum {
- PRIO_HIGH = 1,
- PRIO_NORMAL,
- PRIO_LOW
- } Priorities;
-
- static void SendEvents( rtems_id id, rtems_event_set events )
- {
- rtems_status_code sc;
-
- sc = rtems_event_send( id, events );
- T_rsc_success( sc );
- }
-
static void Worker( rtems_task_argument arg )
{
Context *ctx;
@@ -261,14 +213,7 @@ test-support: |
rtems_status_code sc;
rtems_event_set events;
- events = 0;
- sc = rtems_event_receive(
- RTEMS_ALL_EVENTS,
- RTEMS_EVENT_ANY | RTEMS_WAIT,
- RTEMS_NO_TIMEOUT,
- &events
- );
- T_rsc_success( sc );
+ events = ReceiveAnyEvents();
if ( ( events & EVENT_CHECK_TIMER ) != 0 ) {
T_eq_int(
@@ -305,9 +250,7 @@ test-support: |
id = &ctx->auto_release_id;
}
- prio = 0;
- sc = rtems_task_set_priority( RTEMS_SELF, PRIO_HIGH, &prio );
- T_rsc_success( sc );
+ prio = SetSelfPriority( PRIO_HIGH );
T_eq_u32( prio, PRIO_LOW );
sc = rtems_barrier_delete( ctx->id );
@@ -316,8 +259,7 @@ test-support: |
sc = rtems_barrier_create( NAME, attribute_set, maximum_waiters, id );
T_rsc_success( sc );
- sc = rtems_task_set_priority( RTEMS_SELF, prio, &prio );
- T_rsc_success( sc );
+ prio = SetSelfPriority( prio );
T_eq_u32( prio, PRIO_HIGH );
}
}
@@ -326,23 +268,10 @@ test-target: testsuites/validation/tc-barrier-wait.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 );
+ rtems_status_code sc;
- if ( ctx->high_worker_id != 0 ) {
- sc = rtems_task_delete( ctx->high_worker_id );
- T_rsc_success( sc );
- }
-
- if ( ctx->low_worker_id != 0 ) {
- sc = rtems_task_delete( ctx->low_worker_id );
- T_rsc_success( sc );
- }
+ DeleteTask( ctx->high_worker_id );
+ DeleteTask( ctx->low_worker_id );
if ( ctx->manual_release_id != 0 ) {
sc = rtems_barrier_delete( ctx->manual_release_id );
@@ -353,6 +282,8 @@ test-teardown:
sc = rtems_barrier_delete( ctx->auto_release_id );
T_rsc_success( sc );
}
+
+ RestoreRunnerPriority();
description: null
text: ${.:text-template}
transition-map:
diff --git a/spec/rtems/event/req/send-receive.yml b/spec/rtems/event/req/send-receive.yml
index 12b5f1d..30c851d 100644
--- a/spec/rtems/event/req/send-receive.yml
+++ b/spec/rtems/event/req/send-receive.yml
@@ -285,20 +285,16 @@ test-action: |
if ( ctx->sender_type == SENDER_SELF_2 ) {
SendAction( ctx );
} else if ( ctx->sender_type == SENDER_WORKER ) {
- rtems_status_code sc;
rtems_task_priority prio;
Wait( ctx->runner_wakeup );
-
- prio = 0;
- sc = rtems_task_set_priority( ctx->worker_id, PRIO_LOW, &prio );
- T_rsc_success( sc );
+ prio = SetPriority( ctx->worker_id, PRIO_LOW );
T_eq_u32( prio, PRIO_HIGH );
}
test-brief: null
test-cleanup: |
rtems_status_code sc;
- rtems_event_set events;
+ rtems_event_set events;
events = 0;
sc = ( *ctx->receive )(
@@ -321,7 +317,7 @@ test-context:
- brief: |
This member defines the sender task priority.
description: null
- member: Priorities sender_prio
+ member: rtems_task_priority sender_prio
- brief: |
This member defines the receiver ID used for the event send action.
description: null
@@ -405,12 +401,7 @@ test-context:
description: null
member: T_thread_switch_log_4 thread_switch_log
test-context-support: |
- typedef enum {
- PRIO_HIGH = 1,
- PRIO_NORMAL,
- PRIO_LOW,
- PRIO_OTHER
- } Priorities;
+ #define PRIO_OTHER UINT32_MAX
typedef enum {
SENDER_NONE,
@@ -469,6 +460,7 @@ test-header:
test-includes:
- rtems/score/threadimpl.h
test-local-includes:
+- tc-support.h
- tr-event-send-receive.h
test-prepare: |
ctx->events_to_send = 0;
@@ -488,8 +480,7 @@ test-prepare: |
test-setup:
brief: null
code: |
- rtems_status_code sc;
- rtems_task_priority prio;
+ rtems_status_code sc;
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_thread = _Thread_Get_executing();
@@ -506,48 +497,20 @@ test-setup:
T_ne_u32( ctx->runner_sched, ctx->other_sched );
#endif
- 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_construct( &WorkerConfig, &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 INPUT_EVENTS ( RTEMS_EVENT_5 | RTEMS_EVENT_23 )
- #define WORKER_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
-
- #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
-
typedef RtemsEventReqSendReceive_Context Context;
- RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage[
- RTEMS_TASK_STORAGE_SIZE(
- MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
- WORKER_ATTRIBUTES
- )
- ];
-
- static const rtems_task_config WorkerConfig = {
- .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
- .initial_priority = PRIO_LOW,
- .storage_area = WorkerStorage,
- .storage_size = sizeof( WorkerStorage ),
- .maximum_thread_local_storage_size = MAX_TLS_SIZE,
- .initial_modes = RTEMS_DEFAULT_MODES,
- .attributes = WORKER_ATTRIBUTES
- };
-
static rtems_id CreateWakeupSema( void )
{
rtems_status_code sc;
- rtems_id id;
+ rtems_id id;
sc = rtems_semaphore_create(
rtems_build_name( 'W', 'K', 'U', 'P' ),
@@ -670,9 +633,7 @@ test-support: |
switch ( ctx->sender_prio ) {
case PRIO_NORMAL:
case PRIO_HIGH:
- prio = 0;
- sc = rtems_task_set_priority( RTEMS_SELF, ctx->sender_prio, &prio );
- T_rsc_success( sc );
+ prio = SetSelfPriority( ctx->sender_prio );
T_eq_u32( prio, PRIO_LOW );
break;
case PRIO_OTHER:
@@ -803,21 +764,10 @@ test-target: testsuites/validation/tr-event-send-receive.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 );
DeleteWakeupSema( ctx->worker_wakeup );
DeleteWakeupSema( ctx->runner_wakeup );
+ RestoreRunnerPriority();
description: null
text: ${.:text-template}
transition-map:
diff --git a/spec/rtems/signal/req/catch.yml b/spec/rtems/signal/req/catch.yml
index ba1d71c..6d80b9c 100644
--- a/spec/rtems/signal/req/catch.yml
+++ b/spec/rtems/signal/req/catch.yml
@@ -324,7 +324,8 @@ test-includes:
- rtems.h
- string.h
- rtems/score/smpbarrier.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
test-prepare: |
rtems_status_code sc;
@@ -349,15 +350,7 @@ test-setup:
rtems_status_code sc;
rtems_id scheduler_id;
- sc = rtems_task_create(
- rtems_build_name( 'W', 'O', 'R', 'K' ),
- 1,
- RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &ctx->worker_id
- );
- T_assert_rsc_success( sc );
+ ctx->worker_id = CreateTask( "WORK", 1 );
sc = rtems_scheduler_ident_by_processor( 1, &scheduler_id );
T_assert_rsc_success( sc );
@@ -365,12 +358,7 @@ test-setup:
sc = rtems_task_set_scheduler( ctx->worker_id, scheduler_id, 1 );
T_assert_rsc_success( sc );
- sc = rtems_task_start(
- ctx->worker_id,
- Worker,
- (rtems_task_argument) ctx
- );
- T_assert_rsc_success( sc );
+ StartTask( ctx->worker_id, Worker, ctx );
}
description: null
test-stop: null
@@ -452,15 +440,8 @@ test-target: testsuites/validation/tc-signal-catch.c
test-teardown:
brief: null
code: |
- rtems_status_code sc;
-
- if ( ctx->worker_id != 0 ) {
- sc = rtems_task_delete( ctx->worker_id );
- T_rsc_success( sc );
- }
-
- sc = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
- T_rsc_success( sc );
+ DeleteTask( ctx->worker_id );
+ RestoreRunnerASR();
description: null
text: ${.:text-template}
transition-map:
diff --git a/spec/rtems/signal/req/send.yml b/spec/rtems/signal/req/send.yml
index 050c6e8..6e9d02d 100644
--- a/spec/rtems/signal/req/send.yml
+++ b/spec/rtems/signal/req/send.yml
@@ -293,7 +293,8 @@ test-description: null
test-header: null
test-includes:
- rtems.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
test-prepare: |
ctx->handler_calls = 0;
ctx->calls_after_send = 0;
@@ -304,26 +305,13 @@ test-prepare: |
test-setup:
brief: null
code: |
- rtems_status_code sc;
- rtems_task_priority prio;
+ rtems_status_code sc;
memset( ctx, 0, sizeof( *ctx ) );
ctx->runner_id = rtems_task_self();
+ SetSelfPriority( PRIO_NORMAL );
- 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_HIGH,
- RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- &ctx->worker_id
- );
- T_assert_rsc_success( sc );
+ ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
#if defined(RTEMS_SMP)
if ( rtems_scheduler_get_processor_maximum() > 1 ) {
@@ -337,8 +325,7 @@ test-setup:
}
#endif
- sc = rtems_task_start( ctx->worker_id, Worker, (rtems_task_argument) ctx );
- T_assert_rsc_success( sc );
+ StartTask( ctx->worker_id, Worker, ctx );
description: null
test-stop: null
test-support: |
@@ -354,36 +341,6 @@ test-support: |
typedef RtemsSignalReqSend_Context Context;
- typedef enum {
- PRIO_HIGH = 1,
- PRIO_NORMAL
- } Priorities;
-
- static rtems_event_set Wait( void )
- {
- rtems_status_code sc;
- rtems_event_set events;
-
- events = 0;
- sc = rtems_event_receive(
- RTEMS_ALL_EVENTS,
- RTEMS_EVENT_ANY | RTEMS_WAIT,
- RTEMS_NO_TIMEOUT,
- &events
- );
- T_rsc_success( sc );
-
- return events;
- }
-
- static void SendEvents( rtems_id id, rtems_event_set events )
- {
- rtems_status_code sc;
-
- sc = rtems_event_send( id, events );
- T_rsc_success( sc );
- }
-
static void WorkerDone( const Context *ctx )
{
#if defined(RTEMS_SMP)
@@ -399,7 +356,7 @@ test-support: |
#if defined(RTEMS_SMP)
if ( rtems_scheduler_get_processor_maximum() > 1 ) {
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_WORKER_DONE );
}
#endif
@@ -430,12 +387,12 @@ test-support: |
WorkerDone( ctx );
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_SEND_DONE );
WorkerDone( ctx );
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_DO_ENABLE );
} else {
sc = rtems_signal_catch( ctx->handler, RTEMS_NO_ASR );
@@ -458,7 +415,7 @@ test-support: |
rtems_status_code sc;
rtems_event_set events;
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_START );
if ( ctx->nested != 0 ) {
@@ -480,12 +437,12 @@ test-support: |
WorkerDone( ctx );
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_SEND_DONE );
WorkerDone( ctx );
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_DO_ENABLE );
sc = rtems_task_mode( mode, RTEMS_ASR_MASK, &mode );
@@ -494,7 +451,7 @@ test-support: |
WorkerDone( ctx );
}
- events = Wait();
+ events = ReceiveAnyEvents();
T_eq_u32( events, EVENT_END );
WorkerDone( ctx );
@@ -504,18 +461,8 @@ test-target: testsuites/validation/tc-signal-send.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/task/req/mode.yml b/spec/rtems/task/req/mode.yml
index 5fc3bc4..481dcb2 100644
--- a/spec/rtems/task/req/mode.yml
+++ b/spec/rtems/task/req/mode.yml
@@ -419,7 +419,7 @@ test-action: |
sc = rtems_task_mode( ctx->current_mode, RTEMS_ALL_MODE_MASKS, &mode );
T_rsc_success( sc );
- SendEvent( ctx, EVENT_MAKE_READY );
+ SendEvents( ctx->worker_id, EVENT_MAKE_READY );
sc = rtems_signal_catch( SignalHandler, ctx->current_mode | RTEMS_NO_ASR );
T_rsc_success( sc );
@@ -532,7 +532,8 @@ test-includes:
- rtems/score/percpu.h
- rtems/score/threaddispatch.h
- rtems/score/watchdogimpl.h
-test-local-includes: []
+test-local-includes:
+- tc-support.h
test-prepare: |
ctx->current_mode = RTEMS_DEFAULT_MODES;
ctx->mode_set = RTEMS_DEFAULT_MODES;
@@ -552,24 +553,9 @@ test-setup:
);
T_rsc_success( sc );
- SetPriority( PRIO_NORMAL );
-
- sc = rtems_task_create(
- rtems_build_name( 'W', 'O', 'R', 'K' ),
- PRIO_HIGH,
- 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_HIGH );
+ StartTask( ctx->worker_id, Worker, ctx );
description: null
test-stop: null
test-support: |
@@ -581,28 +567,6 @@ test-support: |
typedef RtemsTaskReqMode_Context Context;
- typedef enum {
- PRIO_HIGH = 1,
- PRIO_NORMAL
- } Priority;
-
- static void SendEvent( Context *ctx, rtems_event_set event )
- {
- rtems_status_code sc;
-
- sc = rtems_event_send( ctx->worker_id, event );
- T_rsc_success( sc );
- }
-
- static void SetPriority( Priority priority )
- {
- rtems_status_code sc;
- rtems_task_priority previous;
-
- sc = rtems_task_set_priority( RTEMS_SELF, priority, &previous );
- T_rsc_success( sc );
- }
-
static void Worker( rtems_task_argument arg )
{
Context *ctx;
@@ -610,21 +574,13 @@ test-support: |
ctx = (Context *) arg;
while ( true ) {
- rtems_status_code sc;
- rtems_event_set events;
-
- events = 0;
- sc = rtems_event_receive(
- RTEMS_ALL_EVENTS,
- RTEMS_EVENT_ANY | RTEMS_WAIT,
- RTEMS_NO_TIMEOUT,
- &events
- );
- T_rsc_success( sc );
+ rtems_event_set events;
+
+ events = ReceiveAnyEvents();
if ( ( events & EVENT_TIMESLICE ) != 0 ) {
- SetPriority( PRIO_NORMAL );
- SetPriority( PRIO_HIGH );
+ SetSelfPriority( PRIO_NORMAL );
+ SetSelfPriority( PRIO_HIGH );
}
++ctx->worker_counter;
@@ -680,7 +636,7 @@ test-support: |
mode |= set & mask;
counter = ctx->worker_counter;
- SendEvent( ctx, EVENT_MAKE_READY );
+ SendEvents( ctx->worker_id, EVENT_MAKE_READY );
if ( ( mode & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT ) {
T_eq_u32( ctx->worker_counter, counter + 1 );
@@ -689,7 +645,7 @@ test-support: |
}
counter = ctx->worker_counter;
- SendEvent( ctx, EVENT_TIMESLICE );
+ SendEvents( ctx->worker_id, EVENT_TIMESLICE );
ExhaustTimeslice();
if ( ( mode & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT ) {
@@ -718,21 +674,9 @@ test-target: testsuites/validation/tc-task-mode.c
test-teardown:
brief: null
code: |
- rtems_status_code sc;
-
- if ( ctx->worker_id != 0 ) {
- sc = rtems_task_delete( ctx->worker_id );
- T_rsc_success( sc );
- }
-
- sc = rtems_task_mode(
- ctx->runner_mode,
- RTEMS_ALL_MODE_MASKS,
- &ctx->runner_mode
- );
- T_rsc_success( sc );
-
- SetPriority( PRIO_HIGH );
+ DeleteTask( ctx->worker_id );
+ RestoreRunnerMode();
+ RestoreRunnerPriority();
description: null
text: ${.:text-template}
transition-map:
More information about the vc
mailing list