diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-08 11:16:48 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-09 15:47:12 +0100 |
commit | f29a8db20dbdb34abf434b157ac7efba0b5a73c4 (patch) | |
tree | 4a1d3e02cd03d2acd5951616e697687e14e617ec | |
parent | b490f007a4e40cf59f85d3a7e07f3ab0af69aa62 (diff) |
testsuites/unit/tc-score-msgq.c
-rw-r--r-- | testsuites/unit/tc-score-msgq.c | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/testsuites/unit/tc-score-msgq.c b/testsuites/unit/tc-score-msgq.c index 25bbb7d9c8..9ceaf2553b 100644 --- a/testsuites/unit/tc-score-msgq.c +++ b/testsuites/unit/tc-score-msgq.c @@ -147,62 +147,6 @@ typedef struct { static ScoreMsgqUnitMsgq_Context ScoreMsgqUnitMsgq_Instance; -static void ScoreMsgqUnitMsgq_Setup( ScoreMsgqUnitMsgq_Context *ctx ) -{ - rtems_status_code status; - rtems_message_queue_config config = { - .name = rtems_build_name( 'M', 'S', 'G', 'Q' ), - .maximum_pending_messages = MAXIMUM_PENDING_MESSAGES, - .maximum_message_size = MAXIMUM_MESSAGE_SIZE, - .storage_area = ctx->storage_area, - .storage_size = sizeof( ctx->storage_area ), - .storage_free = NULL, - .attributes = RTEMS_DEFAULT_ATTRIBUTES - }; - - status = rtems_message_queue_construct( - &config, - &ctx->message_queue_id - ); - T_rsc_success( status ); - - SetSelfPriority( PRIO_NORMAL ); - - ctx->worker_id = CreateTask( "WORK", PRIO_HIGH ); - StartTask( ctx->worker_id, WorkerTask, ctx ); -} - -static void ScoreMsgqUnitMsgq_Setup_Wrap( void *arg ) -{ - ScoreMsgqUnitMsgq_Context *ctx; - - ctx = arg; - ScoreMsgqUnitMsgq_Setup( ctx ); -} - -static void ScoreMsgqUnitMsgq_Teardown( ScoreMsgqUnitMsgq_Context *ctx ) -{ - DeleteTask( ctx->worker_id ); - RestoreRunnerPriority(); - T_rsc_success( rtems_message_queue_delete( ctx->message_queue_id ) ); -} - -static void ScoreMsgqUnitMsgq_Teardown_Wrap( void *arg ) -{ - ScoreMsgqUnitMsgq_Context *ctx; - - ctx = arg; - ScoreMsgqUnitMsgq_Teardown( ctx ); -} - -static T_fixture ScoreMsgqUnitMsgq_Fixture = { - .setup = ScoreMsgqUnitMsgq_Setup_Wrap, - .stop = NULL, - .teardown = ScoreMsgqUnitMsgq_Teardown_Wrap, - .scope = NULL, - .initial_context = &ScoreMsgqUnitMsgq_Instance -}; - #define EVENT_SEND RTEMS_EVENT_17 #define MESSAGE_CONTENT_LOW { 1, 2, 3 } #define MESSAGE_CONTENT_HIGH { 4, 5 } @@ -317,6 +261,62 @@ static void WorkerSendMessage( Context *ctx ) SendEvents( ctx->worker_id, EVENT_SEND ); } +static void ScoreMsgqUnitMsgq_Setup( ScoreMsgqUnitMsgq_Context *ctx ) +{ + rtems_status_code status; + rtems_message_queue_config config = { + .name = rtems_build_name( 'M', 'S', 'G', 'Q' ), + .maximum_pending_messages = MAXIMUM_PENDING_MESSAGES, + .maximum_message_size = MAXIMUM_MESSAGE_SIZE, + .storage_area = ctx->storage_area, + .storage_size = sizeof( ctx->storage_area ), + .storage_free = NULL, + .attributes = RTEMS_DEFAULT_ATTRIBUTES + }; + + status = rtems_message_queue_construct( + &config, + &ctx->message_queue_id + ); + T_rsc_success( status ); + + SetSelfPriority( PRIO_NORMAL ); + + ctx->worker_id = CreateTask( "WORK", PRIO_HIGH ); + StartTask( ctx->worker_id, WorkerTask, ctx ); +} + +static void ScoreMsgqUnitMsgq_Setup_Wrap( void *arg ) +{ + ScoreMsgqUnitMsgq_Context *ctx; + + ctx = arg; + ScoreMsgqUnitMsgq_Setup( ctx ); +} + +static void ScoreMsgqUnitMsgq_Teardown( ScoreMsgqUnitMsgq_Context *ctx ) +{ + DeleteTask( ctx->worker_id ); + RestoreRunnerPriority(); + T_rsc_success( rtems_message_queue_delete( ctx->message_queue_id ) ); +} + +static void ScoreMsgqUnitMsgq_Teardown_Wrap( void *arg ) +{ + ScoreMsgqUnitMsgq_Context *ctx; + + ctx = arg; + ScoreMsgqUnitMsgq_Teardown( ctx ); +} + +static T_fixture ScoreMsgqUnitMsgq_Fixture = { + .setup = ScoreMsgqUnitMsgq_Setup_Wrap, + .stop = NULL, + .teardown = ScoreMsgqUnitMsgq_Teardown_Wrap, + .scope = NULL, + .initial_context = &ScoreMsgqUnitMsgq_Instance +}; + /** * @brief Use _CORE_message_queue_Insert_message() to insert two messages into * a message queue and use the POSIX message priority to define their order |