From c2d7376f0686a663e65e03dcc3922fa2c85cb530 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 29 Mar 2022 16:31:25 +0200 Subject: validation: Use individual names for ident tests Make the task configuration reusable. Update #3716. --- testsuites/validation/tc-barrier-ident.c | 5 ++- testsuites/validation/tc-message-ident.c | 5 ++- testsuites/validation/tc-part-ident.c | 5 ++- testsuites/validation/tc-ratemon-ident.c | 5 ++- testsuites/validation/tc-sem-ident.c | 5 ++- testsuites/validation/tc-task-ident.c | 27 ++---------- testsuites/validation/tc-timer-ident.c | 5 ++- testsuites/validation/tc-userext-ident.c | 5 ++- testsuites/validation/tr-object-ident-local.c | 10 ++++- testsuites/validation/tr-object-ident-local.h | 9 ++-- testsuites/validation/tr-object-ident.c | 10 ++++- testsuites/validation/tr-object-ident.h | 9 ++-- testsuites/validation/tx-default-task-config.c | 61 ++++++++++++++++++++++++++ testsuites/validation/tx-support.h | 9 ++++ 14 files changed, 129 insertions(+), 41 deletions(-) create mode 100644 testsuites/validation/tx-default-task-config.c (limited to 'testsuites/validation') diff --git a/testsuites/validation/tc-barrier-ident.c b/testsuites/validation/tc-barrier-ident.c index 71e7051f66..dcb4a1c273 100644 --- a/testsuites/validation/tc-barrier-ident.c +++ b/testsuites/validation/tc-barrier-ident.c @@ -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 ); diff --git a/testsuites/validation/tc-message-ident.c b/testsuites/validation/tc-message-ident.c index 74759b525e..70e7d53350 100644 --- a/testsuites/validation/tc-message-ident.c +++ b/testsuites/validation/tc-message-ident.c @@ -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 ); diff --git a/testsuites/validation/tc-part-ident.c b/testsuites/validation/tc-part-ident.c index 926c205970..fccdf9671c 100644 --- a/testsuites/validation/tc-part-ident.c +++ b/testsuites/validation/tc-part-ident.c @@ -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 ); diff --git a/testsuites/validation/tc-ratemon-ident.c b/testsuites/validation/tc-ratemon-ident.c index 1126fcacab..beeb0bfd14 100644 --- a/testsuites/validation/tc-ratemon-ident.c +++ b/testsuites/validation/tc-ratemon-ident.c @@ -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 ); diff --git a/testsuites/validation/tc-sem-ident.c b/testsuites/validation/tc-sem-ident.c index 183680fee0..3014113189 100644 --- a/testsuites/validation/tc-sem-ident.c +++ b/testsuites/validation/tc-sem-ident.c @@ -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 ); diff --git a/testsuites/validation/tc-task-ident.c b/testsuites/validation/tc-task-ident.c index a61b90330a..c4247f22cf 100644 --- a/testsuites/validation/tc-task-ident.c +++ b/testsuites/validation/tc-task-ident.c @@ -53,7 +53,7 @@ #endif #include "tr-object-ident.h" -#include "ts-config.h" +#include "tx-support.h" #include @@ -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 ); } diff --git a/testsuites/validation/tc-timer-ident.c b/testsuites/validation/tc-timer-ident.c index 5f121fc55b..bdee3d89d2 100644 --- a/testsuites/validation/tc-timer-ident.c +++ b/testsuites/validation/tc-timer-ident.c @@ -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 ); diff --git a/testsuites/validation/tc-userext-ident.c b/testsuites/validation/tc-userext-ident.c index d2adcb313e..2ece528953 100644 --- a/testsuites/validation/tc-userext-ident.c +++ b/testsuites/validation/tc-userext-ident.c @@ -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 ); diff --git a/testsuites/validation/tr-object-ident-local.c b/testsuites/validation/tr-object-ident-local.c index 5ca8c08fab..1b3943fdb1 100644 --- a/testsuites/validation/tr-object-ident-local.c +++ b/testsuites/validation/tr-object-ident-local.c @@ -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 ); diff --git a/testsuites/validation/tr-object-ident-local.h b/testsuites/validation/tr-object-ident-local.h index 13f6a09997..83ad7e7416 100644 --- a/testsuites/validation/tr-object-ident-local.h +++ b/testsuites/validation/tr-object-ident-local.h @@ -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 * ) ); diff --git a/testsuites/validation/tr-object-ident.c b/testsuites/validation/tr-object-ident.c index fac8767175..438c1f3333 100644 --- a/testsuites/validation/tr-object-ident.c +++ b/testsuites/validation/tr-object-ident.c @@ -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 ); diff --git a/testsuites/validation/tr-object-ident.h b/testsuites/validation/tr-object-ident.h index 2404665272..7917562eab 100644 --- a/testsuites/validation/tr-object-ident.h +++ b/testsuites/validation/tr-object-ident.h @@ -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 * ) ); diff --git a/testsuites/validation/tx-default-task-config.c b/testsuites/validation/tx-default-task-config.c new file mode 100644 index 0000000000..59a0fd0ed3 --- /dev/null +++ b/testsuites/validation/tx-default-task-config.c @@ -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 +}; diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h index b647551b4e..592067ca26 100644 --- a/testsuites/validation/tx-support.h +++ b/testsuites/validation/tx-support.h @@ -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 -- cgit v1.2.3