diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-02-21 17:30:38 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-02-21 17:46:42 +0100 |
commit | fdb04fd82b822a914010ac74d0445c8448718260 (patch) | |
tree | 94aae61681b055f854f563eebb03da5324dd41be | |
parent | spec: Fix partition create (diff) | |
download | rtems-central-fdb04fd82b822a914010ac74d0445c8448718260.tar.bz2 |
spec: Simplify message queue construct validation
-rw-r--r-- | spec/rtems/message/req/construct-errors.yml | 116 |
1 files changed, 46 insertions, 70 deletions
diff --git a/spec/rtems/message/req/construct-errors.yml b/spec/rtems/message/req/construct-errors.yml index f8dc995b..40bc9c68 100644 --- a/spec/rtems/message/req/construct-errors.yml +++ b/spec/rtems/message/req/construct-errors.yml @@ -146,55 +146,23 @@ pre-conditions: storage area size overflows. test-epilogue: null test-prologue: null -- name: Queues +- name: Free states: - - name: Avail + - name: 'Yes' test-code: | /* Nothing to do */ text: | The system shall have at least one inactive message queue object available. - - name: None + - name: 'No' test-code: | - memset( &config, 0, sizeof( config ) ); - config.name = rtems_build_name( 'M', 'S', 'G', 'Q' ); - config.maximum_pending_messages = MAX_PENDING_MESSAGES; - config.maximum_message_size = MAX_MESSAGE_SIZE; - config.storage_size = sizeof( exhaust_buffers[ 0 ] ); - config.attributes = RTEMS_DEFAULT_ATTRIBUTES; - i = 0; - - while ( i < MAX_MESSAGE_QUEUES ) { - rtems_status_code sc; - rtems_id id; - - config.storage_area = exhaust_buffers[ i ]; - - sc = rtems_message_queue_construct( &config, &id ); - - if ( sc == RTEMS_SUCCESSFUL ) { - Objects_Control *obj; - const Objects_Information *info; - - info = _Objects_Get_information_id( id ); - T_quiet_assert_not_null( info ); - obj = _Objects_Get_no_protection( id, info ); - T_quiet_assert_not_null( obj ); - _Chain_Append_unprotected( &ctx->message_queues, &obj->Node ); - } else { - T_quiet_rsc( sc, RTEMS_TOO_MANY ); - break; - } - - ++i; - } + ctx->seized_objects = T_seize_objects( Create, &i ); text: | The system shall have no inactive message queue object available. test-epilogue: null test-prologue: | - rtems_message_queue_config config; - size_t i; + size_t i; - name: Area states: - name: Valid @@ -235,16 +203,7 @@ test-action: | ctx->status = rtems_message_queue_construct( &ctx->config, ctx->id ); test-brief: null test-cleanup: | - Chain_Node *node; - - while ( ( node = _Chain_Get_unprotected( &ctx->message_queues ) ) ) { - Objects_Control *obj; - rtems_status_code sc; - - obj = (Objects_Control *) node; - sc = rtems_message_queue_delete( obj->id ); - T_quiet_rsc_success( sc ); - } + T_surrender_objects( &ctx->seized_objects, rtems_message_queue_delete ); test-context: - brief: null description: null @@ -265,7 +224,7 @@ test-context: - brief: null description: null member: | - Chain_Control message_queues + void *seized_objects test-context-support: null test-description: null test-header: null @@ -278,11 +237,7 @@ test-local-includes: [] test-prepare: | ctx->id_value = 0xffffffff; memset( &ctx->config, 0, sizeof( ctx->config ) ); -test-setup: - brief: null - code: | - _Chain_Initialize_empty( &ctx->message_queues ); - description: null +test-setup: null test-stop: null test-support: | #define MAX_MESSAGE_QUEUES 4 @@ -292,10 +247,31 @@ test-support: | #define MAX_MESSAGE_SIZE 1 static RTEMS_MESSAGE_QUEUE_BUFFER( MAX_MESSAGE_SIZE ) - exhaust_buffers[ MAX_MESSAGE_QUEUES ][ MAX_PENDING_MESSAGES ]; + buffers_to_seize[ MAX_MESSAGE_QUEUES ][ MAX_PENDING_MESSAGES ]; static RTEMS_MESSAGE_QUEUE_BUFFER( MAX_MESSAGE_SIZE ) buffers[ MAX_PENDING_MESSAGES ]; + + static rtems_status_code Create( void *arg, uint32_t *id ) + { + rtems_message_queue_config config; + size_t *i; + + i = arg; + T_quiet_lt_sz( *i, MAX_MESSAGE_QUEUES ); + + memset( &config, 0, sizeof( config ) ); + config.name = rtems_build_name( 'S', 'I', 'Z', 'E' ); + config.maximum_pending_messages = MAX_PENDING_MESSAGES; + config.maximum_message_size = MAX_MESSAGE_SIZE; + config.storage_size = sizeof( buffers_to_seize[ *i ] ); + config.storage_area = buffers_to_seize[ *i ]; + config.attributes = RTEMS_DEFAULT_ATTRIBUTES; + + ++(*i); + + return rtems_message_queue_construct( &config, id ); + } test-target: testsuites/validation/tc-message-construct-errors.c test-teardown: null text: ${.:text-template} @@ -316,8 +292,8 @@ transition-map: - Valid Name: - Valid - Queues: - - Avail + Free: + - 'Yes' - enabled-by: true post-conditions: Status: InvName @@ -329,7 +305,7 @@ transition-map: MaxSize: all Name: - Invalid - Queues: all + Free: all - enabled-by: true post-conditions: Status: InvAddr @@ -342,7 +318,7 @@ transition-map: MaxSize: all Name: - Valid - Queues: all + Free: all - enabled-by: true post-conditions: Status: InvNum @@ -356,7 +332,7 @@ transition-map: MaxSize: all Name: - Valid - Queues: all + Free: all - enabled-by: true post-conditions: Status: InvSize @@ -372,7 +348,7 @@ transition-map: - Zero Name: - Valid - Queues: all + Free: all - enabled-by: true post-conditions: Status: TooMany @@ -389,8 +365,8 @@ transition-map: - Big Name: - Valid - Queues: - - None + Free: + - 'No' - enabled-by: true post-conditions: Status: InvNum @@ -405,8 +381,8 @@ transition-map: - Valid Name: - Valid - Queues: - - Avail + Free: + - 'Yes' - enabled-by: true post-conditions: Status: InvSize @@ -422,8 +398,8 @@ transition-map: - Big Name: - Valid - Queues: - - Avail + Free: + - 'Yes' - enabled-by: true post-conditions: Status: Unsat @@ -439,8 +415,8 @@ transition-map: - Valid Name: - Valid - Queues: - - Avail + Free: + - 'Yes' - enabled-by: true post-conditions: Status: Unsat @@ -457,6 +433,6 @@ transition-map: - Valid Name: - Valid - Queues: - - Avail + Free: + - 'Yes' type: requirement |