validation: Test Scheduler 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:49 +01:00
parent 98091b6d88
commit 1c87bb585f
13 changed files with 5540 additions and 0 deletions
@@ -54,6 +54,14 @@ source:
- testsuites/validation/tc-ratemon-ident.c
- testsuites/validation/tc-ratemon-period.c
- testsuites/validation/tc-ratemon-timeout.c
- testsuites/validation/tc-scheduler-add-processor.c
- testsuites/validation/tc-scheduler.c
- testsuites/validation/tc-scheduler-get-maximum-priority.c
- testsuites/validation/tc-scheduler-get-processor-set.c
- testsuites/validation/tc-scheduler-ident-by-processor.c
- testsuites/validation/tc-scheduler-ident-by-processor-set.c
- testsuites/validation/tc-scheduler-ident.c
- testsuites/validation/tc-scheduler-remove-processor.c
- testsuites/validation/tc-score-fatal.c
- testsuites/validation/tr-event-constant.c
- testsuites/validation/tr-mtx-seize-try.c
@@ -13,6 +13,7 @@ ldflags: []
links: []
source:
- testsuites/validation/tc-intr-non-smp.c
- testsuites/validation/tc-scheduler-non-smp.c
- testsuites/validation/ts-validation-non-smp.c
stlib: []
target: testsuites/validation/ts-validation-non-smp.exe
@@ -16,6 +16,7 @@ source:
- testsuites/validation/tc-acfg-scheduler-edf-smp.c
- testsuites/validation/tc-bsp-interrupt-spurious.c
- testsuites/validation/tc-intr-smp-only.c
- testsuites/validation/tc-scheduler-smp-only.c
- testsuites/validation/tc-score-tq-smp.c
- testsuites/validation/ts-validation-smp-only-0.c
stlib: []
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,463 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestCaseRtemsSchedulerReqGetMaximumPriority
*/
/*
* Copyright (C) 2021 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 <limits.h>
#include <rtems.h>
#include "ts-config.h"
#include "tx-support.h"
#include <rtems/test.h>
/**
* @defgroup RTEMSTestCaseRtemsSchedulerReqGetMaximumPriority \
* spec:/rtems/scheduler/req/get-maximum-priority
*
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
typedef enum {
RtemsSchedulerReqGetMaximumPriority_Pre_Id_Invalid,
RtemsSchedulerReqGetMaximumPriority_Pre_Id_Scheduler,
RtemsSchedulerReqGetMaximumPriority_Pre_Id_NA
} RtemsSchedulerReqGetMaximumPriority_Pre_Id;
typedef enum {
RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Valid,
RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Null,
RtemsSchedulerReqGetMaximumPriority_Pre_Prio_NA
} RtemsSchedulerReqGetMaximumPriority_Pre_Prio;
typedef enum {
RtemsSchedulerReqGetMaximumPriority_Post_Status_Ok,
RtemsSchedulerReqGetMaximumPriority_Post_Status_InvAddr,
RtemsSchedulerReqGetMaximumPriority_Post_Status_InvId,
RtemsSchedulerReqGetMaximumPriority_Post_Status_NA
} RtemsSchedulerReqGetMaximumPriority_Post_Status;
typedef enum {
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Set,
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Nop,
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_NA
} RtemsSchedulerReqGetMaximumPriority_Post_PrioObj;
typedef struct {
uint8_t Skip : 1;
uint8_t Pre_Id_NA : 1;
uint8_t Pre_Prio_NA : 1;
uint8_t Post_Status : 2;
uint8_t Post_PrioObj : 2;
} RtemsSchedulerReqGetMaximumPriority_Entry;
/**
* @brief Test context for spec:/rtems/scheduler/req/get-maximum-priority test
* case.
*/
typedef struct {
/**
* @brief This member contains the identifier of a scheduler.
*/
rtems_id scheduler_id;
/**
* @brief This member provides the object referenced by the ``priority``
* parameter.
*/
rtems_task_priority priority_obj;
/**
* @brief This member contains the return value of the
* rtems_scheduler_get_maximum_priority() call.
*/
rtems_status_code status;
/**
* @brief This member specifies if the ``scheduler_id`` parameter value.
*/
rtems_id id;
/**
* @brief This member specifies if the ``priority`` parameter value.
*/
rtems_task_priority *priority;
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.
*/
RtemsSchedulerReqGetMaximumPriority_Entry entry;
/**
* @brief If this member is true, then the current transition variant
* should be skipped.
*/
bool skip;
} Map;
} RtemsSchedulerReqGetMaximumPriority_Context;
static RtemsSchedulerReqGetMaximumPriority_Context
RtemsSchedulerReqGetMaximumPriority_Instance;
static const char * const RtemsSchedulerReqGetMaximumPriority_PreDesc_Id[] = {
"Invalid",
"Scheduler",
"NA"
};
static const char * const RtemsSchedulerReqGetMaximumPriority_PreDesc_Prio[] = {
"Valid",
"Null",
"NA"
};
static const char * const * const RtemsSchedulerReqGetMaximumPriority_PreDesc[] = {
RtemsSchedulerReqGetMaximumPriority_PreDesc_Id,
RtemsSchedulerReqGetMaximumPriority_PreDesc_Prio,
NULL
};
static void RtemsSchedulerReqGetMaximumPriority_Pre_Id_Prepare(
RtemsSchedulerReqGetMaximumPriority_Context *ctx,
RtemsSchedulerReqGetMaximumPriority_Pre_Id state
)
{
switch ( state ) {
case RtemsSchedulerReqGetMaximumPriority_Pre_Id_Invalid: {
/*
* While the ``scheduler_id`` parameter is not associated with a
* scheduler.
*/
ctx->id = INVALID_ID;
break;
}
case RtemsSchedulerReqGetMaximumPriority_Pre_Id_Scheduler: {
/*
* While the ``scheduler_id`` parameter is associated with a scheduler.
*/
ctx->id = ctx->scheduler_id;
break;
}
case RtemsSchedulerReqGetMaximumPriority_Pre_Id_NA:
break;
}
}
static void RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Prepare(
RtemsSchedulerReqGetMaximumPriority_Context *ctx,
RtemsSchedulerReqGetMaximumPriority_Pre_Prio state
)
{
switch ( state ) {
case RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Valid: {
/*
* While the ``priority`` parameter references an object of type
* rtems_task_priority.
*/
ctx->priority = &ctx->priority_obj;
break;
}
case RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Null: {
/*
* While the ``priority`` parameter is equal to NULL.
*/
ctx->priority = NULL;
break;
}
case RtemsSchedulerReqGetMaximumPriority_Pre_Prio_NA:
break;
}
}
static void RtemsSchedulerReqGetMaximumPriority_Post_Status_Check(
RtemsSchedulerReqGetMaximumPriority_Context *ctx,
RtemsSchedulerReqGetMaximumPriority_Post_Status state
)
{
switch ( state ) {
case RtemsSchedulerReqGetMaximumPriority_Post_Status_Ok: {
/*
* The return status of rtems_scheduler_get_maximum_priority() shall be
* RTEMS_SUCCESSFUL.
*/
T_rsc_success( ctx->status );
break;
}
case RtemsSchedulerReqGetMaximumPriority_Post_Status_InvAddr: {
/*
* The return status of rtems_scheduler_get_maximum_priority() shall be
* RTEMS_INVALID_ADDRESS.
*/
T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
break;
}
case RtemsSchedulerReqGetMaximumPriority_Post_Status_InvId: {
/*
* The return status of rtems_scheduler_get_maximum_priority() shall be
* RTEMS_INVALID_ID.
*/
T_rsc( ctx->status, RTEMS_INVALID_ID );
break;
}
case RtemsSchedulerReqGetMaximumPriority_Post_Status_NA:
break;
}
}
static void RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Check(
RtemsSchedulerReqGetMaximumPriority_Context *ctx,
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj state
)
{
switch ( state ) {
case RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Set: {
/*
* The value of the object referenced by the ``priority`` parameter shall
* be set to the maximum priority value of the scheduler specified by the
* ``scheduler_id`` parameter after the return of the
* rtems_scheduler_get_maximum_priority() call.
*/
#if defined(RTEMS_SMP)
T_eq_u32( ctx->priority_obj, INT_MAX );
#else
T_eq_u32( ctx->priority_obj, 127 );
#endif
break;
}
case RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Nop: {
/*
* Objects referenced by the ``priority`` parameter in past calls to
* rtems_scheduler_get_maximum_priority() shall not be accessed by the
* rtems_scheduler_get_maximum_priority() call.
*/
T_eq_u32( ctx->priority_obj, PRIO_INVALID );
break;
}
case RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_NA:
break;
}
}
static void RtemsSchedulerReqGetMaximumPriority_Setup(
RtemsSchedulerReqGetMaximumPriority_Context *ctx
)
{
rtems_status_code sc;
sc = rtems_scheduler_ident(
TEST_SCHEDULER_A_NAME,
&ctx->scheduler_id
);
T_rsc_success( sc );
}
static void RtemsSchedulerReqGetMaximumPriority_Setup_Wrap( void *arg )
{
RtemsSchedulerReqGetMaximumPriority_Context *ctx;
ctx = arg;
ctx->Map.in_action_loop = false;
RtemsSchedulerReqGetMaximumPriority_Setup( ctx );
}
static void RtemsSchedulerReqGetMaximumPriority_Prepare(
RtemsSchedulerReqGetMaximumPriority_Context *ctx
)
{
ctx->priority_obj = PRIO_INVALID;
}
static void RtemsSchedulerReqGetMaximumPriority_Action(
RtemsSchedulerReqGetMaximumPriority_Context *ctx
)
{
ctx->status = rtems_scheduler_get_maximum_priority( ctx->id, ctx->priority );
}
static const RtemsSchedulerReqGetMaximumPriority_Entry
RtemsSchedulerReqGetMaximumPriority_Entries[] = {
{ 0, 0, 0, RtemsSchedulerReqGetMaximumPriority_Post_Status_InvAddr,
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Nop },
{ 0, 0, 0, RtemsSchedulerReqGetMaximumPriority_Post_Status_InvId,
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Nop },
{ 0, 0, 0, RtemsSchedulerReqGetMaximumPriority_Post_Status_Ok,
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Set }
};
static const uint8_t
RtemsSchedulerReqGetMaximumPriority_Map[] = {
1, 0, 2, 0
};
static size_t RtemsSchedulerReqGetMaximumPriority_Scope(
void *arg,
char *buf,
size_t n
)
{
RtemsSchedulerReqGetMaximumPriority_Context *ctx;
ctx = arg;
if ( ctx->Map.in_action_loop ) {
return T_get_scope(
RtemsSchedulerReqGetMaximumPriority_PreDesc,
buf,
n,
ctx->Map.pcs
);
}
return 0;
}
static T_fixture RtemsSchedulerReqGetMaximumPriority_Fixture = {
.setup = RtemsSchedulerReqGetMaximumPriority_Setup_Wrap,
.stop = NULL,
.teardown = NULL,
.scope = RtemsSchedulerReqGetMaximumPriority_Scope,
.initial_context = &RtemsSchedulerReqGetMaximumPriority_Instance
};
static inline RtemsSchedulerReqGetMaximumPriority_Entry
RtemsSchedulerReqGetMaximumPriority_PopEntry(
RtemsSchedulerReqGetMaximumPriority_Context *ctx
)
{
size_t index;
index = ctx->Map.index;
ctx->Map.index = index + 1;
return RtemsSchedulerReqGetMaximumPriority_Entries[
RtemsSchedulerReqGetMaximumPriority_Map[ index ]
];
}
static void RtemsSchedulerReqGetMaximumPriority_TestVariant(
RtemsSchedulerReqGetMaximumPriority_Context *ctx
)
{
RtemsSchedulerReqGetMaximumPriority_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Prepare(
ctx,
ctx->Map.pcs[ 1 ]
);
RtemsSchedulerReqGetMaximumPriority_Action( ctx );
RtemsSchedulerReqGetMaximumPriority_Post_Status_Check(
ctx,
ctx->Map.entry.Post_Status
);
RtemsSchedulerReqGetMaximumPriority_Post_PrioObj_Check(
ctx,
ctx->Map.entry.Post_PrioObj
);
}
/**
* @fn void T_case_body_RtemsSchedulerReqGetMaximumPriority( void )
*/
T_TEST_CASE_FIXTURE(
RtemsSchedulerReqGetMaximumPriority,
&RtemsSchedulerReqGetMaximumPriority_Fixture
)
{
RtemsSchedulerReqGetMaximumPriority_Context *ctx;
ctx = T_fixture_context();
ctx->Map.in_action_loop = true;
ctx->Map.index = 0;
for (
ctx->Map.pcs[ 0 ] = RtemsSchedulerReqGetMaximumPriority_Pre_Id_Invalid;
ctx->Map.pcs[ 0 ] < RtemsSchedulerReqGetMaximumPriority_Pre_Id_NA;
++ctx->Map.pcs[ 0 ]
) {
for (
ctx->Map.pcs[ 1 ] = RtemsSchedulerReqGetMaximumPriority_Pre_Prio_Valid;
ctx->Map.pcs[ 1 ] < RtemsSchedulerReqGetMaximumPriority_Pre_Prio_NA;
++ctx->Map.pcs[ 1 ]
) {
ctx->Map.entry = RtemsSchedulerReqGetMaximumPriority_PopEntry( ctx );
RtemsSchedulerReqGetMaximumPriority_Prepare( ctx );
RtemsSchedulerReqGetMaximumPriority_TestVariant( ctx );
}
}
}
/** @} */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+406
View File
@@ -0,0 +1,406 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestCaseRtemsSchedulerReqIdent
*/
/*
* Copyright (C) 2021 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 "ts-config.h"
#include "tx-support.h"
#include <rtems/test.h>
/**
* @defgroup RTEMSTestCaseRtemsSchedulerReqIdent \
* spec:/rtems/scheduler/req/ident
*
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
typedef enum {
RtemsSchedulerReqIdent_Pre_Name_Invalid,
RtemsSchedulerReqIdent_Pre_Name_Valid,
RtemsSchedulerReqIdent_Pre_Name_NA
} RtemsSchedulerReqIdent_Pre_Name;
typedef enum {
RtemsSchedulerReqIdent_Pre_Id_Valid,
RtemsSchedulerReqIdent_Pre_Id_Null,
RtemsSchedulerReqIdent_Pre_Id_NA
} RtemsSchedulerReqIdent_Pre_Id;
typedef enum {
RtemsSchedulerReqIdent_Post_Status_Ok,
RtemsSchedulerReqIdent_Post_Status_InvAddr,
RtemsSchedulerReqIdent_Post_Status_InvName,
RtemsSchedulerReqIdent_Post_Status_NA
} RtemsSchedulerReqIdent_Post_Status;
typedef enum {
RtemsSchedulerReqIdent_Post_IdVar_Set,
RtemsSchedulerReqIdent_Post_IdVar_Nop,
RtemsSchedulerReqIdent_Post_IdVar_NA
} RtemsSchedulerReqIdent_Post_IdVar;
typedef struct {
uint8_t Skip : 1;
uint8_t Pre_Name_NA : 1;
uint8_t Pre_Id_NA : 1;
uint8_t Post_Status : 2;
uint8_t Post_IdVar : 2;
} RtemsSchedulerReqIdent_Entry;
/**
* @brief Test context for spec:/rtems/scheduler/req/ident test case.
*/
typedef struct {
/**
* @brief This member provides the object referenced by the ``id`` parameter.
*/
rtems_id id_value;
/**
* @brief This member contains the return value of the
* rtems_scheduler_ident() call.
*/
rtems_status_code status;
/**
* @brief This member specifies if the ``name`` parameter value.
*/
rtems_name name;
/**
* @brief This member specifies if the ``id`` parameter value.
*/
rtems_id *id;
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.
*/
RtemsSchedulerReqIdent_Entry entry;
/**
* @brief If this member is true, then the current transition variant
* should be skipped.
*/
bool skip;
} Map;
} RtemsSchedulerReqIdent_Context;
static RtemsSchedulerReqIdent_Context
RtemsSchedulerReqIdent_Instance;
static const char * const RtemsSchedulerReqIdent_PreDesc_Name[] = {
"Invalid",
"Valid",
"NA"
};
static const char * const RtemsSchedulerReqIdent_PreDesc_Id[] = {
"Valid",
"Null",
"NA"
};
static const char * const * const RtemsSchedulerReqIdent_PreDesc[] = {
RtemsSchedulerReqIdent_PreDesc_Name,
RtemsSchedulerReqIdent_PreDesc_Id,
NULL
};
static void RtemsSchedulerReqIdent_Pre_Name_Prepare(
RtemsSchedulerReqIdent_Context *ctx,
RtemsSchedulerReqIdent_Pre_Name state
)
{
switch ( state ) {
case RtemsSchedulerReqIdent_Pre_Name_Invalid: {
/*
* While the ``name`` parameter is not associated with a scheduler.
*/
ctx->name = 0;
break;
}
case RtemsSchedulerReqIdent_Pre_Name_Valid: {
/*
* While the ``name`` parameter is associated with a scheduler.
*/
ctx->name = TEST_SCHEDULER_A_NAME;
break;
}
case RtemsSchedulerReqIdent_Pre_Name_NA:
break;
}
}
static void RtemsSchedulerReqIdent_Pre_Id_Prepare(
RtemsSchedulerReqIdent_Context *ctx,
RtemsSchedulerReqIdent_Pre_Id state
)
{
switch ( state ) {
case RtemsSchedulerReqIdent_Pre_Id_Valid: {
/*
* While the ``id`` parameter references an object of type rtems_id.
*/
ctx->id = &ctx->id_value;
break;
}
case RtemsSchedulerReqIdent_Pre_Id_Null: {
/*
* While the ``id`` parameter is equal to NULL.
*/
ctx->id = NULL;
break;
}
case RtemsSchedulerReqIdent_Pre_Id_NA:
break;
}
}
static void RtemsSchedulerReqIdent_Post_Status_Check(
RtemsSchedulerReqIdent_Context *ctx,
RtemsSchedulerReqIdent_Post_Status state
)
{
switch ( state ) {
case RtemsSchedulerReqIdent_Post_Status_Ok: {
/*
* The return status of rtems_scheduler_ident() shall be
* RTEMS_SUCCESSFUL.
*/
T_rsc_success( ctx->status );
break;
}
case RtemsSchedulerReqIdent_Post_Status_InvAddr: {
/*
* The return status of rtems_scheduler_ident() shall be
* RTEMS_INVALID_ADDRESS.
*/
T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
break;
}
case RtemsSchedulerReqIdent_Post_Status_InvName: {
/*
* The return status of rtems_scheduler_ident() shall be
* RTEMS_INVALID_NAME.
*/
T_rsc( ctx->status, RTEMS_INVALID_NAME );
break;
}
case RtemsSchedulerReqIdent_Post_Status_NA:
break;
}
}
static void RtemsSchedulerReqIdent_Post_IdVar_Check(
RtemsSchedulerReqIdent_Context *ctx,
RtemsSchedulerReqIdent_Post_IdVar state
)
{
switch ( state ) {
case RtemsSchedulerReqIdent_Post_IdVar_Set: {
/*
* The value of the object referenced by the ``id`` parameter shall be
* set to the identifier of the scheduler with the lowest scheduler index
* and a name equal to the ``name`` parameter after the return of the
* rtems_scheduler_ident() call.
*/
T_eq_ptr( ctx->id, &ctx->id_value );
T_eq_u32( ctx->id_value, 0x0f010001 );
break;
}
case RtemsSchedulerReqIdent_Post_IdVar_Nop: {
/*
* Objects referenced by the ``id`` parameter in past calls to
* rtems_scheduler_ident() shall not be accessed by the
* rtems_scheduler_ident() call.
*/
T_eq_u32( ctx->id_value, INVALID_ID );
break;
}
case RtemsSchedulerReqIdent_Post_IdVar_NA:
break;
}
}
static void RtemsSchedulerReqIdent_Prepare(
RtemsSchedulerReqIdent_Context *ctx
)
{
ctx->id_value = INVALID_ID;
}
static void RtemsSchedulerReqIdent_Action(
RtemsSchedulerReqIdent_Context *ctx
)
{
ctx->status = rtems_scheduler_ident( ctx->name, ctx->id );
}
static const RtemsSchedulerReqIdent_Entry
RtemsSchedulerReqIdent_Entries[] = {
{ 0, 0, 0, RtemsSchedulerReqIdent_Post_Status_InvAddr,
RtemsSchedulerReqIdent_Post_IdVar_Nop },
{ 0, 0, 0, RtemsSchedulerReqIdent_Post_Status_InvName,
RtemsSchedulerReqIdent_Post_IdVar_Nop },
{ 0, 0, 0, RtemsSchedulerReqIdent_Post_Status_Ok,
RtemsSchedulerReqIdent_Post_IdVar_Set }
};
static const uint8_t
RtemsSchedulerReqIdent_Map[] = {
1, 0, 2, 0
};
static size_t RtemsSchedulerReqIdent_Scope( void *arg, char *buf, size_t n )
{
RtemsSchedulerReqIdent_Context *ctx;
ctx = arg;
if ( ctx->Map.in_action_loop ) {
return T_get_scope( RtemsSchedulerReqIdent_PreDesc, buf, n, ctx->Map.pcs );
}
return 0;
}
static T_fixture RtemsSchedulerReqIdent_Fixture = {
.setup = NULL,
.stop = NULL,
.teardown = NULL,
.scope = RtemsSchedulerReqIdent_Scope,
.initial_context = &RtemsSchedulerReqIdent_Instance
};
static inline RtemsSchedulerReqIdent_Entry RtemsSchedulerReqIdent_PopEntry(
RtemsSchedulerReqIdent_Context *ctx
)
{
size_t index;
index = ctx->Map.index;
ctx->Map.index = index + 1;
return RtemsSchedulerReqIdent_Entries[
RtemsSchedulerReqIdent_Map[ index ]
];
}
static void RtemsSchedulerReqIdent_TestVariant(
RtemsSchedulerReqIdent_Context *ctx
)
{
RtemsSchedulerReqIdent_Pre_Name_Prepare( ctx, ctx->Map.pcs[ 0 ] );
RtemsSchedulerReqIdent_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 1 ] );
RtemsSchedulerReqIdent_Action( ctx );
RtemsSchedulerReqIdent_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
RtemsSchedulerReqIdent_Post_IdVar_Check( ctx, ctx->Map.entry.Post_IdVar );
}
/**
* @fn void T_case_body_RtemsSchedulerReqIdent( void )
*/
T_TEST_CASE_FIXTURE( RtemsSchedulerReqIdent, &RtemsSchedulerReqIdent_Fixture )
{
RtemsSchedulerReqIdent_Context *ctx;
ctx = T_fixture_context();
ctx->Map.in_action_loop = true;
ctx->Map.index = 0;
for (
ctx->Map.pcs[ 0 ] = RtemsSchedulerReqIdent_Pre_Name_Invalid;
ctx->Map.pcs[ 0 ] < RtemsSchedulerReqIdent_Pre_Name_NA;
++ctx->Map.pcs[ 0 ]
) {
for (
ctx->Map.pcs[ 1 ] = RtemsSchedulerReqIdent_Pre_Id_Valid;
ctx->Map.pcs[ 1 ] < RtemsSchedulerReqIdent_Pre_Id_NA;
++ctx->Map.pcs[ 1 ]
) {
ctx->Map.entry = RtemsSchedulerReqIdent_PopEntry( ctx );
RtemsSchedulerReqIdent_Prepare( ctx );
RtemsSchedulerReqIdent_TestVariant( ctx );
}
}
}
/** @} */
@@ -0,0 +1,109 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestCaseRtemsSchedulerValNonSmp
*/
/*
* Copyright (C) 2021 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 RTEMSTestCaseRtemsSchedulerValNonSmp \
* spec:/rtems/scheduler/val/non-smp
*
* @ingroup RTEMSTestSuiteTestsuitesValidationNonSmp
*
* @brief This test case collection provides validation test cases for non-SMP
* requirements of the @ref RTEMSAPIClassicScheduler.
*
* This test case performs the following actions:
*
* - Check that calling rtems_scheduler_get_processor() is a constant
* expression which evaluates to zero.
*
* - Check that calling rtems_scheduler_get_processor_maximum() is a constant
* expression which evaluates to zero.
*
* @{
*/
/**
* @brief Check that calling rtems_scheduler_get_processor() is a constant
* expression which evaluates to zero.
*/
static void RtemsSchedulerValNonSmp_Action_0( void )
{
RTEMS_STATIC_ASSERT( rtems_scheduler_get_processor() == 0, GET_PROCESSOR );
}
/**
* @brief Check that calling rtems_scheduler_get_processor_maximum() is a
* constant expression which evaluates to zero.
*/
static void RtemsSchedulerValNonSmp_Action_1( void )
{
RTEMS_STATIC_ASSERT(
rtems_scheduler_get_processor_maximum() == 1,
GET_PROCESSOR_MAXIMUM
);
}
/**
* @fn void T_case_body_RtemsSchedulerValNonSmp( void )
*/
T_TEST_CASE( RtemsSchedulerValNonSmp )
{
RtemsSchedulerValNonSmp_Action_0();
RtemsSchedulerValNonSmp_Action_1();
}
/** @} */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,244 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestCaseRtemsSchedulerValSmpOnly
*/
/*
* Copyright (C) 2021 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 "ts-config.h"
#include "tx-support.h"
#include <rtems/test.h>
/**
* @defgroup RTEMSTestCaseRtemsSchedulerValSmpOnly \
* spec:/rtems/scheduler/val/smp-only
*
* @ingroup RTEMSTestSuiteTestsuitesValidationSmpOnly0
*
* @brief This test case collection provides validation test cases for SMP-only
* requirements of the @ref RTEMSAPIClassicScheduler.
*
* This test case performs the following actions:
*
* - Call rtems_scheduler_get_processor() on all online processors and check
* the returned value.
*
* - Call rtems_scheduler_get_processor_maximum() and check the returned value.
*
* - Check that the returned value is greater than or equal to one.
*
* - Check that the returned value is less than or equal to
* rtems_configuration_get_maximum_processors().
*
* - Call rtems_scheduler_ident() for each configured scheduler.
*
* - Check that the object index of scheduler A has the expected value.
*
* - Check that the object index of scheduler B has the expected value.
*
* - Check that the object index of scheduler C has the expected value.
*
* - Check that the object index of scheduler D has the expected value.
*
* - Check that processor 0 has scheduler A assigned.
*
* - Check that processor 1 has scheduler B assigned.
*
* - Check that processor 2 has scheduler C assigned if it is present.
*
* - Check that processor 3 has scheduler C assigned if it is present.
*
* @{
*/
/**
* @brief Call rtems_scheduler_get_processor() on all online processors and
* check the returned value.
*/
static void RtemsSchedulerValSmpOnly_Action_0( void )
{
rtems_id scheduler_id;
rtems_task_priority priority;
uint32_t cpu_index;
uint32_t cpu_max;
scheduler_id = GetSelfScheduler();
priority = GetSelfPriority();
cpu_max = rtems_scheduler_get_processor_maximum();
T_step_ge_u32( 0, cpu_max, 1 );
for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) {
rtems_status_code sc;
rtems_id id;
sc = rtems_scheduler_ident_by_processor( cpu_index, &id );
T_quiet_rsc_success( sc );
SetSelfScheduler( id, priority );
SetSelfAffinityOne( cpu_index );
T_quiet_eq_u32( rtems_scheduler_get_processor(), cpu_index );
SetSelfAffinityAll();
}
SetSelfScheduler( scheduler_id, priority );
}
/**
* @brief Call rtems_scheduler_get_processor_maximum() and check the returned
* value.
*/
static void RtemsSchedulerValSmpOnly_Action_1( void )
{
uint32_t cpu_max;
cpu_max = rtems_scheduler_get_processor_maximum();
/*
* Check that the returned value is greater than or equal to one.
*/
T_step_ge_u32( 1, cpu_max, 1 );
/*
* Check that the returned value is less than or equal to
* rtems_configuration_get_maximum_processors().
*/
T_step_le_u32(
2,
cpu_max,
rtems_configuration_get_maximum_processors()
);
}
/**
* @brief Call rtems_scheduler_ident() for each configured scheduler.
*/
static void RtemsSchedulerValSmpOnly_Action_2( void )
{
rtems_status_code sc;
rtems_id id[ 4 ];
rtems_id id_by_cpu;
sc = rtems_scheduler_ident( TEST_SCHEDULER_A_NAME, &id[ 0 ]);
T_step_rsc_success( 3, sc );
sc = rtems_scheduler_ident( TEST_SCHEDULER_B_NAME, &id[ 1 ]);
T_step_rsc_success( 4, sc );
sc = rtems_scheduler_ident( TEST_SCHEDULER_C_NAME, &id[ 2 ]);
T_step_rsc_success( 5, sc );
sc = rtems_scheduler_ident( TEST_SCHEDULER_D_NAME, &id[ 3 ]);
T_step_rsc_success( 6, sc );
/*
* Check that the object index of scheduler A has the expected value.
*/
T_step_eq_u16( 7, rtems_object_id_get_index( id[ 0 ] ), 1 );
/*
* Check that the object index of scheduler B has the expected value.
*/
T_step_eq_u16( 8, rtems_object_id_get_index( id[ 1 ] ), 2 );
/*
* Check that the object index of scheduler C has the expected value.
*/
T_step_eq_u16( 9, rtems_object_id_get_index( id[ 2 ] ), 3 );
/*
* Check that the object index of scheduler D has the expected value.
*/
T_step_eq_u16( 10, rtems_object_id_get_index( id[ 3 ] ), 4 );
/*
* Check that processor 0 has scheduler A assigned.
*/
sc = rtems_scheduler_ident_by_processor( 0, &id_by_cpu );
T_step_rsc_success( 11, sc );
T_step_eq_u32( 12, id[ 0 ], id_by_cpu );
/*
* Check that processor 1 has scheduler B assigned.
*/
sc = rtems_scheduler_ident_by_processor( 1, &id_by_cpu );
T_step_rsc_success( 13, sc );
T_step_eq_u32( 14, id[ 1 ], id_by_cpu );
/*
* Check that processor 2 has scheduler C assigned if it is present.
*/
sc = rtems_scheduler_ident_by_processor( 2, &id_by_cpu );
T_step_true( 15, sc == RTEMS_INVALID_NAME || id[ 2 ] == id_by_cpu );
/*
* Check that processor 3 has scheduler C assigned if it is present.
*/
sc = rtems_scheduler_ident_by_processor( 3, &id_by_cpu );
T_step_true( 16, sc == RTEMS_INVALID_NAME || id[ 2 ] == id_by_cpu );
}
/**
* @fn void T_case_body_RtemsSchedulerValSmpOnly( void )
*/
T_TEST_CASE( RtemsSchedulerValSmpOnly )
{
T_plan( 17 );
RtemsSchedulerValSmpOnly_Action_0();
RtemsSchedulerValSmpOnly_Action_1();
RtemsSchedulerValSmpOnly_Action_2();
}
/** @} */
+157
View File
@@ -0,0 +1,157 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSTestCaseRtemsSchedulerValScheduler
*/
/*
* Copyright (C) 2021 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 "tx-support.h"
#include <rtems/test.h>
/**
* @defgroup RTEMSTestCaseRtemsSchedulerValScheduler \
* spec:/rtems/scheduler/val/scheduler
*
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @brief This test case collection provides validation test cases for general
* requirements of the @ref RTEMSAPIClassicScheduler.
*
* This test case performs the following actions:
*
* - Validate rtems_scheduler_get_processor().
*
* - Check that the values returned by rtems_scheduler_get_processor() and
* rtems_scheduler_get_processor() are equal.
*
* - Validate rtems_scheduler_get_processor_maximum().
*
* - Check that the values returned by
* rtems_scheduler_get_processor_maximum() and
* rtems_scheduler_get_processor_maximum() are equal.
*
* @{
*/
static uint32_t GetProcessorMaximumMacro( void )
{
return rtems_scheduler_get_processor_maximum();
}
#undef rtems_scheduler_get_processor_maximum
static uint32_t GetProcessorMaximum( void )
{
return rtems_scheduler_get_processor_maximum();
}
static uint32_t GetProcessorMacro( void )
{
return rtems_scheduler_get_processor();
}
#undef rtems_scheduler_get_processor
static uint32_t GetProcessor( void )
{
return rtems_scheduler_get_processor();
}
/**
* @brief Validate rtems_scheduler_get_processor().
*/
static void RtemsSchedulerValScheduler_Action_0( void )
{
uint32_t cpu_index;
uint32_t cpu_index_macro;
cpu_index = GetProcessor();
cpu_index_macro = GetProcessorMacro();
/*
* Check that the values returned by rtems_scheduler_get_processor() and
* rtems_scheduler_get_processor() are equal.
*/
T_step_eq_u32( 0, cpu_index, cpu_index_macro );
}
/**
* @brief Validate rtems_scheduler_get_processor_maximum().
*/
static void RtemsSchedulerValScheduler_Action_1( void )
{
uint32_t cpu_max;
uint32_t cpu_max_macro;
cpu_max = GetProcessorMaximum();
cpu_max_macro = GetProcessorMaximumMacro();
/*
* Check that the values returned by rtems_scheduler_get_processor_maximum()
* and rtems_scheduler_get_processor_maximum() are equal.
*/
T_step_eq_u32( 1, cpu_max, cpu_max_macro );
}
/**
* @fn void T_case_body_RtemsSchedulerValScheduler( void )
*/
T_TEST_CASE( RtemsSchedulerValScheduler )
{
T_plan( 2 );
RtemsSchedulerValScheduler_Action_0();
RtemsSchedulerValScheduler_Action_1();
}
/** @} */