validation: Use individual names for ident tests

Make the task configuration reusable.

Update #3716.
This commit is contained in:
Sebastian Huber
2022-03-29 17:19:42 +02:00
parent 9bbf4003f3
commit c2d7376f06
15 changed files with 130 additions and 41 deletions
@@ -12,6 +12,7 @@ install-path: null
links: []
source:
- testsuites/validation/tx-call-within-isr.c
- testsuites/validation/tx-default-task-config.c
- testsuites/validation/tx-interrupt.c
- testsuites/validation/tx-io-relax.c
- testsuites/validation/tx-memory-alloc.c
+4 -1
View File
@@ -71,6 +71,8 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'B', 'A', 'R', 'R' )
static rtems_status_code ClassicBarrierIdentAction(
rtems_name name,
rtems_id *id
@@ -89,7 +91,7 @@ static void RtemsBarrierValIdent_Action_0( void )
rtems_id id_local_object;
sc = rtems_barrier_create(
ClassicObjectLocalIdentName,
NAME_LOCAL_OBJECT,
RTEMS_DEFAULT_ATTRIBUTES,
1,
&id_local_object
@@ -98,6 +100,7 @@ static void RtemsBarrierValIdent_Action_0( void )
RtemsReqIdentLocal_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicBarrierIdentAction
);
+4 -1
View File
@@ -71,10 +71,12 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'M', 'E', 'S', 'Q' )
static RTEMS_MESSAGE_QUEUE_BUFFER( 1 ) ClassicMessageIdentBuffers[ 1 ];
static rtems_message_queue_config ClassicObjectIdentConfig = {
.name = ClassicObjectIdentName,
.name = NAME_LOCAL_OBJECT,
.maximum_pending_messages = RTEMS_ARRAY_SIZE( ClassicMessageIdentBuffers ),
.maximum_message_size = 1,
.storage_area = ClassicMessageIdentBuffers,
@@ -108,6 +110,7 @@ static void RtemsMessageValIdent_Action_0( void )
RtemsReqIdent_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicMessageIdentAction
);
+4 -1
View File
@@ -71,6 +71,8 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'P', 'A', 'R', 'T' )
static rtems_status_code ClassicPartIdentAction(
rtems_name name,
uint32_t node,
@@ -91,7 +93,7 @@ static void RtemsPartValIdent_Action_0( void )
rtems_id id_local_object;
sc = rtems_partition_create(
ClassicObjectIdentName,
NAME_LOCAL_OBJECT,
area,
sizeof( area ),
sizeof( area ),
@@ -102,6 +104,7 @@ static void RtemsPartValIdent_Action_0( void )
RtemsReqIdent_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicPartIdentAction
);
+4 -1
View File
@@ -71,6 +71,8 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'R', 'A', 'T', 'E' )
static rtems_status_code ClassicRatemonIdentAction(
rtems_name name,
rtems_id *id
@@ -89,13 +91,14 @@ static void RtemsRatemonValIdent_Action_0( void )
rtems_id id_local_object;
sc = rtems_rate_monotonic_create(
ClassicObjectLocalIdentName,
NAME_LOCAL_OBJECT,
&id_local_object
);
T_assert_rsc_success( sc );
RtemsReqIdentLocal_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicRatemonIdentAction
);
+4 -1
View File
@@ -71,6 +71,8 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'S', 'E', 'M', 'A' )
static rtems_status_code ClassicSemIdentAction(
rtems_name name,
uint32_t node,
@@ -90,7 +92,7 @@ static void RtemsSemValIdent_Action_0( void )
rtems_id id_local_object;
sc = rtems_semaphore_create(
ClassicObjectIdentName,
NAME_LOCAL_OBJECT,
0,
RTEMS_DEFAULT_ATTRIBUTES,
0,
@@ -100,6 +102,7 @@ static void RtemsSemValIdent_Action_0( void )
RtemsReqIdent_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicSemIdentAction
);
+3 -24
View File
@@ -53,7 +53,7 @@
#endif
#include "tr-object-ident.h"
#include "ts-config.h"
#include "tx-support.h"
#include <rtems/test.h>
@@ -147,28 +147,6 @@ static rtems_status_code ClassicTaskIdentAction(
return rtems_task_ident( name, node, id );
}
#define TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
static char ClassicTaskIdentStorage[
RTEMS_TASK_STORAGE_SIZE(
MAX_TLS_SIZE + TEST_MINIMUM_STACK_SIZE,
TASK_ATTRIBUTES
)
];
static const rtems_task_config ClassicTaskIdentConfig = {
.name = ClassicObjectIdentName,
.initial_priority = 1,
.storage_area = ClassicTaskIdentStorage,
.storage_size = sizeof( ClassicTaskIdentStorage ),
.maximum_thread_local_storage_size = MAX_TLS_SIZE,
.initial_modes = RTEMS_DEFAULT_MODES,
.attributes = TASK_ATTRIBUTES
};
static void RtemsTaskReqIdent_Pre_Name_Prepare(
RtemsTaskReqIdent_Context *ctx,
RtemsTaskReqIdent_Pre_Name state
@@ -237,7 +215,7 @@ static void RtemsTaskReqIdent_Setup( RtemsTaskReqIdent_Context *ctx )
rtems_status_code sc;
sc = rtems_task_construct(
&ClassicTaskIdentConfig,
&DefaultTaskConfig,
&ctx->id_local_object
);
T_assert_rsc_success( sc );
@@ -278,6 +256,7 @@ static void RtemsTaskReqIdent_Action( RtemsTaskReqIdent_Context *ctx )
} else {
RtemsReqIdent_Run(
ctx->id_local_object,
DefaultTaskConfig.name,
ClassicTaskIdentAction
);
}
+4 -1
View File
@@ -71,6 +71,8 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'T', 'I', 'M', 'R' )
static rtems_status_code ClassicTimerIdentAction(
rtems_name name,
rtems_id *id
@@ -89,13 +91,14 @@ static void RtemsTimerValIdent_Action_0( void )
rtems_id id_local_object;
sc = rtems_timer_create(
ClassicObjectLocalIdentName,
NAME_LOCAL_OBJECT,
&id_local_object
);
T_assert_rsc_success( sc );
RtemsReqIdentLocal_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicTimerIdentAction
);
+4 -1
View File
@@ -71,6 +71,8 @@
* @{
*/
#define NAME_LOCAL_OBJECT rtems_build_name( 'U', 'E', 'X', 'T' )
static rtems_status_code ClassicUserExtIdentAction(
rtems_name name,
rtems_id *id
@@ -90,7 +92,7 @@ static void RtemsUserextValIdent_Action_0( void )
rtems_id id_local_object;
sc = rtems_extension_create(
ClassicObjectLocalIdentName,
NAME_LOCAL_OBJECT,
&table,
&id_local_object
);
@@ -98,6 +100,7 @@ static void RtemsUserextValIdent_Action_0( void )
RtemsReqIdentLocal_Run(
id_local_object,
NAME_LOCAL_OBJECT,
ClassicUserExtIdentAction
);
@@ -90,6 +90,12 @@ typedef struct {
*/
rtems_id id_local_object;
/**
* @brief This member contains a copy of the corresponding
* RtemsReqIdentLocal_Run() parameter.
*/
rtems_name name_local_object;
/**
* @brief This member contains a copy of the corresponding
* RtemsReqIdentLocal_Run() parameter.
@@ -166,7 +172,7 @@ static void RtemsReqIdentLocal_Pre_Name_Prepare(
* While the ``name`` parameter is associated with an active object of
* the specified class .
*/
ctx->name = ClassicObjectLocalIdentName;
ctx->name = ctx->name_local_object;
break;
}
@@ -346,6 +352,7 @@ static T_fixture_node RtemsReqIdentLocal_Node;
void RtemsReqIdentLocal_Run(
rtems_id id_local_object,
rtems_name name_local_object,
rtems_status_code ( *action )( rtems_name, rtems_id * )
)
{
@@ -353,6 +360,7 @@ void RtemsReqIdentLocal_Run(
ctx = &RtemsReqIdentLocal_Instance;
ctx->id_local_object = id_local_object;
ctx->name_local_object = name_local_object;
ctx->action = action;
ctx = T_push_fixture( &RtemsReqIdentLocal_Node, &RtemsReqIdentLocal_Fixture );
@@ -89,19 +89,20 @@ typedef enum {
RtemsReqIdentLocal_Post_Id_NA
} RtemsReqIdentLocal_Post_Id;
#define ClassicObjectLocalIdentName \
rtems_build_name( 'I', 'D', 'N', 'T' )
/**
* @brief Runs the parameterized test case.
*
* @param id_local_object is the identifier of an active object of the class
* under test with the name ClassicObjectLocalIdentName.
* under test.
*
* @param name_local_object is the name of the active object of the class under
* test.
*
* @param action is the action handler.
*/
void RtemsReqIdentLocal_Run(
rtems_id id_local_object,
rtems_name name_local_object,
rtems_status_code ( *action )( rtems_name, rtems_id * )
);
+9 -1
View File
@@ -95,6 +95,12 @@ typedef struct {
*/
rtems_id id_local_object;
/**
* @brief This member contains a copy of the corresponding
* RtemsReqIdent_Run() parameter.
*/
rtems_name name_local_object;
/**
* @brief This member contains a copy of the corresponding
* RtemsReqIdent_Run() parameter.
@@ -182,7 +188,7 @@ static void RtemsReqIdent_Pre_Name_Prepare(
* While the ``name`` parameter is associated with an active object of
* the specified class .
*/
ctx->name = ClassicObjectIdentName;
ctx->name = ctx->name_local_object;
break;
}
@@ -450,6 +456,7 @@ static T_fixture_node RtemsReqIdent_Node;
void RtemsReqIdent_Run(
rtems_id id_local_object,
rtems_name name_local_object,
rtems_status_code ( *action )( rtems_name, uint32_t, rtems_id * )
)
{
@@ -457,6 +464,7 @@ void RtemsReqIdent_Run(
ctx = &RtemsReqIdent_Instance;
ctx->id_local_object = id_local_object;
ctx->name_local_object = name_local_object;
ctx->action = action;
ctx = T_push_fixture( &RtemsReqIdent_Node, &RtemsReqIdent_Fixture );
+5 -4
View File
@@ -101,19 +101,20 @@ typedef enum {
RtemsReqIdent_Post_Id_NA
} RtemsReqIdent_Post_Id;
#define ClassicObjectIdentName \
rtems_build_name( 'I', 'D', 'N', 'T' )
/**
* @brief Runs the parameterized test case.
*
* @param id_local_object is the identifier of an active object of the class
* under test with the name ClassicObjectIdentName.
* under test.
*
* @param name_local_object is the name of the active object of the class under
* test.
*
* @param action is the action handler.
*/
void RtemsReqIdent_Run(
rtems_id id_local_object,
rtems_name name_local_object,
rtems_status_code ( *action )( rtems_name, uint32_t, rtems_id * )
);
@@ -0,0 +1,61 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestSuites
*
* @brief This source file contains the definition of ::DefaultTaskConfig.
*/
/*
* Copyright (C) 2022 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tx-support.h"
#include "ts-config.h"
#define TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
static char DefaultTaskStorage[
RTEMS_TASK_STORAGE_SIZE(
TEST_MAXIMUM_TLS_SIZE + TEST_MINIMUM_STACK_SIZE,
TASK_ATTRIBUTES
)
];
const rtems_task_config DefaultTaskConfig = {
.name = rtems_build_name( 'D', 'T', 'S', 'K' ),
.initial_priority = 1,
.storage_area = DefaultTaskStorage,
.storage_size = sizeof( DefaultTaskStorage ),
.maximum_thread_local_storage_size = TEST_MAXIMUM_TLS_SIZE,
.initial_modes = RTEMS_DEFAULT_MODES,
.attributes = TASK_ATTRIBUTES
};
+9
View File
@@ -590,6 +590,15 @@ static inline void ISRLockWaitForOthers(
void *IdleBody( uintptr_t ignored );
/**
* @brief This task configurations may be used to construct a task during
* tests.
*
* Only one task shall use this configuration at a time, otherwise two tasks
* would share a stack.
*/
extern const rtems_task_config DefaultTaskConfig;
/** @} */
#ifdef __cplusplus