summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-12-09 16:14:24 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-03-24 11:10:49 +0100
commit5c850245bf7e9f0ea5fd945832dddd83cdf052d7 (patch)
treefe0a50e132de98a2ac277839deca7f3d28485423
parentvalidation: Test options (diff)
downloadrtems-5c850245bf7e9f0ea5fd945832dddd83cdf052d7.tar.bz2
validation: Test Partition Manager
The test source code is generated from specification items by the "./spec2modules.py" script contained in the git://git.rtems.org/rtems-central.git Git repository. Please read the "How-To" section in the "Software Requirements Engineering" chapter of the RTEMS Software Engineering manual to get more information about the process. Update #3716.
-rw-r--r--spec/build/testsuites/validation/performance-no-clock-0.yml1
-rw-r--r--spec/build/testsuites/validation/validation-no-clock-0.yml6
-rw-r--r--testsuites/validation/tc-part-create.c791
-rw-r--r--testsuites/validation/tc-part-delete.c396
-rw-r--r--testsuites/validation/tc-part-get.c526
-rw-r--r--testsuites/validation/tc-part-ident.c120
-rw-r--r--testsuites/validation/tc-part-performance.c140
-rw-r--r--testsuites/validation/tc-part-return.c487
-rw-r--r--testsuites/validation/tc-part.c196
9 files changed, 2589 insertions, 74 deletions
diff --git a/spec/build/testsuites/validation/performance-no-clock-0.yml b/spec/build/testsuites/validation/performance-no-clock-0.yml
index 612a11d636..02ca873f20 100644
--- a/spec/build/testsuites/validation/performance-no-clock-0.yml
+++ b/spec/build/testsuites/validation/performance-no-clock-0.yml
@@ -14,6 +14,7 @@ source:
- testsuites/validation/tc-barrier-performance.c
- testsuites/validation/tc-event-performance.c
- testsuites/validation/tc-message-performance.c
+- testsuites/validation/tc-part-performance.c
- testsuites/validation/ts-performance-no-clock-0.c
stlib: []
target: testsuites/validation/ts-performance-no-clock-0.exe
diff --git a/spec/build/testsuites/validation/validation-no-clock-0.yml b/spec/build/testsuites/validation/validation-no-clock-0.yml
index 93d34b5c99..8149f63eda 100644
--- a/spec/build/testsuites/validation/validation-no-clock-0.yml
+++ b/spec/build/testsuites/validation/validation-no-clock-0.yml
@@ -41,6 +41,12 @@ source:
- testsuites/validation/tc-message-urgent-send.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-score-fatal.c
- testsuites/validation/tr-event-constant.c
- testsuites/validation/tr-mtx-seize-try.c
diff --git a/testsuites/validation/tc-part-create.c b/testsuites/validation/tc-part-create.c
new file mode 100644
index 0000000000..7121b07d4e
--- /dev/null
+++ b/testsuites/validation/tc-part-create.c
@@ -0,0 +1,791 @@
+/* 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://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <string.h>
+
+#include "ts-config.h"
+#include "tx-support.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsPartReqCreate spec:/rtems/part/req/create
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsPartReqCreate_Pre_Name_Valid,
+ RtemsPartReqCreate_Pre_Name_Invalid,
+ RtemsPartReqCreate_Pre_Name_NA
+} RtemsPartReqCreate_Pre_Name;
+
+typedef enum {
+ RtemsPartReqCreate_Pre_Id_Valid,
+ RtemsPartReqCreate_Pre_Id_Null,
+ RtemsPartReqCreate_Pre_Id_NA
+} RtemsPartReqCreate_Pre_Id;
+
+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_Skew,
+ RtemsPartReqCreate_Pre_Size_Small,
+ RtemsPartReqCreate_Pre_Size_NA
+} RtemsPartReqCreate_Pre_Size;
+
+typedef enum {
+ RtemsPartReqCreate_Pre_Free_Yes,
+ RtemsPartReqCreate_Pre_Free_No,
+ RtemsPartReqCreate_Pre_Free_NA
+} RtemsPartReqCreate_Pre_Free;
+
+typedef enum {
+ RtemsPartReqCreate_Post_Status_Ok,
+ RtemsPartReqCreate_Post_Status_InvAddr,
+ RtemsPartReqCreate_Post_Status_InvName,
+ RtemsPartReqCreate_Post_Status_InvSize,
+ RtemsPartReqCreate_Post_Status_TooMany,
+ RtemsPartReqCreate_Post_Status_NA
+} RtemsPartReqCreate_Post_Status;
+
+typedef enum {
+ RtemsPartReqCreate_Post_Name_Valid,
+ RtemsPartReqCreate_Post_Name_Invalid,
+ RtemsPartReqCreate_Post_Name_NA
+} RtemsPartReqCreate_Post_Name;
+
+typedef enum {
+ RtemsPartReqCreate_Post_IdVar_Set,
+ RtemsPartReqCreate_Post_IdVar_Nop,
+ RtemsPartReqCreate_Post_IdVar_NA
+} RtemsPartReqCreate_Post_IdVar;
+
+typedef struct {
+ uint16_t Skip : 1;
+ uint16_t Pre_Name_NA : 1;
+ uint16_t Pre_Id_NA : 1;
+ uint16_t Pre_Start_NA : 1;
+ uint16_t Pre_Length_NA : 1;
+ uint16_t Pre_Size_NA : 1;
+ uint16_t Pre_Free_NA : 1;
+ uint16_t Post_Status : 3;
+ uint16_t Post_Name : 2;
+ uint16_t Post_IdVar : 2;
+} RtemsPartReqCreate_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/part/req/create test case.
+ */
+typedef struct {
+ void *seized_objects;
+
+ 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;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 6 ];
+
+ /**
+ * @brief If this member is true, then the test action loop is executed.
+ */
+ bool in_action_loop;
+
+ /**
+ * @brief This member contains the next transition map index.
+ */
+ size_t index;
+
+ /**
+ * @brief This member contains the current transition map entry.
+ */
+ RtemsPartReqCreate_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsPartReqCreate_Context;
+
+static RtemsPartReqCreate_Context
+ RtemsPartReqCreate_Instance;
+
+static const char * const RtemsPartReqCreate_PreDesc_Name[] = {
+ "Valid",
+ "Invalid",
+ "NA"
+};
+
+static const char * const RtemsPartReqCreate_PreDesc_Id[] = {
+ "Valid",
+ "Null",
+ "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",
+ "Skew",
+ "Small",
+ "NA"
+};
+
+static const char * const RtemsPartReqCreate_PreDesc_Free[] = {
+ "Yes",
+ "No",
+ "NA"
+};
+
+static const char * const * const RtemsPartReqCreate_PreDesc[] = {
+ RtemsPartReqCreate_PreDesc_Name,
+ RtemsPartReqCreate_PreDesc_Id,
+ RtemsPartReqCreate_PreDesc_Start,
+ RtemsPartReqCreate_PreDesc_Length,
+ RtemsPartReqCreate_PreDesc_Size,
+ RtemsPartReqCreate_PreDesc_Free,
+ NULL
+};
+
+#define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
+
+#define MAX_PARTITIONS ( TEST_MAXIMUM_PARTITIONS + 1 )
+
+#define BUFFER_COUNT 2
+
+#define BUFFER_SIZE ( 2 * sizeof( void * ) )
+
+static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t
+ buffers_to_seize[ MAX_PARTITIONS ][ BUFFER_COUNT ][ BUFFER_SIZE ];
+
+static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t
+ buffers[ BUFFER_COUNT ][ BUFFER_SIZE ];
+
+static rtems_status_code Create( void *arg, uint32_t *id )
+{
+ size_t *i;
+ size_t j;
+
+ i = arg;
+ j = *i;
+ T_quiet_lt_sz( j, MAX_PARTITIONS );
+
+ *i = j + 1;
+
+ return rtems_partition_create(
+ rtems_build_name( 'S', 'I', 'Z', 'E' ),
+ buffers_to_seize[ j ],
+ sizeof( buffers_to_seize[ j ] ),
+ sizeof( buffers_to_seize[ j ][ 0 ] ),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ id
+ );
+}
+
+static void RtemsPartReqCreate_Pre_Name_Prepare(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Pre_Name state
+)
+{
+ switch ( state ) {
+ case RtemsPartReqCreate_Pre_Name_Valid: {
+ /*
+ * While the ``name`` parameter is valid.
+ */
+ ctx->name = NAME;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Name_Invalid: {
+ /*
+ * While the ``name`` parameter is invalid.
+ */
+ ctx->name = 0;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Name_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Pre_Id_Prepare(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Pre_Id state
+)
+{
+ switch ( state ) {
+ case RtemsPartReqCreate_Pre_Id_Valid: {
+ /*
+ * While the ``id`` parameter references an object of type rtems_id.
+ */
+ ctx->id = &ctx->id_value;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Id_Null: {
+ /*
+ * While the ``id`` parameter is NULL.
+ */
+ ctx->id = NULL;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Id_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Pre_Start_Prepare(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Pre_Start state
+)
+{
+ switch ( state ) {
+ case RtemsPartReqCreate_Pre_Start_Valid: {
+ /*
+ * While the ``starting_address`` parameter is valid.
+ */
+ ctx->starting_address = buffers;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Start_Null: {
+ /*
+ * While the ``starting_address`` parameter is NULL.
+ */
+ ctx->starting_address = NULL;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Start_BadAlign: {
+ /*
+ * While the ``starting_address`` parameter is misaligned.
+ */
+ 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: {
+ /*
+ * While the ``length`` parameter is valid.
+ */
+ ctx->length = sizeof( buffers );
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Length_Zero: {
+ /*
+ * While the ``length`` parameter is zero.
+ */
+ ctx->length = 0;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Length_Invalid: {
+ /*
+ * While the ``length`` parameter is less than the buffer size.
+ */
+ 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: {
+ /*
+ * While the ``buffer_size`` parameter is valid.
+ */
+ ctx->buffer_size = sizeof( buffers[ 0 ] );
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Size_Zero: {
+ /*
+ * While the ``buffer_size`` parameter is zero.
+ */
+ ctx->buffer_size = 0;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Size_Skew: {
+ /*
+ * The ``buffer_size`` parameter shall not an integral multiple of the
+ * pointer size.
+ */
+ ctx->buffer_size = 1;
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Size_Small: {
+ /*
+ * The ``buffer_size`` parameter shall greater than zero and an integral
+ * multiple of the pointer size and less than the size of two pointers.
+ */
+ ctx->buffer_size = sizeof( uintptr_t );
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Size_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Pre_Free_Prepare(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Pre_Free state
+)
+{
+ size_t i;
+
+ switch ( state ) {
+ case RtemsPartReqCreate_Pre_Free_Yes: {
+ /*
+ * While the system has at least one inactive partition object available.
+ */
+ /* Nothing to do */
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Free_No: {
+ /*
+ * While the system has no inactive partition object available.
+ */
+ i = 0;
+ ctx->seized_objects = T_seize_objects( Create, &i );
+ break;
+ }
+
+ case RtemsPartReqCreate_Pre_Free_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Post_Status_Check(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsPartReqCreate_Post_Status_Ok: {
+ /*
+ * The return status of rtems_partition_create() shall be
+ * RTEMS_SUCCESSFUL.
+ */
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Status_InvAddr: {
+ /*
+ * The return status of rtems_partition_create() shall be
+ * RTEMS_INVALID_ADDRESS.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Status_InvName: {
+ /*
+ * The return status of rtems_partition_create() shall be
+ * RTEMS_INVALID_NAME.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_NAME );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Status_InvSize: {
+ /*
+ * The return status of rtems_partition_create() shall be
+ * RTEMS_INVALID_SIZE.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_SIZE );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Status_TooMany: {
+ /*
+ * The return status of rtems_partition_create() shall be RTEMS_TOO_MANY.
+ */
+ T_rsc( ctx->status, RTEMS_TOO_MANY );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Post_Name_Check(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Post_Name state
+)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ switch ( state ) {
+ case RtemsPartReqCreate_Post_Name_Valid: {
+ /*
+ * The unique object name shall identify the partition created by the
+ * rtems_partition_create() call.
+ */
+ id = 0;
+ sc = rtems_partition_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
+ T_rsc_success( sc );
+ T_eq_u32( id, ctx->id_value );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Name_Invalid: {
+ /*
+ * The unique object name shall not identify a partition.
+ */
+ sc = rtems_partition_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
+ T_rsc( sc, RTEMS_INVALID_NAME );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_Name_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Post_IdVar_Check(
+ RtemsPartReqCreate_Context *ctx,
+ RtemsPartReqCreate_Post_IdVar state
+)
+{
+ rtems_status_code sc;
+ size_t i;
+ void *buffers[ BUFFER_COUNT ];
+ void *no_buffer;
+
+ switch ( state ) {
+ case RtemsPartReqCreate_Post_IdVar_Set: {
+ /*
+ * The value of the object referenced by the ``id`` parameter shall be
+ * set to the object identifier of the created partition after the return
+ * of the rtems_partition_create() call.
+ */
+ T_eq_ptr( ctx->id, &ctx->id_value );
+ T_ne_u32( ctx->id_value, INVALID_ID );
+
+ 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_IdVar_Nop: {
+ /*
+ * Objects referenced by the ``id`` parameter in past calls to
+ * rtems_partition_create() shall not be accessed by the
+ * rtems_partition_create() call.
+ */
+ T_eq_u32( ctx->id_value, INVALID_ID );
+ break;
+ }
+
+ case RtemsPartReqCreate_Post_IdVar_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqCreate_Prepare( RtemsPartReqCreate_Context *ctx )
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ ctx->id_value = INVALID_ID;
+ ctx->attribute_set = RTEMS_DEFAULT_ATTRIBUTES;
+
+ id = INVALID_ID;
+ sc = rtems_partition_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
+ T_rsc( sc, RTEMS_INVALID_NAME );
+ T_eq_u32( id, INVALID_ID );
+}
+
+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 )
+{
+ T_surrender_objects( &ctx->seized_objects, rtems_partition_delete );
+}
+
+static const RtemsPartReqCreate_Entry
+RtemsPartReqCreate_Entries[] = {
+ { 0, 0, 0, 0, 0, 0, 0, RtemsPartReqCreate_Post_Status_InvName,
+ RtemsPartReqCreate_Post_Name_Invalid, RtemsPartReqCreate_Post_IdVar_Nop },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsPartReqCreate_Post_Status_InvAddr,
+ RtemsPartReqCreate_Post_Name_Invalid, RtemsPartReqCreate_Post_IdVar_Nop },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsPartReqCreate_Post_Status_InvSize,
+ RtemsPartReqCreate_Post_Name_Invalid, RtemsPartReqCreate_Post_IdVar_Nop },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsPartReqCreate_Post_Status_Ok,
+ RtemsPartReqCreate_Post_Name_Valid, RtemsPartReqCreate_Post_IdVar_Set },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsPartReqCreate_Post_Status_TooMany,
+ RtemsPartReqCreate_Post_Name_Invalid, RtemsPartReqCreate_Post_IdVar_Nop }
+};
+
+static const uint8_t
+RtemsPartReqCreate_Map[] = {
+ 3, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 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 size_t RtemsPartReqCreate_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsPartReqCreate_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsPartReqCreate_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsPartReqCreate_Fixture = {
+ .setup = NULL,
+ .stop = NULL,
+ .teardown = NULL,
+ .scope = RtemsPartReqCreate_Scope,
+ .initial_context = &RtemsPartReqCreate_Instance
+};
+
+static inline RtemsPartReqCreate_Entry RtemsPartReqCreate_PopEntry(
+ RtemsPartReqCreate_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsPartReqCreate_Entries[
+ RtemsPartReqCreate_Map[ index ]
+ ];
+}
+
+static void RtemsPartReqCreate_TestVariant( RtemsPartReqCreate_Context *ctx )
+{
+ RtemsPartReqCreate_Pre_Name_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsPartReqCreate_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsPartReqCreate_Pre_Start_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsPartReqCreate_Pre_Length_Prepare( ctx, ctx->Map.pcs[ 3 ] );
+ RtemsPartReqCreate_Pre_Size_Prepare( ctx, ctx->Map.pcs[ 4 ] );
+ RtemsPartReqCreate_Pre_Free_Prepare( ctx, ctx->Map.pcs[ 5 ] );
+ RtemsPartReqCreate_Action( ctx );
+ RtemsPartReqCreate_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+ RtemsPartReqCreate_Post_Name_Check( ctx, ctx->Map.entry.Post_Name );
+ RtemsPartReqCreate_Post_IdVar_Check( ctx, ctx->Map.entry.Post_IdVar );
+}
+
+/**
+ * @fn void T_case_body_RtemsPartReqCreate( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsPartReqCreate, &RtemsPartReqCreate_Fixture )
+{
+ RtemsPartReqCreate_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pcs[ 0 ] = RtemsPartReqCreate_Pre_Name_Valid;
+ ctx->Map.pcs[ 0 ] < RtemsPartReqCreate_Pre_Name_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 1 ] = RtemsPartReqCreate_Pre_Id_Valid;
+ ctx->Map.pcs[ 1 ] < RtemsPartReqCreate_Pre_Id_NA;
+ ++ctx->Map.pcs[ 1 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 2 ] = RtemsPartReqCreate_Pre_Start_Valid;
+ ctx->Map.pcs[ 2 ] < RtemsPartReqCreate_Pre_Start_NA;
+ ++ctx->Map.pcs[ 2 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 3 ] = RtemsPartReqCreate_Pre_Length_Valid;
+ ctx->Map.pcs[ 3 ] < RtemsPartReqCreate_Pre_Length_NA;
+ ++ctx->Map.pcs[ 3 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 4 ] = RtemsPartReqCreate_Pre_Size_Valid;
+ ctx->Map.pcs[ 4 ] < RtemsPartReqCreate_Pre_Size_NA;
+ ++ctx->Map.pcs[ 4 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 5 ] = RtemsPartReqCreate_Pre_Free_Yes;
+ ctx->Map.pcs[ 5 ] < RtemsPartReqCreate_Pre_Free_NA;
+ ++ctx->Map.pcs[ 5 ]
+ ) {
+ ctx->Map.entry = RtemsPartReqCreate_PopEntry( ctx );
+ RtemsPartReqCreate_Prepare( ctx );
+ RtemsPartReqCreate_TestVariant( ctx );
+ RtemsPartReqCreate_Cleanup( ctx );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-part-delete.c b/testsuites/validation/tc-part-delete.c
new file mode 100644
index 0000000000..0ec1dd0bde
--- /dev/null
+++ b/testsuites/validation/tc-part-delete.c
@@ -0,0 +1,396 @@
+/* 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://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsPartReqDelete spec:/rtems/part/req/delete
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsPartReqDelete_Pre_Id_NoObj,
+ RtemsPartReqDelete_Pre_Id_Part,
+ 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;
+
+typedef struct {
+ uint8_t Skip : 1;
+ uint8_t Pre_Id_NA : 1;
+ uint8_t Pre_InUse_NA : 1;
+ uint8_t Post_Status : 2;
+} RtemsPartReqDelete_Entry;
+
+/**
+ * @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;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 2 ];
+
+ /**
+ * @brief If this member is true, then the test action loop is executed.
+ */
+ bool in_action_loop;
+
+ /**
+ * @brief This member contains the next transition map index.
+ */
+ size_t index;
+
+ /**
+ * @brief This member contains the current transition map entry.
+ */
+ RtemsPartReqDelete_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsPartReqDelete_Context;
+
+static RtemsPartReqDelete_Context
+ RtemsPartReqDelete_Instance;
+
+static const char * const RtemsPartReqDelete_PreDesc_Id[] = {
+ "NoObj",
+ "Part",
+ "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_NoObj: {
+ /*
+ * While the ``id`` parameter is not associated with a partition.
+ */
+ ctx->id = 0xffffffff;
+ break;
+ }
+
+ case RtemsPartReqDelete_Pre_Id_Part: {
+ /*
+ * While the ``id`` parameter is associated with a partition.
+ */
+ ctx->id = ctx->id_value;
+ 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: {
+ /*
+ * While the partition has at least one buffer in use.
+ */
+ 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: {
+ /*
+ * While the partition does not have a buffer in use.
+ */
+ 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: {
+ /*
+ * The status shall be RTEMS_SUCCESSFUL. The deleted partition object
+ * shall be inactive.
+ */
+ 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: {
+ /*
+ * The status shall be RTEMS_INVALID_ID.
+ */
+ 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: {
+ /*
+ * The status shall be RTEMS_RESOURCE_IN_USE.
+ */
+ 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 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 );
+ }
+}
+
+static const RtemsPartReqDelete_Entry
+RtemsPartReqDelete_Entries[] = {
+ { 0, 0, 0, RtemsPartReqDelete_Post_Status_InvId },
+ { 0, 0, 0, RtemsPartReqDelete_Post_Status_InUse },
+ { 0, 0, 0, RtemsPartReqDelete_Post_Status_Ok }
+};
+
+static const uint8_t
+RtemsPartReqDelete_Map[] = {
+ 0, 0, 1, 2
+};
+
+static size_t RtemsPartReqDelete_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsPartReqDelete_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsPartReqDelete_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsPartReqDelete_Fixture = {
+ .setup = NULL,
+ .stop = NULL,
+ .teardown = NULL,
+ .scope = RtemsPartReqDelete_Scope,
+ .initial_context = &RtemsPartReqDelete_Instance
+};
+
+static inline RtemsPartReqDelete_Entry RtemsPartReqDelete_PopEntry(
+ RtemsPartReqDelete_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsPartReqDelete_Entries[
+ RtemsPartReqDelete_Map[ index ]
+ ];
+}
+
+static void RtemsPartReqDelete_TestVariant( RtemsPartReqDelete_Context *ctx )
+{
+ RtemsPartReqDelete_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsPartReqDelete_Pre_InUse_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsPartReqDelete_Action( ctx );
+ RtemsPartReqDelete_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+}
+
+/**
+ * @fn void T_case_body_RtemsPartReqDelete( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsPartReqDelete, &RtemsPartReqDelete_Fixture )
+{
+ RtemsPartReqDelete_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pcs[ 0 ] = RtemsPartReqDelete_Pre_Id_NoObj;
+ ctx->Map.pcs[ 0 ] < RtemsPartReqDelete_Pre_Id_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 1 ] = RtemsPartReqDelete_Pre_InUse_Yes;
+ ctx->Map.pcs[ 1 ] < RtemsPartReqDelete_Pre_InUse_NA;
+ ++ctx->Map.pcs[ 1 ]
+ ) {
+ ctx->Map.entry = RtemsPartReqDelete_PopEntry( ctx );
+ RtemsPartReqDelete_Prepare( ctx );
+ RtemsPartReqDelete_TestVariant( ctx );
+ RtemsPartReqDelete_Cleanup( ctx );
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-part-get.c b/testsuites/validation/tc-part-get.c
new file mode 100644
index 0000000000..9308c1350a
--- /dev/null
+++ b/testsuites/validation/tc-part-get.c
@@ -0,0 +1,526 @@
+/* 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://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsPartReqGetBuffer spec:/rtems/part/req/get-buffer
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsPartReqGetBuffer_Pre_Id_NoObj,
+ RtemsPartReqGetBuffer_Pre_Id_Part,
+ 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_Unsat,
+ RtemsPartReqGetBuffer_Post_Status_NA
+} RtemsPartReqGetBuffer_Post_Status;
+
+typedef enum {
+ RtemsPartReqGetBuffer_Post_BufVar_Set,
+ RtemsPartReqGetBuffer_Post_BufVar_Nop,
+ RtemsPartReqGetBuffer_Post_BufVar_NA
+} RtemsPartReqGetBuffer_Post_BufVar;
+
+typedef struct {
+ uint16_t Skip : 1;
+ uint16_t Pre_Id_NA : 1;
+ uint16_t Pre_Buf_NA : 1;
+ uint16_t Pre_Avail_NA : 1;
+ uint16_t Post_Status : 3;
+ uint16_t Post_BufVar : 2;
+} RtemsPartReqGetBuffer_Entry;
+
+/**
+ * @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;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 3 ];
+
+ /**
+ * @brief If this member is true, then the test action loop is executed.
+ */
+ bool in_action_loop;
+
+ /**
+ * @brief This member contains the next transition map index.
+ */
+ size_t index;
+
+ /**
+ * @brief This member contains the current transition map entry.
+ */
+ RtemsPartReqGetBuffer_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsPartReqGetBuffer_Context;
+
+static RtemsPartReqGetBuffer_Context
+ RtemsPartReqGetBuffer_Instance;
+
+static const char * const RtemsPartReqGetBuffer_PreDesc_Id[] = {
+ "NoObj",
+ "Part",
+ "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_NoObj: {
+ /*
+ * While the ``id`` parameter is not associated with a partition.
+ */
+ ctx->id = 0xffffffff;
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Pre_Id_Part: {
+ /*
+ * While the ``id`` parameter is associated with a partition.
+ */
+ ctx->id = ctx->id_value;
+ 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: {
+ /*
+ * While the ``buffer`` parameter references an object of type ``void
+ * *``.
+ */
+ ctx->buffer = &ctx->buffer_pointer;
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Pre_Buf_Null: {
+ /*
+ * While the ``buffer`` parameter is 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: {
+ /*
+ * While the partition has at least one free buffer available.
+ */
+ /* Nothing to do */
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Pre_Avail_No: {
+ /*
+ * While the partition does not have a buffer available.
+ */
+ 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: {
+ /*
+ * The return status of rtems_partition_get_buffer() shall be
+ * RTEMS_SUCCESSFUL.
+ */
+ T_rsc_success( ctx->status );
+ T_eq_ptr( ctx->buffer_pointer, buffers );
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Post_Status_InvId: {
+ /*
+ * The return status of rtems_partition_get_buffer() shall be
+ * RTEMS_INVALID_ID.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ T_eq_ptr( ctx->buffer_pointer, (void *) (uintptr_t) 1 );
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Post_Status_InvAddr: {
+ /*
+ * The return status of rtems_partition_get_buffer() shall be
+ * RTEMS_INVALID_ADDRESS.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Post_Status_Unsat: {
+ /*
+ * The return status of rtems_partition_get_buffer() shall be
+ * RTEMS_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_Post_BufVar_Check(
+ RtemsPartReqGetBuffer_Context *ctx,
+ RtemsPartReqGetBuffer_Post_BufVar state
+)
+{
+ switch ( state ) {
+ case RtemsPartReqGetBuffer_Post_BufVar_Set: {
+ /*
+ * The value of the object referenced by the ``starting_address``
+ * parameter shall be set to the object identifier of the begin address
+ * of the returned buffer after the return of the
+ * rtems_partition_create() call.
+ */
+ T_eq_ptr( ctx->buffer, &ctx->buffer_pointer );
+ T_eq_ptr( ctx->buffer_pointer, buffers );
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Post_BufVar_Nop: {
+ /*
+ * Objects referenced by the ``buffer`` parameter in past calls to
+ * rtems_partition_get_buffer() shall not be accessed by the
+ * rtems_partition_get_buffer() call.
+ */
+ T_eq_ptr( ctx->buffer_pointer, (void *) (uintptr_t) 1 );
+ break;
+ }
+
+ case RtemsPartReqGetBuffer_Post_BufVar_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->Map.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->Map.in_action_loop = false;
+ RtemsPartReqGetBuffer_Teardown( ctx );
+}
+
+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 );
+ }
+}
+
+static const RtemsPartReqGetBuffer_Entry
+RtemsPartReqGetBuffer_Entries[] = {
+ { 0, 0, 0, 0, RtemsPartReqGetBuffer_Post_Status_InvAddr,
+ RtemsPartReqGetBuffer_Post_BufVar_Nop },
+ { 0, 0, 0, 0, RtemsPartReqGetBuffer_Post_Status_InvId,
+ RtemsPartReqGetBuffer_Post_BufVar_Nop },
+ { 0, 0, 0, 0, RtemsPartReqGetBuffer_Post_Status_Ok,
+ RtemsPartReqGetBuffer_Post_BufVar_Set },
+ { 0, 0, 0, 0, RtemsPartReqGetBuffer_Post_Status_Unsat,
+ RtemsPartReqGetBuffer_Post_BufVar_Nop }
+};
+
+static const uint8_t
+RtemsPartReqGetBuffer_Map[] = {
+ 1, 1, 0, 0, 2, 3, 0, 0
+};
+
+static size_t RtemsPartReqGetBuffer_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsPartReqGetBuffer_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsPartReqGetBuffer_PreDesc, buf, n, ctx->Map.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 inline RtemsPartReqGetBuffer_Entry RtemsPartReqGetBuffer_PopEntry(
+ RtemsPartReqGetBuffer_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsPartReqGetBuffer_Entries[
+ RtemsPartReqGetBuffer_Map[ index ]
+ ];
+}
+
+static void RtemsPartReqGetBuffer_TestVariant(
+ RtemsPartReqGetBuffer_Context *ctx
+)
+{
+ RtemsPartReqGetBuffer_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsPartReqGetBuffer_Pre_Buf_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsPartReqGetBuffer_Pre_Avail_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsPartReqGetBuffer_Action( ctx );
+ RtemsPartReqGetBuffer_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+ RtemsPartReqGetBuffer_Post_BufVar_Check( ctx, ctx->Map.entry.Post_BufVar );
+}
+
+/**
+ * @fn void T_case_body_RtemsPartReqGetBuffer( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsPartReqGetBuffer, &RtemsPartReqGetBuffer_Fixture )
+{
+ RtemsPartReqGetBuffer_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pcs[ 0 ] = RtemsPartReqGetBuffer_Pre_Id_NoObj;
+ ctx->Map.pcs[ 0 ] < RtemsPartReqGetBuffer_Pre_Id_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 1 ] = RtemsPartReqGetBuffer_Pre_Buf_Valid;
+ ctx->Map.pcs[ 1 ] < RtemsPartReqGetBuffer_Pre_Buf_NA;
+ ++ctx->Map.pcs[ 1 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 2 ] = RtemsPartReqGetBuffer_Pre_Avail_Yes;
+ ctx->Map.pcs[ 2 ] < RtemsPartReqGetBuffer_Pre_Avail_NA;
+ ++ctx->Map.pcs[ 2 ]
+ ) {
+ ctx->Map.entry = RtemsPartReqGetBuffer_PopEntry( ctx );
+ RtemsPartReqGetBuffer_Prepare( ctx );
+ RtemsPartReqGetBuffer_TestVariant( ctx );
+ RtemsPartReqGetBuffer_Cleanup( ctx );
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-part-ident.c b/testsuites/validation/tc-part-ident.c
new file mode 100644
index 0000000000..926c205970
--- /dev/null
+++ b/testsuites/validation/tc-part-ident.c
@@ -0,0 +1,120 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsPartValIdent
+ */
+
+/*
+ * 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://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tr-object-ident.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsPartValIdent spec:/rtems/part/val/ident
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @brief Test the rtems_partition_ident() directive.
+ *
+ * This test case performs the following actions:
+ *
+ * - Run the generic object identification tests for Classic API partition
+ * class objects defined by /rtems/req/ident.
+ *
+ * @{
+ */
+
+static rtems_status_code ClassicPartIdentAction(
+ rtems_name name,
+ uint32_t node,
+ rtems_id *id
+)
+{
+ return rtems_partition_ident( name, node, id );
+}
+
+/**
+ * @brief Run the generic object identification tests for Classic API partition
+ * class objects defined by /rtems/req/ident.
+ */
+static void RtemsPartValIdent_Action_0( void )
+{
+ static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) long area[32];
+ rtems_status_code sc;
+ rtems_id id_local_object;
+
+ sc = rtems_partition_create(
+ ClassicObjectIdentName,
+ area,
+ sizeof( area ),
+ sizeof( area ),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id_local_object
+ );
+ T_assert_rsc_success( sc );
+
+ RtemsReqIdent_Run(
+ id_local_object,
+ ClassicPartIdentAction
+ );
+
+ sc = rtems_partition_delete( id_local_object );
+ T_rsc_success( sc );
+}
+
+/**
+ * @fn void T_case_body_RtemsPartValIdent( void )
+ */
+T_TEST_CASE( RtemsPartValIdent )
+{
+ RtemsPartValIdent_Action_0();
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-part-performance.c b/testsuites/validation/tc-part-performance.c
index 5c3148edcc..4c223910d0 100644
--- a/testsuites/validation/tc-part-performance.c
+++ b/testsuites/validation/tc-part-performance.c
@@ -3,7 +3,7 @@
/**
* @file
*
- * @ingroup RTEMSTestCaseRtemsPartValPerformance
+ * @ingroup RTEMSTestCaseRtemsPartValPerf
*/
/*
@@ -58,19 +58,18 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestCaseRtemsPartValPerformance \
- * spec:/rtems/part/val/performance
+ * @defgroup RTEMSTestCaseRtemsPartValPerf spec:/rtems/part/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
- * @brief This test case provides a context to run Partition Manager
+ * @brief This test case provides a context to run @ref RTEMSAPIClassicPart
* performance tests.
*
* @{
*/
/**
- * @brief Test context for spec:/rtems/part/val/performance test case.
+ * @brief Test context for spec:/rtems/part/val/perf test case.
*/
typedef struct {
/**
@@ -79,8 +78,7 @@ typedef struct {
rtems_id part_one;
/**
- * @brief This member provides a partition with exactly
- * ${.:/params/buffer-count} free buffers.
+ * @brief This member provides a partition with exactly 100 free buffers.
*/
rtems_id part_many;
@@ -108,20 +106,29 @@ typedef struct {
* @brief This member provides the measure runtime request.
*/
T_measure_runtime_request request;
-} RtemsPartValPerformance_Context;
-static RtemsPartValPerformance_Context
- RtemsPartValPerformance_Instance;
+ /**
+ * @brief This member provides an optional measurement begin time point.
+ */
+ T_ticks begin;
-static void RtemsPartValPerformance_Setup_Context(
- RtemsPartValPerformance_Context *ctx
-)
+ /**
+ * @brief This member provides an optional measurement end time point.
+ */
+ T_ticks end;
+} RtemsPartValPerf_Context;
+
+static RtemsPartValPerf_Context
+ RtemsPartValPerf_Instance;
+
+static void RtemsPartValPerf_Setup_Context( RtemsPartValPerf_Context *ctx )
{
T_measure_runtime_config config;
memset( &config, 0, sizeof( config ) );
- config.sample_count = 1000;
+ config.sample_count = 100;
ctx->request.arg = ctx;
+ ctx->request.flags = T_MEASURE_RUNTIME_REPORT_SAMPLES;
ctx->context = T_measure_runtime_create( &config );
T_assert_not_null( ctx->context );
}
@@ -129,9 +136,7 @@ static void RtemsPartValPerformance_Setup_Context(
/**
* @brief Creates the test partition.
*/
-static void RtemsPartValPerformance_Setup(
- RtemsPartValPerformance_Context *ctx
-)
+static void RtemsPartValPerf_Setup( RtemsPartValPerf_Context *ctx )
{
rtems_status_code sc;
size_t size;
@@ -164,21 +169,19 @@ static void RtemsPartValPerformance_Setup(
T_assert_rsc_success( sc );
}
-static void RtemsPartValPerformance_Setup_Wrap( void *arg )
+static void RtemsPartValPerf_Setup_Wrap( void *arg )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
- RtemsPartValPerformance_Setup_Context( ctx );
- RtemsPartValPerformance_Setup( ctx );
+ RtemsPartValPerf_Setup_Context( ctx );
+ RtemsPartValPerf_Setup( ctx );
}
/**
* @brief Deletes the test partition.
*/
-static void RtemsPartValPerformance_Teardown(
- RtemsPartValPerformance_Context *ctx
-)
+static void RtemsPartValPerf_Teardown( RtemsPartValPerf_Context *ctx )
{
rtems_status_code sc;
@@ -193,35 +196,33 @@ static void RtemsPartValPerformance_Teardown(
}
}
-static void RtemsPartValPerformance_Teardown_Wrap( void *arg )
+static void RtemsPartValPerf_Teardown_Wrap( void *arg )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
- RtemsPartValPerformance_Teardown( ctx );
+ RtemsPartValPerf_Teardown( ctx );
}
-static T_fixture RtemsPartValPerformance_Fixture = {
- .setup = RtemsPartValPerformance_Setup_Wrap,
+static T_fixture RtemsPartValPerf_Fixture = {
+ .setup = RtemsPartValPerf_Setup_Wrap,
.stop = NULL,
- .teardown = RtemsPartValPerformance_Teardown_Wrap,
+ .teardown = RtemsPartValPerf_Teardown_Wrap,
.scope = NULL,
- .initial_context = &RtemsPartValPerformance_Instance
+ .initial_context = &RtemsPartValPerf_Instance
};
/**
* @brief Get a buffer.
*/
-static void RtemsPartReqPerfGetBuffer_Body(
- RtemsPartValPerformance_Context *ctx
-)
+static void RtemsPartReqPerfGetBuffer_Body( RtemsPartValPerf_Context *ctx )
{
ctx->status = rtems_partition_get_buffer( ctx->part_many, &ctx->buffer );
}
static void RtemsPartReqPerfGetBuffer_Body_Wrap( void *arg )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
RtemsPartReqPerfGetBuffer_Body( ctx );
@@ -231,11 +232,11 @@ static void RtemsPartReqPerfGetBuffer_Body_Wrap( void *arg )
* @brief Return the buffer.
*/
static bool RtemsPartReqPerfGetBuffer_Teardown(
- RtemsPartValPerformance_Context *ctx,
- T_ticks *delta,
- uint32_t tic,
- uint32_t toc,
- unsigned int retry
+ RtemsPartValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
)
{
rtems_status_code sc;
@@ -256,7 +257,7 @@ static bool RtemsPartReqPerfGetBuffer_Teardown_Wrap(
unsigned int retry
)
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
return RtemsPartReqPerfGetBuffer_Teardown( ctx, delta, tic, toc, retry );
@@ -266,7 +267,7 @@ static bool RtemsPartReqPerfGetBuffer_Teardown_Wrap(
* @brief Get the buffer.
*/
static void RtemsPartReqPerfGetNoBuffer_Prepare(
- RtemsPartValPerformance_Context *ctx
+ RtemsPartValPerf_Context *ctx
)
{
rtems_status_code sc;
@@ -278,16 +279,14 @@ static void RtemsPartReqPerfGetNoBuffer_Prepare(
/**
* @brief Try to get a buffer.
*/
-static void RtemsPartReqPerfGetNoBuffer_Body(
- RtemsPartValPerformance_Context *ctx
-)
+static void RtemsPartReqPerfGetNoBuffer_Body( RtemsPartValPerf_Context *ctx )
{
ctx->status = rtems_partition_get_buffer( ctx->part_one, &ctx->buffer );
}
static void RtemsPartReqPerfGetNoBuffer_Body_Wrap( void *arg )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
RtemsPartReqPerfGetNoBuffer_Body( ctx );
@@ -297,11 +296,11 @@ static void RtemsPartReqPerfGetNoBuffer_Body_Wrap( void *arg )
* @brief Check the status code.
*/
static bool RtemsPartReqPerfGetNoBuffer_Teardown(
- RtemsPartValPerformance_Context *ctx,
- T_ticks *delta,
- uint32_t tic,
- uint32_t toc,
- unsigned int retry
+ RtemsPartValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
)
{
T_quiet_rsc( ctx->status, RTEMS_UNSATISFIED );
@@ -317,7 +316,7 @@ static bool RtemsPartReqPerfGetNoBuffer_Teardown_Wrap(
unsigned int retry
)
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
return RtemsPartReqPerfGetNoBuffer_Teardown( ctx, delta, tic, toc, retry );
@@ -327,7 +326,7 @@ static bool RtemsPartReqPerfGetNoBuffer_Teardown_Wrap(
* @brief Return the buffer.
*/
static void RtemsPartReqPerfGetNoBuffer_Cleanup(
- RtemsPartValPerformance_Context *ctx
+ RtemsPartValPerf_Context *ctx
)
{
rtems_status_code sc;
@@ -339,9 +338,7 @@ static void RtemsPartReqPerfGetNoBuffer_Cleanup(
/**
* @brief Get the buffer.
*/
-static void RtemsPartReqPerfReturnBuffer_Setup(
- RtemsPartValPerformance_Context *ctx
-)
+static void RtemsPartReqPerfReturnBuffer_Setup( RtemsPartValPerf_Context *ctx )
{
rtems_status_code sc;
@@ -351,7 +348,7 @@ static void RtemsPartReqPerfReturnBuffer_Setup(
static void RtemsPartReqPerfReturnBuffer_Setup_Wrap( void *arg )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
RtemsPartReqPerfReturnBuffer_Setup( ctx );
@@ -360,16 +357,14 @@ static void RtemsPartReqPerfReturnBuffer_Setup_Wrap( void *arg )
/**
* @brief Return the buffer.
*/
-static void RtemsPartReqPerfReturnBuffer_Body(
- RtemsPartValPerformance_Context *ctx
-)
+static void RtemsPartReqPerfReturnBuffer_Body( RtemsPartValPerf_Context *ctx )
{
ctx->status = rtems_partition_return_buffer( ctx->part_many, ctx->buffer );
}
static void RtemsPartReqPerfReturnBuffer_Body_Wrap( void *arg )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
RtemsPartReqPerfReturnBuffer_Body( ctx );
@@ -379,11 +374,11 @@ static void RtemsPartReqPerfReturnBuffer_Body_Wrap( void *arg )
* @brief Check the status code.
*/
static bool RtemsPartReqPerfReturnBuffer_Teardown(
- RtemsPartValPerformance_Context *ctx,
- T_ticks *delta,
- uint32_t tic,
- uint32_t toc,
- unsigned int retry
+ RtemsPartValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
)
{
T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
@@ -399,21 +394,18 @@ static bool RtemsPartReqPerfReturnBuffer_Teardown_Wrap(
unsigned int retry
)
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = arg;
return RtemsPartReqPerfReturnBuffer_Teardown( ctx, delta, tic, toc, retry );
}
/**
- * @fn void T_case_body_RtemsPartValPerformance( void )
+ * @fn void T_case_body_RtemsPartValPerf( void )
*/
-T_TEST_CASE_FIXTURE(
- RtemsPartValPerformance,
- &RtemsPartValPerformance_Fixture
-)
+T_TEST_CASE_FIXTURE( RtemsPartValPerf, &RtemsPartValPerf_Fixture )
{
- RtemsPartValPerformance_Context *ctx;
+ RtemsPartValPerf_Context *ctx;
ctx = T_fixture_context();
diff --git a/testsuites/validation/tc-part-return.c b/testsuites/validation/tc-part-return.c
new file mode 100644
index 0000000000..71c6a31e66
--- /dev/null
+++ b/testsuites/validation/tc-part-return.c
@@ -0,0 +1,487 @@
+/* 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://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsPartReqReturnBuffer \
+ * spec:/rtems/part/req/return-buffer
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsPartReqReturnBuffer_Pre_Id_NoObj,
+ RtemsPartReqReturnBuffer_Pre_Id_Part,
+ RtemsPartReqReturnBuffer_Pre_Id_NA
+} RtemsPartReqReturnBuffer_Pre_Id;
+
+typedef enum {
+ RtemsPartReqReturnBuffer_Pre_Buf_Valid,
+ RtemsPartReqReturnBuffer_Pre_Buf_BadAlign,
+ RtemsPartReqReturnBuffer_Pre_Buf_BelowArea,
+ RtemsPartReqReturnBuffer_Pre_Buf_AboveArea,
+ 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;
+
+typedef enum {
+ RtemsPartReqReturnBuffer_Post_Buf_Free,
+ RtemsPartReqReturnBuffer_Post_Buf_InUse,
+ RtemsPartReqReturnBuffer_Post_Buf_NA
+} RtemsPartReqReturnBuffer_Post_Buf;
+
+typedef struct {
+ uint8_t Skip : 1;
+ uint8_t Pre_Id_NA : 1;
+ uint8_t Pre_Buf_NA : 1;
+ uint8_t Post_Status : 2;
+ uint8_t Post_Buf : 2;
+} RtemsPartReqReturnBuffer_Entry;
+
+/**
+ * @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;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 2 ];
+
+ /**
+ * @brief If this member is true, then the test action loop is executed.
+ */
+ bool in_action_loop;
+
+ /**
+ * @brief This member contains the next transition map index.
+ */
+ size_t index;
+
+ /**
+ * @brief This member contains the current transition map entry.
+ */
+ RtemsPartReqReturnBuffer_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsPartReqReturnBuffer_Context;
+
+static RtemsPartReqReturnBuffer_Context
+ RtemsPartReqReturnBuffer_Instance;
+
+static const char * const RtemsPartReqReturnBuffer_PreDesc_Id[] = {
+ "NoObj",
+ "Part",
+ "NA"
+};
+
+static const char * const RtemsPartReqReturnBuffer_PreDesc_Buf[] = {
+ "Valid",
+ "BadAlign",
+ "BelowArea",
+ "AboveArea",
+ "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_NoObj: {
+ /*
+ * While the ``id`` parameter is invalid.
+ */
+ ctx->id = 0xffffffff;
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Pre_Id_Part: {
+ /*
+ * While the ``id`` parameter is associated with a partition.
+ */
+ ctx->id = ctx->id_value;
+ 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: {
+ /*
+ * While the ``buffer`` parameter references a buffer previously returned
+ * by rtems_partition_get_buffer().
+ */
+ ctx->buffer = ctx->buffer_in_use;
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Pre_Buf_BadAlign: {
+ /*
+ * While the ``buffer`` parameter is an address inside the buffer area of
+ * the partition, while the address is not on a valid buffer boundary.
+ */
+ ctx->buffer = (void *) ( (uintptr_t) ctx->buffer_in_use + 1 );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Pre_Buf_BelowArea: {
+ /*
+ * While the ``buffer`` parameter is an address below the buffer area of
+ * the partition.
+ */
+ ctx->buffer = (void *) ( (uintptr_t) buffers - 1 );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Pre_Buf_AboveArea: {
+ /*
+ * While the ``buffer`` parameter is an address above the buffer area of
+ * the partition.
+ */
+ ctx->buffer = (void *) ( (uintptr_t) buffers + sizeof( buffers ) );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Pre_Buf_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqReturnBuffer_Post_Status_Check(
+ RtemsPartReqReturnBuffer_Context *ctx,
+ RtemsPartReqReturnBuffer_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsPartReqReturnBuffer_Post_Status_Ok: {
+ /*
+ * The return status of rtems_partition_return_buffer() shall be
+ * RTEMS_SUCCESSFUL.
+ */
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Post_Status_InvId: {
+ /*
+ * The return status of rtems_partition_return_buffer() shall be
+ * RTEMS_INVALID_ID.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Post_Status_InvAddr: {
+ /*
+ * The return status of rtems_partition_return_buffer() shall be
+ * RTEMS_INVALID_ADDRESS.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqReturnBuffer_Post_Buf_Check(
+ RtemsPartReqReturnBuffer_Context *ctx,
+ RtemsPartReqReturnBuffer_Post_Buf state
+)
+{
+ rtems_status_code sc;
+ void *no_buffer;
+
+ switch ( state ) {
+ case RtemsPartReqReturnBuffer_Post_Buf_Free: {
+ /*
+ * The buffer obtained from the partition shall be made available for
+ * re-use by the rtems_partition_return_buffer() call.
+ */
+ 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_Buf_InUse: {
+ /*
+ * The buffer obtained from the partition shall be still in use after the
+ * rtems_partition_return_buffer() call.
+ */
+ sc = rtems_partition_get_buffer( ctx->id_value, &no_buffer );
+ T_rsc( sc, RTEMS_UNSATISFIED );
+ break;
+ }
+
+ case RtemsPartReqReturnBuffer_Post_Buf_NA:
+ break;
+ }
+}
+
+static void RtemsPartReqReturnBuffer_Setup(
+ RtemsPartReqReturnBuffer_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ ctx->buffer_in_use = NULL;
+ 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->Map.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->Map.in_action_loop = false;
+ RtemsPartReqReturnBuffer_Teardown( ctx );
+}
+
+static void RtemsPartReqReturnBuffer_Action(
+ RtemsPartReqReturnBuffer_Context *ctx
+)
+{
+ ctx->status = rtems_partition_return_buffer( ctx->id, ctx->buffer );
+}
+
+static const RtemsPartReqReturnBuffer_Entry
+RtemsPartReqReturnBuffer_Entries[] = {
+ { 0, 0, 0, RtemsPartReqReturnBuffer_Post_Status_InvId,
+ RtemsPartReqReturnBuffer_Post_Buf_InUse },
+ { 0, 0, 0, RtemsPartReqReturnBuffer_Post_Status_InvAddr,
+ RtemsPartReqReturnBuffer_Post_Buf_InUse },
+ { 0, 0, 0, RtemsPartReqReturnBuffer_Post_Status_Ok,
+ RtemsPartReqReturnBuffer_Post_Buf_Free }
+};
+
+static const uint8_t
+RtemsPartReqReturnBuffer_Map[] = {
+ 0, 0, 0, 0, 2, 1, 1, 1
+};
+
+static size_t RtemsPartReqReturnBuffer_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsPartReqReturnBuffer_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope(
+ RtemsPartReqReturnBuffer_PreDesc,
+ buf,
+ n,
+ ctx->Map.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 inline RtemsPartReqReturnBuffer_Entry RtemsPartReqReturnBuffer_PopEntry(
+ RtemsPartReqReturnBuffer_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsPartReqReturnBuffer_Entries[
+ RtemsPartReqReturnBuffer_Map[ index ]
+ ];
+}
+
+static void RtemsPartReqReturnBuffer_TestVariant(
+ RtemsPartReqReturnBuffer_Context *ctx
+)
+{
+ RtemsPartReqReturnBuffer_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsPartReqReturnBuffer_Pre_Buf_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsPartReqReturnBuffer_Action( ctx );
+ RtemsPartReqReturnBuffer_Post_Status_Check(
+ ctx,
+ ctx->Map.entry.Post_Status
+ );
+ RtemsPartReqReturnBuffer_Post_Buf_Check( ctx, ctx->Map.entry.Post_Buf );
+}
+
+/**
+ * @fn void T_case_body_RtemsPartReqReturnBuffer( void )
+ */
+T_TEST_CASE_FIXTURE(
+ RtemsPartReqReturnBuffer,
+ &RtemsPartReqReturnBuffer_Fixture
+)
+{
+ RtemsPartReqReturnBuffer_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pcs[ 0 ] = RtemsPartReqReturnBuffer_Pre_Id_NoObj;
+ ctx->Map.pcs[ 0 ] < RtemsPartReqReturnBuffer_Pre_Id_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 1 ] = RtemsPartReqReturnBuffer_Pre_Buf_Valid;
+ ctx->Map.pcs[ 1 ] < RtemsPartReqReturnBuffer_Pre_Buf_NA;
+ ++ctx->Map.pcs[ 1 ]
+ ) {
+ ctx->Map.entry = RtemsPartReqReturnBuffer_PopEntry( ctx );
+ RtemsPartReqReturnBuffer_TestVariant( ctx );
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-part.c b/testsuites/validation/tc-part.c
new file mode 100644
index 0000000000..220c8a6b63
--- /dev/null
+++ b/testsuites/validation/tc-part.c
@@ -0,0 +1,196 @@
+/* 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://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsPartValPart spec:/rtems/part/val/part
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @brief This test case collection provides validation test cases for
+ * requirements of the @ref RTEMSAPIClassicPart.
+ *
+ * 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.
+ *
+ * - Assert that RTEMS_PARTITION_ALIGNMENT is a constant expression which
+ * evaluates to the expected value.
+ *
+ * @{
+ */
+
+/**
+ * @brief 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.
+ */
+static void RtemsPartValPart_Action_0( void )
+{
+ 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;
+
+ 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 );
+
+ /*
+ * Check that exactly three buffers can be obtained from the partition for
+ * use in parallel.
+ */
+ 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 ] );
+
+ /*
+ * 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.
+ */
+ 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 );
+}
+
+/**
+ * @brief Assert that RTEMS_PARTITION_ALIGNMENT is a constant expression which
+ * evaluates to the expected value.
+ */
+static void RtemsPartValPart_Action_1( void )
+{
+ RTEMS_STATIC_ASSERT(
+ RTEMS_PARTITION_ALIGNMENT == CPU_SIZEOF_POINTER,
+ ALIGNMENT
+ );
+}
+
+/**
+ * @fn void T_case_body_RtemsPartValPart( void )
+ */
+T_TEST_CASE( RtemsPartValPart )
+{
+ T_plan( 22 );
+
+ RtemsPartValPart_Action_0();
+ RtemsPartValPart_Action_1();
+}
+
+/** @} */