From 8047c9068b62893f63d223232d257f119b3077ff Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 7 Oct 2020 15:20:06 +0200 Subject: validation: Add tests for Partition Manager --- spec/build/testsuites/validation/validation-0.yml | 5 + testsuites/validation/tc-part-create.c | 1535 +++++++++++++++++++++ testsuites/validation/tc-part-delete.c | 364 +++++ testsuites/validation/tc-part-get.c | 456 ++++++ testsuites/validation/tc-part-ident.c | 12 +- testsuites/validation/tc-part-return.c | 379 +++++ testsuites/validation/tc-part.c | 156 +++ 7 files changed, 2903 insertions(+), 4 deletions(-) create mode 100644 testsuites/validation/tc-part-create.c create mode 100644 testsuites/validation/tc-part-delete.c create mode 100644 testsuites/validation/tc-part-get.c create mode 100644 testsuites/validation/tc-part-return.c create mode 100644 testsuites/validation/tc-part.c diff --git a/spec/build/testsuites/validation/validation-0.yml b/spec/build/testsuites/validation/validation-0.yml index 3477b682e0..e4557c03f9 100644 --- a/spec/build/testsuites/validation/validation-0.yml +++ b/spec/build/testsuites/validation/validation-0.yml @@ -19,7 +19,12 @@ source: - testsuites/validation/tc-message-ident.c - testsuites/validation/tc-modes.c - testsuites/validation/tc-options.c +- testsuites/validation/tc-part.c +- testsuites/validation/tc-part-create.c +- testsuites/validation/tc-part-delete.c +- testsuites/validation/tc-part-get.c - testsuites/validation/tc-part-ident.c +- testsuites/validation/tc-part-return.c - testsuites/validation/tc-ratemon-ident.c - testsuites/validation/tc-sem-ident.c - testsuites/validation/tc-task-construct-errors.c diff --git a/testsuites/validation/tc-part-create.c b/testsuites/validation/tc-part-create.c new file mode 100644 index 0000000000..6b2e3b2179 --- /dev/null +++ b/testsuites/validation/tc-part-create.c @@ -0,0 +1,1535 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseRtemsPartReqCreate + */ + +/* + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://docs.rtems.org/branches/master/user/support/bugs.html + * + * For information on updating and regenerating please refer to: + * + * https://docs.rtems.org/branches/master/eng/req/howto.html + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include + +/** + * @defgroup RTEMSTestCaseRtemsPartReqCreate spec:/rtems/part/req/create + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @{ + */ + +typedef enum { + RtemsPartReqCreate_Pre_Id_Id, + RtemsPartReqCreate_Pre_Id_Null, + RtemsPartReqCreate_Pre_Id_NA +} RtemsPartReqCreate_Pre_Id; + +typedef enum { + RtemsPartReqCreate_Pre_Name_Valid, + RtemsPartReqCreate_Pre_Name_Invalid, + RtemsPartReqCreate_Pre_Name_NA +} RtemsPartReqCreate_Pre_Name; + +typedef enum { + RtemsPartReqCreate_Pre_Start_Valid, + RtemsPartReqCreate_Pre_Start_Null, + RtemsPartReqCreate_Pre_Start_BadAlign, + RtemsPartReqCreate_Pre_Start_NA +} RtemsPartReqCreate_Pre_Start; + +typedef enum { + RtemsPartReqCreate_Pre_Length_Valid, + RtemsPartReqCreate_Pre_Length_Zero, + RtemsPartReqCreate_Pre_Length_Invalid, + RtemsPartReqCreate_Pre_Length_NA +} RtemsPartReqCreate_Pre_Length; + +typedef enum { + RtemsPartReqCreate_Pre_Size_Valid, + RtemsPartReqCreate_Pre_Size_Zero, + RtemsPartReqCreate_Pre_Size_Small, + RtemsPartReqCreate_Pre_Size_NA +} RtemsPartReqCreate_Pre_Size; + +typedef enum { + RtemsPartReqCreate_Pre_Parts_Avail, + RtemsPartReqCreate_Pre_Parts_None, + RtemsPartReqCreate_Pre_Parts_NA +} RtemsPartReqCreate_Pre_Parts; + +typedef enum { + RtemsPartReqCreate_Post_Status_Ok, + RtemsPartReqCreate_Post_Status_InvAddress, + RtemsPartReqCreate_Post_Status_InvName, + RtemsPartReqCreate_Post_Status_InvNumber, + RtemsPartReqCreate_Post_Status_InvSize, + RtemsPartReqCreate_Post_Status_TooMany, + RtemsPartReqCreate_Post_Status_NA +} RtemsPartReqCreate_Post_Status; + +/** + * @brief Test context for spec:/rtems/part/req/create test case. + */ +typedef struct { + rtems_status_code status; + + rtems_name name; + + void *starting_address; + + uintptr_t length; + + size_t buffer_size; + + rtems_attribute attribute_set; + + rtems_id *id; + + rtems_id id_value; + + Chain_Control partitions; + + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 6 ]; + + /** + * @brief This member indicates if the test action loop is currently + * executed. + */ + bool in_action_loop; +} RtemsPartReqCreate_Context; + +static RtemsPartReqCreate_Context + RtemsPartReqCreate_Instance; + +static const char * const RtemsPartReqCreate_PreDesc_Id[] = { + "Id", + "Null", + "NA" +}; + +static const char * const RtemsPartReqCreate_PreDesc_Name[] = { + "Valid", + "Invalid", + "NA" +}; + +static const char * const RtemsPartReqCreate_PreDesc_Start[] = { + "Valid", + "Null", + "BadAlign", + "NA" +}; + +static const char * const RtemsPartReqCreate_PreDesc_Length[] = { + "Valid", + "Zero", + "Invalid", + "NA" +}; + +static const char * const RtemsPartReqCreate_PreDesc_Size[] = { + "Valid", + "Zero", + "Small", + "NA" +}; + +static const char * const RtemsPartReqCreate_PreDesc_Parts[] = { + "Avail", + "None", + "NA" +}; + +static const char * const * const RtemsPartReqCreate_PreDesc[] = { + RtemsPartReqCreate_PreDesc_Id, + RtemsPartReqCreate_PreDesc_Name, + RtemsPartReqCreate_PreDesc_Start, + RtemsPartReqCreate_PreDesc_Length, + RtemsPartReqCreate_PreDesc_Size, + RtemsPartReqCreate_PreDesc_Parts, + NULL +}; + +#define PART_NAME rtems_build_name( 'N', 'A', 'M', 'E' ) + +#define MAX_PARTITIONS 4 + +#define BUFFER_COUNT 2 + +#define BUFFER_SIZE ( 2 * sizeof( void * ) ) + +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t + exhaust_buffers[ MAX_PARTITIONS ][ BUFFER_COUNT ][ BUFFER_SIZE ]; + +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t + buffers[ BUFFER_COUNT ][ BUFFER_SIZE ]; + +static void RtemsPartReqCreate_Pre_Id_Prepare( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Pre_Id state +) +{ + switch ( state ) { + case RtemsPartReqCreate_Pre_Id_Id: { + ctx->id = &ctx->id_value; + break; + } + + case RtemsPartReqCreate_Pre_Id_Null: { + ctx->id = NULL; + break; + } + + case RtemsPartReqCreate_Pre_Id_NA: + break; + } +} + +static void RtemsPartReqCreate_Pre_Name_Prepare( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Pre_Name state +) +{ + switch ( state ) { + case RtemsPartReqCreate_Pre_Name_Valid: { + ctx->name = PART_NAME; + break; + } + + case RtemsPartReqCreate_Pre_Name_Invalid: { + ctx->name = 0; + break; + } + + case RtemsPartReqCreate_Pre_Name_NA: + break; + } +} + +static void RtemsPartReqCreate_Pre_Start_Prepare( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Pre_Start state +) +{ + switch ( state ) { + case RtemsPartReqCreate_Pre_Start_Valid: { + ctx->starting_address = buffers; + break; + } + + case RtemsPartReqCreate_Pre_Start_Null: { + ctx->starting_address = NULL; + break; + } + + case RtemsPartReqCreate_Pre_Start_BadAlign: { + ctx->starting_address = &buffers[ 0 ][ 1 ]; + break; + } + + case RtemsPartReqCreate_Pre_Start_NA: + break; + } +} + +static void RtemsPartReqCreate_Pre_Length_Prepare( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Pre_Length state +) +{ + switch ( state ) { + case RtemsPartReqCreate_Pre_Length_Valid: { + ctx->length = sizeof( buffers ); + break; + } + + case RtemsPartReqCreate_Pre_Length_Zero: { + ctx->length = 0; + break; + } + + case RtemsPartReqCreate_Pre_Length_Invalid: { + ctx->length = sizeof( buffers[ 0 ] ) - 1; + break; + } + + case RtemsPartReqCreate_Pre_Length_NA: + break; + } +} + +static void RtemsPartReqCreate_Pre_Size_Prepare( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Pre_Size state +) +{ + switch ( state ) { + case RtemsPartReqCreate_Pre_Size_Valid: { + ctx->buffer_size = sizeof( buffers[ 0 ] ); + break; + } + + case RtemsPartReqCreate_Pre_Size_Zero: { + ctx->buffer_size = 0; + break; + } + + case RtemsPartReqCreate_Pre_Size_Small: { + ctx->buffer_size = sizeof( buffers[ 0 ] ) - 1; + break; + } + + case RtemsPartReqCreate_Pre_Size_NA: + break; + } +} + +static void RtemsPartReqCreate_Pre_Parts_Prepare( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Pre_Parts state +) +{ + size_t i; + + switch ( state ) { + case RtemsPartReqCreate_Pre_Parts_Avail: { + /* Nothing to do */ + break; + } + + case RtemsPartReqCreate_Pre_Parts_None: { + i = 0; + + while ( i < MAX_PARTITIONS ) { + rtems_status_code sc; + rtems_id id; + + sc = rtems_partition_create( + rtems_build_name( 'P', 'A', 'R', 'T' ), + exhaust_buffers[ i ], + sizeof( exhaust_buffers[ i ] ), + sizeof( exhaust_buffers[ i ][ 0 ] ), + RTEMS_DEFAULT_ATTRIBUTES, + &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->partitions, &obj->Node ); + } else { + T_quiet_rsc( sc, RTEMS_TOO_MANY ); + break; + } + + ++i; + } + break; + } + + case RtemsPartReqCreate_Pre_Parts_NA: + break; + } +} + +static void RtemsPartReqCreate_Post_Status_Check( + RtemsPartReqCreate_Context *ctx, + RtemsPartReqCreate_Post_Status state +) +{ + rtems_status_code sc; + rtems_id id; + size_t i; + void *buffers[ BUFFER_COUNT ]; + void *no_buffer; + + switch ( state ) { + case RtemsPartReqCreate_Post_Status_Ok: { + T_rsc_success( ctx->status ); + T_eq_ptr( ctx->id, &ctx->id_value ); + T_ne_u32( ctx->id_value, 0xffffffff ); + + id = 0xffffffff; + sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id ); + T_rsc_success( sc ); + T_eq_u32( id, ctx->id_value ); + + for ( i = 0; i < BUFFER_COUNT; ++i) { + sc = rtems_partition_get_buffer( ctx->id_value, &buffers[ i ] ); + T_rsc_success( sc ); + T_not_null( buffers[ i ] ); + } + + no_buffer = (void *) (uintptr_t) 1; + sc = rtems_partition_get_buffer( ctx->id_value, &no_buffer ); + T_rsc( sc, RTEMS_UNSATISFIED ); + T_eq_ptr( no_buffer, (void *) (uintptr_t) 1 ); + + for ( i = 0; i < BUFFER_COUNT; ++i) { + sc = rtems_partition_return_buffer( ctx->id_value, buffers[ i ] ); + T_rsc_success( sc ); + } + + sc = rtems_partition_delete( ctx->id_value ); + T_rsc_success( sc ); + break; + } + + case RtemsPartReqCreate_Post_Status_InvAddress: { + T_rsc( ctx->status, RTEMS_INVALID_ADDRESS ); + T_eq_u32( ctx->id_value, 0xffffffff ); + break; + } + + case RtemsPartReqCreate_Post_Status_InvName: { + T_rsc( ctx->status, RTEMS_INVALID_NAME ); + T_eq_u32( ctx->id_value, 0xffffffff ); + break; + } + + case RtemsPartReqCreate_Post_Status_InvNumber: { + T_rsc( ctx->status, RTEMS_INVALID_NUMBER ); + T_eq_u32( ctx->id_value, 0xffffffff ); + break; + } + + case RtemsPartReqCreate_Post_Status_InvSize: { + T_rsc( ctx->status, RTEMS_INVALID_SIZE ); + T_eq_u32( ctx->id_value, 0xffffffff ); + break; + } + + case RtemsPartReqCreate_Post_Status_TooMany: { + T_rsc( ctx->status, RTEMS_TOO_MANY ); + T_eq_u32( ctx->id_value, 0xffffffff ); + break; + } + + case RtemsPartReqCreate_Post_Status_NA: + break; + } +} + +static void RtemsPartReqCreate_Setup( RtemsPartReqCreate_Context *ctx ) +{ + _Chain_Initialize_empty( &ctx->partitions ); +} + +static void RtemsPartReqCreate_Setup_Wrap( void *arg ) +{ + RtemsPartReqCreate_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsPartReqCreate_Setup( ctx ); +} + +static size_t RtemsPartReqCreate_Scope( void *arg, char *buf, size_t n ) +{ + RtemsPartReqCreate_Context *ctx; + + ctx = arg; + + if ( ctx->in_action_loop ) { + return T_get_scope( RtemsPartReqCreate_PreDesc, buf, n, ctx->pcs ); + } + + return 0; +} + +static T_fixture RtemsPartReqCreate_Fixture = { + .setup = RtemsPartReqCreate_Setup_Wrap, + .stop = NULL, + .teardown = NULL, + .scope = RtemsPartReqCreate_Scope, + .initial_context = &RtemsPartReqCreate_Instance +}; + +static const uint8_t RtemsPartReqCreate_TransitionMap[][ 1 ] = { + { + RtemsPartReqCreate_Post_Status_Ok + }, { + RtemsPartReqCreate_Post_Status_TooMany + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvSize + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvAddress + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + }, { + RtemsPartReqCreate_Post_Status_InvName + } +}; + +static const struct { + uint8_t Skip : 1; + uint8_t Pre_Id_NA : 1; + uint8_t Pre_Name_NA : 1; + uint8_t Pre_Start_NA : 1; + uint8_t Pre_Length_NA : 1; + uint8_t Pre_Size_NA : 1; + uint8_t Pre_Parts_NA : 1; +} RtemsPartReqCreate_TransitionInfo[] = { + { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + }, { + 0, 0, 0, 0, 0, 0, 0 + } +}; + +static void RtemsPartReqCreate_Prepare( RtemsPartReqCreate_Context *ctx ) +{ + rtems_status_code sc; + rtems_id id; + + ctx->id_value = 0xffffffff; + ctx->attribute_set = RTEMS_DEFAULT_ATTRIBUTES; + + id = 0xffffffff; + sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id ); + T_rsc( sc, RTEMS_INVALID_NAME ); + T_eq_u32( id, 0xffffffff ); +} + +static void RtemsPartReqCreate_Action( RtemsPartReqCreate_Context *ctx ) +{ + ctx->status = rtems_partition_create( + ctx->name, + ctx->starting_address, + ctx->length, + ctx->buffer_size, + ctx->attribute_set, + ctx->id + ); +} + +static void RtemsPartReqCreate_Cleanup( RtemsPartReqCreate_Context *ctx ) +{ + Chain_Node *node; + + while ( ( node = _Chain_Get_unprotected( &ctx->partitions ) ) ) { + Objects_Control *obj; + rtems_status_code sc; + + obj = (Objects_Control *) node; + sc = rtems_partition_delete( obj->id ); + T_quiet_rsc_success( sc ); + } +} + +/** + * @fn void T_case_body_RtemsPartReqCreate( void ) + */ +T_TEST_CASE_FIXTURE( RtemsPartReqCreate, &RtemsPartReqCreate_Fixture ) +{ + RtemsPartReqCreate_Context *ctx; + size_t index; + + ctx = T_fixture_context(); + ctx->in_action_loop = true; + index = 0; + + for ( + ctx->pcs[ 0 ] = RtemsPartReqCreate_Pre_Id_Id; + ctx->pcs[ 0 ] < RtemsPartReqCreate_Pre_Id_NA; + ++ctx->pcs[ 0 ] + ) { + if ( RtemsPartReqCreate_TransitionInfo[ index ].Pre_Id_NA ) { + ctx->pcs[ 0 ] = RtemsPartReqCreate_Pre_Id_NA; + index += ( RtemsPartReqCreate_Pre_Id_NA - 1 ) + * RtemsPartReqCreate_Pre_Name_NA + * RtemsPartReqCreate_Pre_Start_NA + * RtemsPartReqCreate_Pre_Length_NA + * RtemsPartReqCreate_Pre_Size_NA + * RtemsPartReqCreate_Pre_Parts_NA; + } + + for ( + ctx->pcs[ 1 ] = RtemsPartReqCreate_Pre_Name_Valid; + ctx->pcs[ 1 ] < RtemsPartReqCreate_Pre_Name_NA; + ++ctx->pcs[ 1 ] + ) { + if ( RtemsPartReqCreate_TransitionInfo[ index ].Pre_Name_NA ) { + ctx->pcs[ 1 ] = RtemsPartReqCreate_Pre_Name_NA; + index += ( RtemsPartReqCreate_Pre_Name_NA - 1 ) + * RtemsPartReqCreate_Pre_Start_NA + * RtemsPartReqCreate_Pre_Length_NA + * RtemsPartReqCreate_Pre_Size_NA + * RtemsPartReqCreate_Pre_Parts_NA; + } + + for ( + ctx->pcs[ 2 ] = RtemsPartReqCreate_Pre_Start_Valid; + ctx->pcs[ 2 ] < RtemsPartReqCreate_Pre_Start_NA; + ++ctx->pcs[ 2 ] + ) { + if ( RtemsPartReqCreate_TransitionInfo[ index ].Pre_Start_NA ) { + ctx->pcs[ 2 ] = RtemsPartReqCreate_Pre_Start_NA; + index += ( RtemsPartReqCreate_Pre_Start_NA - 1 ) + * RtemsPartReqCreate_Pre_Length_NA + * RtemsPartReqCreate_Pre_Size_NA + * RtemsPartReqCreate_Pre_Parts_NA; + } + + for ( + ctx->pcs[ 3 ] = RtemsPartReqCreate_Pre_Length_Valid; + ctx->pcs[ 3 ] < RtemsPartReqCreate_Pre_Length_NA; + ++ctx->pcs[ 3 ] + ) { + if ( RtemsPartReqCreate_TransitionInfo[ index ].Pre_Length_NA ) { + ctx->pcs[ 3 ] = RtemsPartReqCreate_Pre_Length_NA; + index += ( RtemsPartReqCreate_Pre_Length_NA - 1 ) + * RtemsPartReqCreate_Pre_Size_NA + * RtemsPartReqCreate_Pre_Parts_NA; + } + + for ( + ctx->pcs[ 4 ] = RtemsPartReqCreate_Pre_Size_Valid; + ctx->pcs[ 4 ] < RtemsPartReqCreate_Pre_Size_NA; + ++ctx->pcs[ 4 ] + ) { + if ( RtemsPartReqCreate_TransitionInfo[ index ].Pre_Size_NA ) { + ctx->pcs[ 4 ] = RtemsPartReqCreate_Pre_Size_NA; + index += ( RtemsPartReqCreate_Pre_Size_NA - 1 ) + * RtemsPartReqCreate_Pre_Parts_NA; + } + + for ( + ctx->pcs[ 5 ] = RtemsPartReqCreate_Pre_Parts_Avail; + ctx->pcs[ 5 ] < RtemsPartReqCreate_Pre_Parts_NA; + ++ctx->pcs[ 5 ] + ) { + if ( RtemsPartReqCreate_TransitionInfo[ index ].Pre_Parts_NA ) { + ctx->pcs[ 5 ] = RtemsPartReqCreate_Pre_Parts_NA; + index += ( RtemsPartReqCreate_Pre_Parts_NA - 1 ); + } + + if ( RtemsPartReqCreate_TransitionInfo[ index ].Skip ) { + ++index; + continue; + } + + RtemsPartReqCreate_Prepare( ctx ); + RtemsPartReqCreate_Pre_Id_Prepare( ctx, ctx->pcs[ 0 ] ); + RtemsPartReqCreate_Pre_Name_Prepare( ctx, ctx->pcs[ 1 ] ); + RtemsPartReqCreate_Pre_Start_Prepare( ctx, ctx->pcs[ 2 ] ); + RtemsPartReqCreate_Pre_Length_Prepare( ctx, ctx->pcs[ 3 ] ); + RtemsPartReqCreate_Pre_Size_Prepare( ctx, ctx->pcs[ 4 ] ); + RtemsPartReqCreate_Pre_Parts_Prepare( ctx, ctx->pcs[ 5 ] ); + RtemsPartReqCreate_Action( ctx ); + RtemsPartReqCreate_Post_Status_Check( + ctx, + RtemsPartReqCreate_TransitionMap[ index ][ 0 ] + ); + RtemsPartReqCreate_Cleanup( ctx ); + ++index; + } + } + } + } + } + } +} + +/** @} */ diff --git a/testsuites/validation/tc-part-delete.c b/testsuites/validation/tc-part-delete.c new file mode 100644 index 0000000000..7d1a89f50f --- /dev/null +++ b/testsuites/validation/tc-part-delete.c @@ -0,0 +1,364 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseRtemsPartReqDelete + */ + +/* + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://docs.rtems.org/branches/master/user/support/bugs.html + * + * For information on updating and regenerating please refer to: + * + * https://docs.rtems.org/branches/master/eng/req/howto.html + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +/** + * @defgroup RTEMSTestCaseRtemsPartReqDelete spec:/rtems/part/req/delete + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @{ + */ + +typedef enum { + RtemsPartReqDelete_Pre_Id_Id, + RtemsPartReqDelete_Pre_Id_Invalid, + RtemsPartReqDelete_Pre_Id_NA +} RtemsPartReqDelete_Pre_Id; + +typedef enum { + RtemsPartReqDelete_Pre_InUse_Yes, + RtemsPartReqDelete_Pre_InUse_No, + RtemsPartReqDelete_Pre_InUse_NA +} RtemsPartReqDelete_Pre_InUse; + +typedef enum { + RtemsPartReqDelete_Post_Status_Ok, + RtemsPartReqDelete_Post_Status_InvId, + RtemsPartReqDelete_Post_Status_InUse, + RtemsPartReqDelete_Post_Status_NA +} RtemsPartReqDelete_Post_Status; + +/** + * @brief Test context for spec:/rtems/part/req/delete test case. + */ +typedef struct { + rtems_status_code status; + + rtems_id id; + + rtems_id id_value; + + void *buffer; + + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 2 ]; + + /** + * @brief This member indicates if the test action loop is currently + * executed. + */ + bool in_action_loop; +} RtemsPartReqDelete_Context; + +static RtemsPartReqDelete_Context + RtemsPartReqDelete_Instance; + +static const char * const RtemsPartReqDelete_PreDesc_Id[] = { + "Id", + "Invalid", + "NA" +}; + +static const char * const RtemsPartReqDelete_PreDesc_InUse[] = { + "Yes", + "No", + "NA" +}; + +static const char * const * const RtemsPartReqDelete_PreDesc[] = { + RtemsPartReqDelete_PreDesc_Id, + RtemsPartReqDelete_PreDesc_InUse, + NULL +}; + +#define PART_NAME rtems_build_name( 'N', 'A', 'M', 'E' ) + +#define BUFFER_COUNT 1 + +#define BUFFER_SIZE ( 2 * sizeof( void * ) ) + +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t + buffers[ BUFFER_COUNT ][ BUFFER_SIZE ]; + +static void RtemsPartReqDelete_Pre_Id_Prepare( + RtemsPartReqDelete_Context *ctx, + RtemsPartReqDelete_Pre_Id state +) +{ + switch ( state ) { + case RtemsPartReqDelete_Pre_Id_Id: { + ctx->id = ctx->id_value; + break; + } + + case RtemsPartReqDelete_Pre_Id_Invalid: { + ctx->id = 0; + break; + } + + case RtemsPartReqDelete_Pre_Id_NA: + break; + } +} + +static void RtemsPartReqDelete_Pre_InUse_Prepare( + RtemsPartReqDelete_Context *ctx, + RtemsPartReqDelete_Pre_InUse state +) +{ + rtems_status_code sc; + + switch ( state ) { + case RtemsPartReqDelete_Pre_InUse_Yes: { + ctx->buffer = NULL; + sc = rtems_partition_get_buffer( ctx->id_value, &ctx->buffer ); + T_rsc_success( sc ); + T_not_null( ctx->buffer ); + break; + } + + case RtemsPartReqDelete_Pre_InUse_No: { + ctx->buffer = NULL; + break; + } + + case RtemsPartReqDelete_Pre_InUse_NA: + break; + } +} + +static void RtemsPartReqDelete_Post_Status_Check( + RtemsPartReqDelete_Context *ctx, + RtemsPartReqDelete_Post_Status state +) +{ + rtems_status_code sc; + rtems_id id; + + switch ( state ) { + case RtemsPartReqDelete_Post_Status_Ok: { + T_rsc_success( ctx->status ); + ctx->id_value = 0xffffffff; + + id = 0xffffffff; + sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id ); + T_rsc( sc, RTEMS_INVALID_NAME ); + T_eq_u32( id, 0xffffffff ); + break; + } + + case RtemsPartReqDelete_Post_Status_InvId: { + T_rsc( ctx->status, RTEMS_INVALID_ID ); + + id = 0xffffffff; + sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id ); + T_rsc_success( sc); + T_eq_u32( id, ctx->id_value ); + break; + } + + case RtemsPartReqDelete_Post_Status_InUse: { + T_rsc( ctx->status, RTEMS_RESOURCE_IN_USE ); + + id = 0xffffffff; + sc = rtems_partition_ident( PART_NAME, RTEMS_SEARCH_LOCAL_NODE, &id ); + T_rsc_success( sc); + T_eq_u32( id, ctx->id_value ); + break; + } + + case RtemsPartReqDelete_Post_Status_NA: + break; + } +} + +static size_t RtemsPartReqDelete_Scope( void *arg, char *buf, size_t n ) +{ + RtemsPartReqDelete_Context *ctx; + + ctx = arg; + + if ( ctx->in_action_loop ) { + return T_get_scope( RtemsPartReqDelete_PreDesc, buf, n, ctx->pcs ); + } + + return 0; +} + +static T_fixture RtemsPartReqDelete_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = RtemsPartReqDelete_Scope, + .initial_context = &RtemsPartReqDelete_Instance +}; + +static const uint8_t RtemsPartReqDelete_TransitionMap[][ 1 ] = { + { + RtemsPartReqDelete_Post_Status_InUse + }, { + RtemsPartReqDelete_Post_Status_Ok + }, { + RtemsPartReqDelete_Post_Status_InvId + }, { + RtemsPartReqDelete_Post_Status_InvId + } +}; + +static const struct { + uint8_t Skip : 1; + uint8_t Pre_Id_NA : 1; + uint8_t Pre_InUse_NA : 1; +} RtemsPartReqDelete_TransitionInfo[] = { + { + 0, 0, 0 + }, { + 0, 0, 0 + }, { + 0, 0, 0 + }, { + 0, 0, 0 + } +}; + +static void RtemsPartReqDelete_Prepare( RtemsPartReqDelete_Context *ctx ) +{ + rtems_status_code sc; + + sc = rtems_partition_create( + PART_NAME, + buffers, + sizeof( buffers ), + sizeof( buffers[ 0 ] ), + RTEMS_DEFAULT_ATTRIBUTES, + &ctx->id_value + ); + T_rsc_success( sc ); +} + +static void RtemsPartReqDelete_Action( RtemsPartReqDelete_Context *ctx ) +{ + ctx->status = rtems_partition_delete( ctx->id ); +} + +static void RtemsPartReqDelete_Cleanup( RtemsPartReqDelete_Context *ctx ) +{ + rtems_status_code sc; + + if ( ctx->buffer != NULL ) { + sc = rtems_partition_return_buffer( ctx->id_value, ctx->buffer ); + T_rsc_success( sc ); + } + + if ( ctx->id_value != 0xffffffff ) { + sc = rtems_partition_delete( ctx->id_value ); + T_rsc_success( sc ); + } +} + +/** + * @fn void T_case_body_RtemsPartReqDelete( void ) + */ +T_TEST_CASE_FIXTURE( RtemsPartReqDelete, &RtemsPartReqDelete_Fixture ) +{ + RtemsPartReqDelete_Context *ctx; + size_t index; + + ctx = T_fixture_context(); + ctx->in_action_loop = true; + index = 0; + + for ( + ctx->pcs[ 0 ] = RtemsPartReqDelete_Pre_Id_Id; + ctx->pcs[ 0 ] < RtemsPartReqDelete_Pre_Id_NA; + ++ctx->pcs[ 0 ] + ) { + if ( RtemsPartReqDelete_TransitionInfo[ index ].Pre_Id_NA ) { + ctx->pcs[ 0 ] = RtemsPartReqDelete_Pre_Id_NA; + index += ( RtemsPartReqDelete_Pre_Id_NA - 1 ) + * RtemsPartReqDelete_Pre_InUse_NA; + } + + for ( + ctx->pcs[ 1 ] = RtemsPartReqDelete_Pre_InUse_Yes; + ctx->pcs[ 1 ] < RtemsPartReqDelete_Pre_InUse_NA; + ++ctx->pcs[ 1 ] + ) { + if ( RtemsPartReqDelete_TransitionInfo[ index ].Pre_InUse_NA ) { + ctx->pcs[ 1 ] = RtemsPartReqDelete_Pre_InUse_NA; + index += ( RtemsPartReqDelete_Pre_InUse_NA - 1 ); + } + + if ( RtemsPartReqDelete_TransitionInfo[ index ].Skip ) { + ++index; + continue; + } + + RtemsPartReqDelete_Prepare( ctx ); + RtemsPartReqDelete_Pre_Id_Prepare( ctx, ctx->pcs[ 0 ] ); + RtemsPartReqDelete_Pre_InUse_Prepare( ctx, ctx->pcs[ 1 ] ); + RtemsPartReqDelete_Action( ctx ); + RtemsPartReqDelete_Post_Status_Check( + ctx, + RtemsPartReqDelete_TransitionMap[ index ][ 0 ] + ); + RtemsPartReqDelete_Cleanup( ctx ); + ++index; + } + } +} + +/** @} */ diff --git a/testsuites/validation/tc-part-get.c b/testsuites/validation/tc-part-get.c new file mode 100644 index 0000000000..9de2f70f4e --- /dev/null +++ b/testsuites/validation/tc-part-get.c @@ -0,0 +1,456 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseRtemsPartReqGetBuffer + */ + +/* + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://docs.rtems.org/branches/master/user/support/bugs.html + * + * For information on updating and regenerating please refer to: + * + * https://docs.rtems.org/branches/master/eng/req/howto.html + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +/** + * @defgroup RTEMSTestCaseRtemsPartReqGetBuffer spec:/rtems/part/req/get-buffer + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @{ + */ + +typedef enum { + RtemsPartReqGetBuffer_Pre_Id_Id, + RtemsPartReqGetBuffer_Pre_Id_Invalid, + RtemsPartReqGetBuffer_Pre_Id_NA +} RtemsPartReqGetBuffer_Pre_Id; + +typedef enum { + RtemsPartReqGetBuffer_Pre_Buf_Valid, + RtemsPartReqGetBuffer_Pre_Buf_Null, + RtemsPartReqGetBuffer_Pre_Buf_NA +} RtemsPartReqGetBuffer_Pre_Buf; + +typedef enum { + RtemsPartReqGetBuffer_Pre_Avail_Yes, + RtemsPartReqGetBuffer_Pre_Avail_No, + RtemsPartReqGetBuffer_Pre_Avail_NA +} RtemsPartReqGetBuffer_Pre_Avail; + +typedef enum { + RtemsPartReqGetBuffer_Post_Status_Ok, + RtemsPartReqGetBuffer_Post_Status_InvId, + RtemsPartReqGetBuffer_Post_Status_InvAddr, + RtemsPartReqGetBuffer_Post_Status_Unsatisfied, + RtemsPartReqGetBuffer_Post_Status_NA +} RtemsPartReqGetBuffer_Post_Status; + +/** + * @brief Test context for spec:/rtems/part/req/get-buffer test case. + */ +typedef struct { + rtems_status_code status; + + rtems_id id; + + rtems_id id_value; + + void **buffer; + + void *buffer_pointer; + + void *stolen_buffer; + + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 3 ]; + + /** + * @brief This member indicates if the test action loop is currently + * executed. + */ + bool in_action_loop; +} RtemsPartReqGetBuffer_Context; + +static RtemsPartReqGetBuffer_Context + RtemsPartReqGetBuffer_Instance; + +static const char * const RtemsPartReqGetBuffer_PreDesc_Id[] = { + "Id", + "Invalid", + "NA" +}; + +static const char * const RtemsPartReqGetBuffer_PreDesc_Buf[] = { + "Valid", + "Null", + "NA" +}; + +static const char * const RtemsPartReqGetBuffer_PreDesc_Avail[] = { + "Yes", + "No", + "NA" +}; + +static const char * const * const RtemsPartReqGetBuffer_PreDesc[] = { + RtemsPartReqGetBuffer_PreDesc_Id, + RtemsPartReqGetBuffer_PreDesc_Buf, + RtemsPartReqGetBuffer_PreDesc_Avail, + NULL +}; + +#define BUFFER_COUNT 1 + +#define BUFFER_SIZE ( 2 * sizeof( void * ) ) + +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t + buffers[ BUFFER_COUNT ][ BUFFER_SIZE ]; + +static void RtemsPartReqGetBuffer_Pre_Id_Prepare( + RtemsPartReqGetBuffer_Context *ctx, + RtemsPartReqGetBuffer_Pre_Id state +) +{ + switch ( state ) { + case RtemsPartReqGetBuffer_Pre_Id_Id: { + ctx->id = ctx->id_value; + break; + } + + case RtemsPartReqGetBuffer_Pre_Id_Invalid: { + ctx->id = 0; + break; + } + + case RtemsPartReqGetBuffer_Pre_Id_NA: + break; + } +} + +static void RtemsPartReqGetBuffer_Pre_Buf_Prepare( + RtemsPartReqGetBuffer_Context *ctx, + RtemsPartReqGetBuffer_Pre_Buf state +) +{ + switch ( state ) { + case RtemsPartReqGetBuffer_Pre_Buf_Valid: { + ctx->buffer = &ctx->buffer_pointer; + break; + } + + case RtemsPartReqGetBuffer_Pre_Buf_Null: { + ctx->buffer = NULL; + break; + } + + case RtemsPartReqGetBuffer_Pre_Buf_NA: + break; + } +} + +static void RtemsPartReqGetBuffer_Pre_Avail_Prepare( + RtemsPartReqGetBuffer_Context *ctx, + RtemsPartReqGetBuffer_Pre_Avail state +) +{ + rtems_status_code sc; + + switch ( state ) { + case RtemsPartReqGetBuffer_Pre_Avail_Yes: { + /* Nothing to do */ + break; + } + + case RtemsPartReqGetBuffer_Pre_Avail_No: { + sc = rtems_partition_get_buffer( ctx->id_value, &ctx->stolen_buffer ); + T_rsc_success( sc ); + break; + } + + case RtemsPartReqGetBuffer_Pre_Avail_NA: + break; + } +} + +static void RtemsPartReqGetBuffer_Post_Status_Check( + RtemsPartReqGetBuffer_Context *ctx, + RtemsPartReqGetBuffer_Post_Status state +) +{ + switch ( state ) { + case RtemsPartReqGetBuffer_Post_Status_Ok: { + T_rsc_success( ctx->status ); + T_eq_ptr( ctx->buffer_pointer, buffers ); + break; + } + + case RtemsPartReqGetBuffer_Post_Status_InvId: { + T_rsc( ctx->status, RTEMS_INVALID_ID ); + T_eq_ptr( ctx->buffer_pointer, (void *) (uintptr_t) 1 ); + break; + } + + case RtemsPartReqGetBuffer_Post_Status_InvAddr: { + T_rsc( ctx->status, RTEMS_INVALID_ADDRESS ); + break; + } + + case RtemsPartReqGetBuffer_Post_Status_Unsatisfied: { + T_rsc( ctx->status, RTEMS_UNSATISFIED ); + T_eq_ptr( ctx->buffer_pointer, (void *) (uintptr_t) 1 ); + break; + } + + case RtemsPartReqGetBuffer_Post_Status_NA: + break; + } +} + +static void RtemsPartReqGetBuffer_Setup( RtemsPartReqGetBuffer_Context *ctx ) +{ + rtems_status_code sc; + + ctx->id_value = 0; + sc = rtems_partition_create( + rtems_build_name( 'N', 'A', 'M', 'E' ), + buffers, + sizeof( buffers ), + sizeof( buffers[ 0 ] ), + RTEMS_DEFAULT_ATTRIBUTES, + &ctx->id_value + ); + T_assert_rsc_success( sc ); +} + +static void RtemsPartReqGetBuffer_Setup_Wrap( void *arg ) +{ + RtemsPartReqGetBuffer_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsPartReqGetBuffer_Setup( ctx ); +} + +static void RtemsPartReqGetBuffer_Teardown( + RtemsPartReqGetBuffer_Context *ctx +) +{ + if ( ctx->id_value != 0 ) { + rtems_status_code sc; + + sc = rtems_partition_delete( ctx->id_value ); + T_rsc_success( sc ); + } +} + +static void RtemsPartReqGetBuffer_Teardown_Wrap( void *arg ) +{ + RtemsPartReqGetBuffer_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsPartReqGetBuffer_Teardown( ctx ); +} + +static size_t RtemsPartReqGetBuffer_Scope( void *arg, char *buf, size_t n ) +{ + RtemsPartReqGetBuffer_Context *ctx; + + ctx = arg; + + if ( ctx->in_action_loop ) { + return T_get_scope( RtemsPartReqGetBuffer_PreDesc, buf, n, ctx->pcs ); + } + + return 0; +} + +static T_fixture RtemsPartReqGetBuffer_Fixture = { + .setup = RtemsPartReqGetBuffer_Setup_Wrap, + .stop = NULL, + .teardown = RtemsPartReqGetBuffer_Teardown_Wrap, + .scope = RtemsPartReqGetBuffer_Scope, + .initial_context = &RtemsPartReqGetBuffer_Instance +}; + +static const uint8_t RtemsPartReqGetBuffer_TransitionMap[][ 1 ] = { + { + RtemsPartReqGetBuffer_Post_Status_Ok + }, { + RtemsPartReqGetBuffer_Post_Status_Unsatisfied + }, { + RtemsPartReqGetBuffer_Post_Status_InvAddr + }, { + RtemsPartReqGetBuffer_Post_Status_InvAddr + }, { + RtemsPartReqGetBuffer_Post_Status_InvId + }, { + RtemsPartReqGetBuffer_Post_Status_InvId + }, { + RtemsPartReqGetBuffer_Post_Status_InvAddr + }, { + RtemsPartReqGetBuffer_Post_Status_InvAddr + } +}; + +static const struct { + uint8_t Skip : 1; + uint8_t Pre_Id_NA : 1; + uint8_t Pre_Buf_NA : 1; + uint8_t Pre_Avail_NA : 1; +} RtemsPartReqGetBuffer_TransitionInfo[] = { + { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + }, { + 0, 0, 0, 0 + } +}; + +static void RtemsPartReqGetBuffer_Prepare( RtemsPartReqGetBuffer_Context *ctx ) +{ + ctx->buffer_pointer = (void *) (uintptr_t) 1; + ctx->stolen_buffer = NULL; +} + +static void RtemsPartReqGetBuffer_Action( RtemsPartReqGetBuffer_Context *ctx ) +{ + ctx->status = rtems_partition_get_buffer( ctx->id, ctx->buffer ); +} + +static void RtemsPartReqGetBuffer_Cleanup( RtemsPartReqGetBuffer_Context *ctx ) +{ + rtems_status_code sc; + + if ( (uintptr_t) ctx->buffer_pointer != 1 ) { + sc = rtems_partition_return_buffer( ctx->id_value, ctx->buffer_pointer ); + T_rsc_success( sc ); + } + + if ( ctx->stolen_buffer != NULL ) { + sc = rtems_partition_return_buffer( ctx->id_value, ctx->stolen_buffer ); + T_rsc_success( sc ); + } +} + +/** + * @fn void T_case_body_RtemsPartReqGetBuffer( void ) + */ +T_TEST_CASE_FIXTURE( RtemsPartReqGetBuffer, &RtemsPartReqGetBuffer_Fixture ) +{ + RtemsPartReqGetBuffer_Context *ctx; + size_t index; + + ctx = T_fixture_context(); + ctx->in_action_loop = true; + index = 0; + + for ( + ctx->pcs[ 0 ] = RtemsPartReqGetBuffer_Pre_Id_Id; + ctx->pcs[ 0 ] < RtemsPartReqGetBuffer_Pre_Id_NA; + ++ctx->pcs[ 0 ] + ) { + if ( RtemsPartReqGetBuffer_TransitionInfo[ index ].Pre_Id_NA ) { + ctx->pcs[ 0 ] = RtemsPartReqGetBuffer_Pre_Id_NA; + index += ( RtemsPartReqGetBuffer_Pre_Id_NA - 1 ) + * RtemsPartReqGetBuffer_Pre_Buf_NA + * RtemsPartReqGetBuffer_Pre_Avail_NA; + } + + for ( + ctx->pcs[ 1 ] = RtemsPartReqGetBuffer_Pre_Buf_Valid; + ctx->pcs[ 1 ] < RtemsPartReqGetBuffer_Pre_Buf_NA; + ++ctx->pcs[ 1 ] + ) { + if ( RtemsPartReqGetBuffer_TransitionInfo[ index ].Pre_Buf_NA ) { + ctx->pcs[ 1 ] = RtemsPartReqGetBuffer_Pre_Buf_NA; + index += ( RtemsPartReqGetBuffer_Pre_Buf_NA - 1 ) + * RtemsPartReqGetBuffer_Pre_Avail_NA; + } + + for ( + ctx->pcs[ 2 ] = RtemsPartReqGetBuffer_Pre_Avail_Yes; + ctx->pcs[ 2 ] < RtemsPartReqGetBuffer_Pre_Avail_NA; + ++ctx->pcs[ 2 ] + ) { + if ( RtemsPartReqGetBuffer_TransitionInfo[ index ].Pre_Avail_NA ) { + ctx->pcs[ 2 ] = RtemsPartReqGetBuffer_Pre_Avail_NA; + index += ( RtemsPartReqGetBuffer_Pre_Avail_NA - 1 ); + } + + if ( RtemsPartReqGetBuffer_TransitionInfo[ index ].Skip ) { + ++index; + continue; + } + + RtemsPartReqGetBuffer_Prepare( ctx ); + RtemsPartReqGetBuffer_Pre_Id_Prepare( ctx, ctx->pcs[ 0 ] ); + RtemsPartReqGetBuffer_Pre_Buf_Prepare( ctx, ctx->pcs[ 1 ] ); + RtemsPartReqGetBuffer_Pre_Avail_Prepare( ctx, ctx->pcs[ 2 ] ); + RtemsPartReqGetBuffer_Action( ctx ); + RtemsPartReqGetBuffer_Post_Status_Check( + ctx, + RtemsPartReqGetBuffer_TransitionMap[ index ][ 0 ] + ); + RtemsPartReqGetBuffer_Cleanup( ctx ); + ++index; + } + } + } +} + +/** @} */ diff --git a/testsuites/validation/tc-part-ident.c b/testsuites/validation/tc-part-ident.c index b6ed832072..e90a45d8da 100644 --- a/testsuites/validation/tc-part-ident.c +++ b/testsuites/validation/tc-part-ident.c @@ -32,12 +32,16 @@ */ /* - * This file was automatically generated. Do not edit it manually. - * Please have a look at + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: * - * https://docs.rtems.org/branches/master/eng/req/howto.html + * https://docs.rtems.org/branches/master/user/support/bugs.html + * + * For information on updating and regenerating please refer to: * - * for information how to maintain and re-generate this file. + * https://docs.rtems.org/branches/master/eng/req/howto.html */ #ifdef HAVE_CONFIG_H diff --git a/testsuites/validation/tc-part-return.c b/testsuites/validation/tc-part-return.c new file mode 100644 index 0000000000..d7e1b6f5fc --- /dev/null +++ b/testsuites/validation/tc-part-return.c @@ -0,0 +1,379 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseRtemsPartReqReturnBuffer + */ + +/* + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://docs.rtems.org/branches/master/user/support/bugs.html + * + * For information on updating and regenerating please refer to: + * + * https://docs.rtems.org/branches/master/eng/req/howto.html + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +/** + * @defgroup RTEMSTestCaseRtemsPartReqReturnBuffer \ + * spec:/rtems/part/req/return-buffer + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @{ + */ + +typedef enum { + RtemsPartReqReturnBuffer_Pre_Id_Id, + RtemsPartReqReturnBuffer_Pre_Id_Invalid, + RtemsPartReqReturnBuffer_Pre_Id_NA +} RtemsPartReqReturnBuffer_Pre_Id; + +typedef enum { + RtemsPartReqReturnBuffer_Pre_Buf_Valid, + RtemsPartReqReturnBuffer_Pre_Buf_Invalid, + RtemsPartReqReturnBuffer_Pre_Buf_NA +} RtemsPartReqReturnBuffer_Pre_Buf; + +typedef enum { + RtemsPartReqReturnBuffer_Post_Status_Ok, + RtemsPartReqReturnBuffer_Post_Status_InvId, + RtemsPartReqReturnBuffer_Post_Status_InvAddr, + RtemsPartReqReturnBuffer_Post_Status_NA +} RtemsPartReqReturnBuffer_Post_Status; + +/** + * @brief Test context for spec:/rtems/part/req/return-buffer test case. + */ +typedef struct { + rtems_status_code status; + + rtems_id id; + + rtems_id id_value; + + void *buffer; + + void *buffer_in_use; + + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 2 ]; + + /** + * @brief This member indicates if the test action loop is currently + * executed. + */ + bool in_action_loop; +} RtemsPartReqReturnBuffer_Context; + +static RtemsPartReqReturnBuffer_Context + RtemsPartReqReturnBuffer_Instance; + +static const char * const RtemsPartReqReturnBuffer_PreDesc_Id[] = { + "Id", + "Invalid", + "NA" +}; + +static const char * const RtemsPartReqReturnBuffer_PreDesc_Buf[] = { + "Valid", + "Invalid", + "NA" +}; + +static const char * const * const RtemsPartReqReturnBuffer_PreDesc[] = { + RtemsPartReqReturnBuffer_PreDesc_Id, + RtemsPartReqReturnBuffer_PreDesc_Buf, + NULL +}; + +#define BUFFER_COUNT 1 + +#define BUFFER_SIZE ( 2 * sizeof( void * ) ) + +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t + buffers[ BUFFER_COUNT ][ BUFFER_SIZE ]; + +static void RtemsPartReqReturnBuffer_Pre_Id_Prepare( + RtemsPartReqReturnBuffer_Context *ctx, + RtemsPartReqReturnBuffer_Pre_Id state +) +{ + switch ( state ) { + case RtemsPartReqReturnBuffer_Pre_Id_Id: { + ctx->id = ctx->id_value; + break; + } + + case RtemsPartReqReturnBuffer_Pre_Id_Invalid: { + ctx->id = 0; + break; + } + + case RtemsPartReqReturnBuffer_Pre_Id_NA: + break; + } +} + +static void RtemsPartReqReturnBuffer_Pre_Buf_Prepare( + RtemsPartReqReturnBuffer_Context *ctx, + RtemsPartReqReturnBuffer_Pre_Buf state +) +{ + switch ( state ) { + case RtemsPartReqReturnBuffer_Pre_Buf_Valid: { + ctx->buffer = ctx->buffer_in_use; + break; + } + + case RtemsPartReqReturnBuffer_Pre_Buf_Invalid: { + ctx->buffer = (void *) (uintptr_t) 1; + break; + } + + case RtemsPartReqReturnBuffer_Pre_Buf_NA: + break; + } +} + +static void RtemsPartReqReturnBuffer_Post_Status_Check( + RtemsPartReqReturnBuffer_Context *ctx, + RtemsPartReqReturnBuffer_Post_Status state +) +{ + rtems_status_code sc; + + switch ( state ) { + case RtemsPartReqReturnBuffer_Post_Status_Ok: { + T_rsc_success( ctx->status ); + + sc = rtems_partition_get_buffer( ctx->id_value, &ctx->buffer_in_use ); + T_rsc_success( sc ); + T_eq_ptr( ctx->buffer_in_use, buffers ); + break; + } + + case RtemsPartReqReturnBuffer_Post_Status_InvId: { + T_rsc( ctx->status, RTEMS_INVALID_ID ); + break; + } + + case RtemsPartReqReturnBuffer_Post_Status_InvAddr: { + T_rsc( ctx->status, RTEMS_INVALID_ADDRESS ); + break; + } + + case RtemsPartReqReturnBuffer_Post_Status_NA: + break; + } +} + +static void RtemsPartReqReturnBuffer_Setup( + RtemsPartReqReturnBuffer_Context *ctx +) +{ + rtems_status_code sc; + + ctx->buffer_in_use = 0; + ctx->id_value = 0; + + sc = rtems_partition_create( + rtems_build_name( 'N', 'A', 'M', 'E' ), + buffers, + sizeof( buffers ), + sizeof( buffers[ 0 ] ), + RTEMS_DEFAULT_ATTRIBUTES, + &ctx->id_value + ); + T_assert_rsc_success( sc ); + + sc = rtems_partition_get_buffer( ctx->id_value, &ctx->buffer_in_use ); + T_assert_rsc_success( sc ); + T_assert_eq_ptr( ctx->buffer_in_use, buffers ); +} + +static void RtemsPartReqReturnBuffer_Setup_Wrap( void *arg ) +{ + RtemsPartReqReturnBuffer_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsPartReqReturnBuffer_Setup( ctx ); +} + +static void RtemsPartReqReturnBuffer_Teardown( + RtemsPartReqReturnBuffer_Context *ctx +) +{ + rtems_status_code sc; + + if ( ctx->buffer_in_use != NULL ) { + sc = rtems_partition_return_buffer( ctx->id_value, ctx->buffer_in_use ); + T_rsc_success( sc ); + } + + if ( ctx->id_value != 0 ) { + sc = rtems_partition_delete( ctx->id_value ); + T_rsc_success( sc ); + } +} + +static void RtemsPartReqReturnBuffer_Teardown_Wrap( void *arg ) +{ + RtemsPartReqReturnBuffer_Context *ctx; + + ctx = arg; + ctx->in_action_loop = false; + RtemsPartReqReturnBuffer_Teardown( ctx ); +} + +static size_t RtemsPartReqReturnBuffer_Scope( void *arg, char *buf, size_t n ) +{ + RtemsPartReqReturnBuffer_Context *ctx; + + ctx = arg; + + if ( ctx->in_action_loop ) { + return T_get_scope( RtemsPartReqReturnBuffer_PreDesc, buf, n, ctx->pcs ); + } + + return 0; +} + +static T_fixture RtemsPartReqReturnBuffer_Fixture = { + .setup = RtemsPartReqReturnBuffer_Setup_Wrap, + .stop = NULL, + .teardown = RtemsPartReqReturnBuffer_Teardown_Wrap, + .scope = RtemsPartReqReturnBuffer_Scope, + .initial_context = &RtemsPartReqReturnBuffer_Instance +}; + +static const uint8_t RtemsPartReqReturnBuffer_TransitionMap[][ 1 ] = { + { + RtemsPartReqReturnBuffer_Post_Status_Ok + }, { + RtemsPartReqReturnBuffer_Post_Status_InvAddr + }, { + RtemsPartReqReturnBuffer_Post_Status_InvId + }, { + RtemsPartReqReturnBuffer_Post_Status_InvId + } +}; + +static const struct { + uint8_t Skip : 1; + uint8_t Pre_Id_NA : 1; + uint8_t Pre_Buf_NA : 1; +} RtemsPartReqReturnBuffer_TransitionInfo[] = { + { + 0, 0, 0 + }, { + 0, 0, 0 + }, { + 0, 0, 0 + }, { + 0, 0, 0 + } +}; + +static void RtemsPartReqReturnBuffer_Action( + RtemsPartReqReturnBuffer_Context *ctx +) +{ + ctx->status = rtems_partition_return_buffer( ctx->id, ctx->buffer ); +} + +/** + * @fn void T_case_body_RtemsPartReqReturnBuffer( void ) + */ +T_TEST_CASE_FIXTURE( + RtemsPartReqReturnBuffer, + &RtemsPartReqReturnBuffer_Fixture +) +{ + RtemsPartReqReturnBuffer_Context *ctx; + size_t index; + + ctx = T_fixture_context(); + ctx->in_action_loop = true; + index = 0; + + for ( + ctx->pcs[ 0 ] = RtemsPartReqReturnBuffer_Pre_Id_Id; + ctx->pcs[ 0 ] < RtemsPartReqReturnBuffer_Pre_Id_NA; + ++ctx->pcs[ 0 ] + ) { + if ( RtemsPartReqReturnBuffer_TransitionInfo[ index ].Pre_Id_NA ) { + ctx->pcs[ 0 ] = RtemsPartReqReturnBuffer_Pre_Id_NA; + index += ( RtemsPartReqReturnBuffer_Pre_Id_NA - 1 ) + * RtemsPartReqReturnBuffer_Pre_Buf_NA; + } + + for ( + ctx->pcs[ 1 ] = RtemsPartReqReturnBuffer_Pre_Buf_Valid; + ctx->pcs[ 1 ] < RtemsPartReqReturnBuffer_Pre_Buf_NA; + ++ctx->pcs[ 1 ] + ) { + if ( RtemsPartReqReturnBuffer_TransitionInfo[ index ].Pre_Buf_NA ) { + ctx->pcs[ 1 ] = RtemsPartReqReturnBuffer_Pre_Buf_NA; + index += ( RtemsPartReqReturnBuffer_Pre_Buf_NA - 1 ); + } + + if ( RtemsPartReqReturnBuffer_TransitionInfo[ index ].Skip ) { + ++index; + continue; + } + + RtemsPartReqReturnBuffer_Pre_Id_Prepare( ctx, ctx->pcs[ 0 ] ); + RtemsPartReqReturnBuffer_Pre_Buf_Prepare( ctx, ctx->pcs[ 1 ] ); + RtemsPartReqReturnBuffer_Action( ctx ); + RtemsPartReqReturnBuffer_Post_Status_Check( + ctx, + RtemsPartReqReturnBuffer_TransitionMap[ index ][ 0 ] + ); + ++index; + } + } +} + +/** @} */ diff --git a/testsuites/validation/tc-part.c b/testsuites/validation/tc-part.c new file mode 100644 index 0000000000..cb1e66a05a --- /dev/null +++ b/testsuites/validation/tc-part.c @@ -0,0 +1,156 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseRtemsPartValPart + */ + +/* + * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://docs.rtems.org/branches/master/user/support/bugs.html + * + * For information on updating and regenerating please refer to: + * + * https://docs.rtems.org/branches/master/eng/req/howto.html + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +/** + * @defgroup RTEMSTestCaseRtemsPartValPart spec:/rtems/part/val/part + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @brief Validates some functional requirements of the Partition Manager. + * + * This test case performs the following actions: + * + * - Create a partition with a buffer area length which is greater than three + * times the buffer size and less than four times the buffer size. + * + * - Check that exactly three buffers can be obtained from the partition for + * use in parallel. + * + * - Return the three buffers in use to the partition and check that they can + * be obtained from the partition for use in parallel in FIFO order. + * + * @{ + */ + +/** + * @fn void T_case_body_RtemsPartValPart( void ) + */ +T_TEST_CASE( RtemsPartValPart ) +{ + 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; + + T_plan(22); + + id = 0xffffffff; + sc = rtems_partition_create( + rtems_build_name( 'N', 'A', 'M', 'E' ), + buffers, + sizeof( buffers ) - 1, + sizeof( buffers[ 0 ] ), + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + T_step_rsc_success( 0, sc ); + pointers[ 0 ] = NULL; + sc = rtems_partition_get_buffer( id, &pointers[ 0 ] ); + T_step_rsc_success( 1, sc ); + T_step_not_null( 2, pointers[ 0 ] ); + + pointers[ 1 ] = NULL; + sc = rtems_partition_get_buffer( id, &pointers[ 1 ] ); + T_step_rsc_success( 3, sc ); + T_step_not_null( 4, pointers[ 1 ] ); + + pointers[ 2 ] = NULL; + sc = rtems_partition_get_buffer( id, &pointers[ 2 ] ); + T_step_rsc_success( 5, sc ); + T_step_not_null( 6, pointers[ 2 ] ); + + pointers[ 3 ] = NULL; + sc = rtems_partition_get_buffer( id, &pointers[ 3 ] ); + T_step_rsc( 7, sc, RTEMS_UNSATISFIED ); + T_step_null( 8, pointers[ 3 ] ); + sc = rtems_partition_return_buffer( id, pointers[ 1 ] ); + T_step_rsc_success( 9, sc ); + + sc = rtems_partition_return_buffer( id, pointers[ 2 ] ); + T_step_rsc_success( 10, sc ); + + sc = rtems_partition_return_buffer( id, pointers[ 0 ] ); + T_step_rsc_success( 11, sc ); + + pointer = NULL; + sc = rtems_partition_get_buffer( id, &pointer ); + T_step_rsc_success( 12, sc ); + T_step_eq_ptr( 13, pointer, pointers[ 1 ] ); + + pointer = NULL; + sc = rtems_partition_get_buffer( id, &pointer ); + T_step_rsc_success( 14, sc ); + T_step_eq_ptr( 15, pointer, pointers[ 2 ] ); + + pointer = NULL; + sc = rtems_partition_get_buffer( id, &pointer ); + T_step_rsc_success( 16, sc ); + T_step_eq_ptr( 17, pointer, pointers[ 0 ] ); + + sc = rtems_partition_return_buffer( id, pointers[ 0 ] ); + T_step_rsc_success( 18, sc ); + + sc = rtems_partition_return_buffer( id, pointers[ 1 ] ); + T_step_rsc_success( 19, sc ); + + sc = rtems_partition_return_buffer( id, pointers[ 2 ] ); + T_step_rsc_success( 20, sc ); + + sc = rtems_partition_delete( id ); + T_step_rsc_success( 21, sc ); +} + +/** @} */ -- cgit v1.2.3