validation: Test Barrier 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.
This commit is contained in:
Sebastian Huber
2022-03-24 11:10:48 +01:00
parent 0b26e0994c
commit 1410d5b8bf
9 changed files with 812 additions and 42 deletions
@@ -11,6 +11,7 @@ includes: []
ldflags: []
links: []
source:
- testsuites/validation/tc-barrier-performance.c
- testsuites/validation/ts-performance-no-clock-0.c
stlib: []
target: testsuites/validation/ts-performance-no-clock-0.exe
@@ -12,10 +12,6 @@ ldflags: []
links: []
source:
- testsuites/validation/tc-acfg-appl-needs-clock-driver.c
- testsuites/validation/tc-barrier-create.c
- testsuites/validation/tc-barrier-delete.c
- testsuites/validation/tc-barrier-release.c
- testsuites/validation/tc-barrier-wait.c
- testsuites/validation/tc-intr-clear.c
- testsuites/validation/tc-intr-entry-install.c
- testsuites/validation/tc-intr-entry-remove.c
@@ -13,6 +13,11 @@ links: []
source:
- testsuites/validation/tc-acfg.c
- testsuites/validation/tc-attr.c
- testsuites/validation/tc-barrier-create.c
- testsuites/validation/tc-barrier-delete.c
- testsuites/validation/tc-barrier-ident.c
- testsuites/validation/tc-barrier-release.c
- testsuites/validation/tc-barrier-wait.c
- testsuites/validation/tc-score-fatal.c
- testsuites/validation/tr-mtx-seize-try.c
- testsuites/validation/tr-mtx-seize-wait.c
+1 -1
View File
@@ -62,7 +62,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierReqCreate spec:/rtems/barrier/req/create
*
* @ingroup RTEMSTestSuiteTestsuitesValidation0
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
+1 -1
View File
@@ -62,7 +62,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierReqDelete spec:/rtems/barrier/req/delete
*
* @ingroup RTEMSTestSuiteTestsuitesValidation0
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
+116
View File
@@ -0,0 +1,116 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestCaseRtemsBarrierValIdent
*/
/*
* 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-local.h"
#include <rtems/test.h>
/**
* @defgroup RTEMSTestCaseRtemsBarrierValIdent spec:/rtems/barrier/val/ident
*
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @brief Test the rtems_barrier_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-local.
*
* @{
*/
static rtems_status_code ClassicBarrierIdentAction(
rtems_name name,
rtems_id *id
)
{
return rtems_barrier_ident( name, id );
}
/**
* @brief Run the generic object identification tests for Classic API partition
* class objects defined by /rtems/req/ident-local.
*/
static void RtemsBarrierValIdent_Action_0( void )
{
rtems_status_code sc;
rtems_id id_local_object;
sc = rtems_barrier_create(
ClassicObjectLocalIdentName,
RTEMS_DEFAULT_ATTRIBUTES,
1,
&id_local_object
);
T_assert_rsc_success( sc );
RtemsReqIdentLocal_Run(
id_local_object,
ClassicBarrierIdentAction
);
sc = rtems_barrier_delete( id_local_object );
T_rsc_success( sc );
}
/**
* @fn void T_case_body_RtemsBarrierValIdent( void )
*/
T_TEST_CASE( RtemsBarrierValIdent )
{
RtemsBarrierValIdent_Action_0();
}
/** @} */
File diff suppressed because it is too large Load Diff
+32 -14
View File
@@ -63,7 +63,7 @@
* @defgroup RTEMSTestCaseRtemsBarrierReqRelease \
* spec:/rtems/barrier/req/release
*
* @ingroup RTEMSTestSuiteTestsuitesValidation0
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
@@ -130,6 +130,12 @@ typedef struct {
rtems_status_code status;
struct {
/**
* @brief This member defines the pre-condition indices for the next
* action.
*/
size_t pci[ 3 ];
/**
* @brief This member defines the pre-condition states for the next action.
*/
@@ -500,16 +506,27 @@ static inline RtemsBarrierReqRelease_Entry RtemsBarrierReqRelease_PopEntry(
];
}
static void RtemsBarrierReqRelease_SetPreConditionStates(
RtemsBarrierReqRelease_Context *ctx
)
{
ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
if ( ctx->Map.entry.Pre_Waiting_NA ) {
ctx->Map.pcs[ 2 ] = RtemsBarrierReqRelease_Pre_Waiting_NA;
} else {
ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
}
}
static void RtemsBarrierReqRelease_TestVariant(
RtemsBarrierReqRelease_Context *ctx
)
{
RtemsBarrierReqRelease_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
RtemsBarrierReqRelease_Pre_Released_Prepare( ctx, ctx->Map.pcs[ 1 ] );
RtemsBarrierReqRelease_Pre_Waiting_Prepare(
ctx,
ctx->Map.entry.Pre_Waiting_NA ? RtemsBarrierReqRelease_Pre_Waiting_NA : ctx->Map.pcs[ 2 ]
);
RtemsBarrierReqRelease_Pre_Waiting_Prepare( ctx, ctx->Map.pcs[ 2 ] );
RtemsBarrierReqRelease_Action( ctx );
RtemsBarrierReqRelease_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
RtemsBarrierReqRelease_Post_ReleasedVar_Check(
@@ -530,21 +547,22 @@ T_TEST_CASE_FIXTURE( RtemsBarrierReqRelease, &RtemsBarrierReqRelease_Fixture )
ctx->Map.index = 0;
for (
ctx->Map.pcs[ 0 ] = RtemsBarrierReqRelease_Pre_Id_NoObj;
ctx->Map.pcs[ 0 ] < RtemsBarrierReqRelease_Pre_Id_NA;
++ctx->Map.pcs[ 0 ]
ctx->Map.pci[ 0 ] = RtemsBarrierReqRelease_Pre_Id_NoObj;
ctx->Map.pci[ 0 ] < RtemsBarrierReqRelease_Pre_Id_NA;
++ctx->Map.pci[ 0 ]
) {
for (
ctx->Map.pcs[ 1 ] = RtemsBarrierReqRelease_Pre_Released_Valid;
ctx->Map.pcs[ 1 ] < RtemsBarrierReqRelease_Pre_Released_NA;
++ctx->Map.pcs[ 1 ]
ctx->Map.pci[ 1 ] = RtemsBarrierReqRelease_Pre_Released_Valid;
ctx->Map.pci[ 1 ] < RtemsBarrierReqRelease_Pre_Released_NA;
++ctx->Map.pci[ 1 ]
) {
for (
ctx->Map.pcs[ 2 ] = RtemsBarrierReqRelease_Pre_Waiting_Zero;
ctx->Map.pcs[ 2 ] < RtemsBarrierReqRelease_Pre_Waiting_NA;
++ctx->Map.pcs[ 2 ]
ctx->Map.pci[ 2 ] = RtemsBarrierReqRelease_Pre_Waiting_Zero;
ctx->Map.pci[ 2 ] < RtemsBarrierReqRelease_Pre_Waiting_NA;
++ctx->Map.pci[ 2 ]
) {
ctx->Map.entry = RtemsBarrierReqRelease_PopEntry( ctx );
RtemsBarrierReqRelease_SetPreConditionStates( ctx );
RtemsBarrierReqRelease_TestVariant( ctx );
}
}
+54 -22
View File
@@ -62,7 +62,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierReqWait spec:/rtems/barrier/req/wait
*
* @ingroup RTEMSTestSuiteTestsuitesValidation0
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
@@ -126,6 +126,12 @@ typedef struct {
rtems_status_code status;
struct {
/**
* @brief This member defines the pre-condition indices for the next
* action.
*/
size_t pci[ 3 ];
/**
* @brief This member defines the pre-condition states for the next action.
*/
@@ -187,7 +193,7 @@ static const char * const * const RtemsBarrierReqWait_PreDesc[] = {
#define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
#define EVENT_CHECK_TIMER RTEMS_EVENT_0
#define EVENT_TIMER_INACTIVE RTEMS_EVENT_0
#define EVENT_WAIT RTEMS_EVENT_1
@@ -195,6 +201,8 @@ static const char * const * const RtemsBarrierReqWait_PreDesc[] = {
#define EVENT_DELETE RTEMS_EVENT_3
#define EVENT_TIMER_EXPIRE RTEMS_EVENT_4
typedef RtemsBarrierReqWait_Context Context;
static void Worker( rtems_task_argument arg )
@@ -209,7 +217,7 @@ static void Worker( rtems_task_argument arg )
events = ReceiveAnyEvents();
if ( ( events & EVENT_CHECK_TIMER ) != 0 ) {
if ( ( events & EVENT_TIMER_INACTIVE ) != 0 ) {
T_eq_int(
T_get_thread_timer_state( ctx->main_id ),
T_THREAD_TIMER_INACTIVE
@@ -256,6 +264,14 @@ static void Worker( rtems_task_argument arg )
prio = SetSelfPriority( prio );
T_eq_u32( prio, PRIO_HIGH );
}
if ( ( events & EVENT_TIMER_EXPIRE ) != 0 ) {
T_eq_int(
T_get_thread_timer_state( ctx->main_id ),
T_THREAD_TIMER_SCHEDULED
);
FinalClockTick();
}
}
}
@@ -306,7 +322,7 @@ static void RtemsBarrierReqWait_Pre_Timeout_Prepare(
/*
* While the ``released`` parameter is a clock tick interval.
*/
ctx->timeout = 2;
ctx->timeout = UINT32_MAX;
break;
}
@@ -335,7 +351,9 @@ static void RtemsBarrierReqWait_Pre_Satisfy_Prepare(
* released or deleted.
*/
if ( ctx->timeout == RTEMS_NO_TIMEOUT ) {
SendEvents( ctx->low_worker_id, EVENT_CHECK_TIMER | EVENT_RELEASE );
SendEvents( ctx->low_worker_id, EVENT_TIMER_INACTIVE | EVENT_RELEASE );
} else {
SendEvents( ctx->low_worker_id, EVENT_TIMER_EXPIRE );
}
break;
}
@@ -544,17 +562,30 @@ static inline RtemsBarrierReqWait_Entry RtemsBarrierReqWait_PopEntry(
];
}
static void RtemsBarrierReqWait_SetPreConditionStates(
RtemsBarrierReqWait_Context *ctx
)
{
ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
if ( ctx->Map.entry.Pre_Timeout_NA ) {
ctx->Map.pcs[ 1 ] = RtemsBarrierReqWait_Pre_Timeout_NA;
} else {
ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
}
if ( ctx->Map.entry.Pre_Satisfy_NA ) {
ctx->Map.pcs[ 2 ] = RtemsBarrierReqWait_Pre_Satisfy_NA;
} else {
ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
}
}
static void RtemsBarrierReqWait_TestVariant( RtemsBarrierReqWait_Context *ctx )
{
RtemsBarrierReqWait_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
RtemsBarrierReqWait_Pre_Timeout_Prepare(
ctx,
ctx->Map.entry.Pre_Timeout_NA ? RtemsBarrierReqWait_Pre_Timeout_NA : ctx->Map.pcs[ 1 ]
);
RtemsBarrierReqWait_Pre_Satisfy_Prepare(
ctx,
ctx->Map.entry.Pre_Satisfy_NA ? RtemsBarrierReqWait_Pre_Satisfy_NA : ctx->Map.pcs[ 2 ]
);
RtemsBarrierReqWait_Pre_Timeout_Prepare( ctx, ctx->Map.pcs[ 1 ] );
RtemsBarrierReqWait_Pre_Satisfy_Prepare( ctx, ctx->Map.pcs[ 2 ] );
RtemsBarrierReqWait_Action( ctx );
RtemsBarrierReqWait_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
}
@@ -571,19 +602,19 @@ T_TEST_CASE_FIXTURE( RtemsBarrierReqWait, &RtemsBarrierReqWait_Fixture )
ctx->Map.index = 0;
for (
ctx->Map.pcs[ 0 ] = RtemsBarrierReqWait_Pre_Id_NoObj;
ctx->Map.pcs[ 0 ] < RtemsBarrierReqWait_Pre_Id_NA;
++ctx->Map.pcs[ 0 ]
ctx->Map.pci[ 0 ] = RtemsBarrierReqWait_Pre_Id_NoObj;
ctx->Map.pci[ 0 ] < RtemsBarrierReqWait_Pre_Id_NA;
++ctx->Map.pci[ 0 ]
) {
for (
ctx->Map.pcs[ 1 ] = RtemsBarrierReqWait_Pre_Timeout_Ticks;
ctx->Map.pcs[ 1 ] < RtemsBarrierReqWait_Pre_Timeout_NA;
++ctx->Map.pcs[ 1 ]
ctx->Map.pci[ 1 ] = RtemsBarrierReqWait_Pre_Timeout_Ticks;
ctx->Map.pci[ 1 ] < RtemsBarrierReqWait_Pre_Timeout_NA;
++ctx->Map.pci[ 1 ]
) {
for (
ctx->Map.pcs[ 2 ] = RtemsBarrierReqWait_Pre_Satisfy_Never;
ctx->Map.pcs[ 2 ] < RtemsBarrierReqWait_Pre_Satisfy_NA;
++ctx->Map.pcs[ 2 ]
ctx->Map.pci[ 2 ] = RtemsBarrierReqWait_Pre_Satisfy_Never;
ctx->Map.pci[ 2 ] < RtemsBarrierReqWait_Pre_Satisfy_NA;
++ctx->Map.pci[ 2 ]
) {
ctx->Map.entry = RtemsBarrierReqWait_PopEntry( ctx );
@@ -591,6 +622,7 @@ T_TEST_CASE_FIXTURE( RtemsBarrierReqWait, &RtemsBarrierReqWait_Fixture )
continue;
}
RtemsBarrierReqWait_SetPreConditionStates( ctx );
RtemsBarrierReqWait_TestVariant( ctx );
}
}