summaryrefslogtreecommitdiffstats
path: root/testsuites/validation
diff options
context:
space:
mode:
authorFrank Kühndel <frank.kuehndel@embedded-brains.de>2021-12-09 16:14:37 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-03-24 11:10:49 +0100
commit98091b6d88316dbec4c5a3ee0918e46d8352bfeb (patch)
treed856775fdccf738f5354c062bcee903fb7b1ee67 /testsuites/validation
parentvalidation: Test Partition Manager (diff)
downloadrtems-98091b6d88316dbec4c5a3ee0918e46d8352bfeb.tar.bz2
validation: Test Rate Monotonic 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.
Diffstat (limited to 'testsuites/validation')
-rw-r--r--testsuites/validation/tc-ratemon-cancel.c882
-rw-r--r--testsuites/validation/tc-ratemon-create.c529
-rw-r--r--testsuites/validation/tc-ratemon-delete.c368
-rw-r--r--testsuites/validation/tc-ratemon-get-status.c1171
-rw-r--r--testsuites/validation/tc-ratemon-ident.c114
-rw-r--r--testsuites/validation/tc-ratemon-period.c1273
-rw-r--r--testsuites/validation/tc-ratemon-timeout.c962
7 files changed, 5299 insertions, 0 deletions
diff --git a/testsuites/validation/tc-ratemon-cancel.c b/testsuites/validation/tc-ratemon-cancel.c
new file mode 100644
index 0000000000..7cbbbcda7d
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-cancel.c
@@ -0,0 +1,882 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonReqCancel
+ */
+
+/*
+ * 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 RTEMSTestCaseRtemsRatemonReqCancel spec:/rtems/ratemon/req/cancel
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationOneCpu0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsRatemonReqCancel_Pre_Id_Valid,
+ RtemsRatemonReqCancel_Pre_Id_Invalid,
+ RtemsRatemonReqCancel_Pre_Id_NA
+} RtemsRatemonReqCancel_Pre_Id;
+
+typedef enum {
+ RtemsRatemonReqCancel_Pre_Caller_OwnerTask,
+ RtemsRatemonReqCancel_Pre_Caller_OtherTask,
+ RtemsRatemonReqCancel_Pre_Caller_NA
+} RtemsRatemonReqCancel_Pre_Caller;
+
+typedef enum {
+ RtemsRatemonReqCancel_Pre_State_Inactive,
+ RtemsRatemonReqCancel_Pre_State_Active,
+ RtemsRatemonReqCancel_Pre_State_Expired,
+ RtemsRatemonReqCancel_Pre_State_NA
+} RtemsRatemonReqCancel_Pre_State;
+
+typedef enum {
+ RtemsRatemonReqCancel_Pre_Postponed_Zero,
+ RtemsRatemonReqCancel_Pre_Postponed_One,
+ RtemsRatemonReqCancel_Pre_Postponed_Several,
+ RtemsRatemonReqCancel_Pre_Postponed_NA
+} RtemsRatemonReqCancel_Pre_Postponed;
+
+typedef enum {
+ RtemsRatemonReqCancel_Post_Status_Ok,
+ RtemsRatemonReqCancel_Post_Status_InvId,
+ RtemsRatemonReqCancel_Post_Status_NotOwn,
+ RtemsRatemonReqCancel_Post_Status_NA
+} RtemsRatemonReqCancel_Post_Status;
+
+typedef enum {
+ RtemsRatemonReqCancel_Post_State_Inactive,
+ RtemsRatemonReqCancel_Post_State_Nop,
+ RtemsRatemonReqCancel_Post_State_NA
+} RtemsRatemonReqCancel_Post_State;
+
+typedef enum {
+ RtemsRatemonReqCancel_Post_Postponed_Zero,
+ RtemsRatemonReqCancel_Post_Postponed_Nop,
+ RtemsRatemonReqCancel_Post_Postponed_NA
+} RtemsRatemonReqCancel_Post_Postponed;
+
+typedef enum {
+ RtemsRatemonReqCancel_Post_Scheduler_Called,
+ RtemsRatemonReqCancel_Post_Scheduler_Nop,
+ RtemsRatemonReqCancel_Post_Scheduler_NA
+} RtemsRatemonReqCancel_Post_Scheduler;
+
+typedef struct {
+ uint16_t Skip : 1;
+ uint16_t Pre_Id_NA : 1;
+ uint16_t Pre_Caller_NA : 1;
+ uint16_t Pre_State_NA : 1;
+ uint16_t Pre_Postponed_NA : 1;
+ uint16_t Post_Status : 2;
+ uint16_t Post_State : 2;
+ uint16_t Post_Postponed : 2;
+ uint16_t Post_Scheduler : 2;
+} RtemsRatemonReqCancel_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/req/cancel test case.
+ */
+typedef struct {
+ /**
+ * @brief This member contains a valid identifier of a period.
+ */
+ rtems_id period_id;
+
+ /**
+ * @brief This member is used to receive the
+ * rtems_rate_monotonic_period_status after the action.
+ */
+ rtems_rate_monotonic_period_status period_status;
+
+ /**
+ * @brief This member specifies the ``id`` parameter for the action.
+ */
+ rtems_id id_param;
+
+ /**
+ * @brief This member contains the returned status code of the action.
+ */
+ rtems_status_code status;
+
+ /**
+ * @brief This member contains the pointer to the function which executes the
+ * action.
+ *
+ * The action is either executed by the owner task or by the worker task
+ * depending on the function pointer used here. ``argument`` is a pointer to
+ * this context structure.
+ */
+ void ( *do_action )( void *ctx );
+
+ /**
+ * @brief This member contains the task identifier of the owner task.
+ */
+ rtems_id task_id;
+
+ /**
+ * @brief This member contains the task identifier of the worker task (which
+ * is not the owner task).
+ */
+ rtems_id worker_id;
+
+ /**
+ * @brief This member contains a backup of the task priority before the
+ * execution of this test.
+ */
+ rtems_id original_priority;
+
+ /**
+ * @brief This member contains the number of postponed jobs before the
+ * action.
+ */
+ uint32_t postponed_jobs_count;
+
+ /**
+ * @brief This member contains the state before the action.
+ */
+ rtems_rate_monotonic_period_states previous_state;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition indices for the next
+ * action.
+ */
+ size_t pci[ 4 ];
+
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 4 ];
+
+ /**
+ * @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.
+ */
+ RtemsRatemonReqCancel_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsRatemonReqCancel_Context;
+
+static RtemsRatemonReqCancel_Context
+ RtemsRatemonReqCancel_Instance;
+
+static const char * const RtemsRatemonReqCancel_PreDesc_Id[] = {
+ "Valid",
+ "Invalid",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqCancel_PreDesc_Caller[] = {
+ "OwnerTask",
+ "OtherTask",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqCancel_PreDesc_State[] = {
+ "Inactive",
+ "Active",
+ "Expired",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqCancel_PreDesc_Postponed[] = {
+ "Zero",
+ "One",
+ "Several",
+ "NA"
+};
+
+static const char * const * const RtemsRatemonReqCancel_PreDesc[] = {
+ RtemsRatemonReqCancel_PreDesc_Id,
+ RtemsRatemonReqCancel_PreDesc_Caller,
+ RtemsRatemonReqCancel_PreDesc_State,
+ RtemsRatemonReqCancel_PreDesc_Postponed,
+ NULL
+};
+
+static const rtems_interval period_length = 5;
+static const rtems_task_priority background_task_priority = 100;
+static const rtems_task_priority foreground_task_priority = 10;
+static const rtems_event_set wake_main_task_event = RTEMS_EVENT_17;
+
+static void TickTheClock(
+ RtemsRatemonReqCancel_Context *ctx,
+ uint32_t ticks
+)
+{
+ uint32_t i;
+ for ( i = 0; i < ticks; ++i ) {
+ TimecounterTick();
+ }
+}
+
+static void Action( void *ctx_in )
+{
+ RtemsRatemonReqCancel_Context *ctx = ctx_in;
+ ctx->status = rtems_rate_monotonic_cancel( ctx->id_param );
+}
+
+static void WorkerTask( rtems_task_argument argument )
+{
+ RtemsRatemonReqCancel_Context *ctx =
+ (RtemsRatemonReqCancel_Context *) argument;
+
+ if ( ctx != NULL ) {
+ Action( ctx );
+ T_rsc_success( rtems_event_send( ctx->task_id, wake_main_task_event ) );
+ }
+
+ T_rsc_success( rtems_task_suspend( RTEMS_SELF ) );
+}
+
+static void WorkerTaskAction( void *ctx_in )
+{
+ rtems_status_code status;
+ rtems_event_set event_set;
+ RtemsRatemonReqCancel_Context *ctx = ctx_in;
+
+ status = rtems_task_restart( ctx->worker_id, (rtems_task_argument) ctx );
+ T_rsc_success( status );
+
+ /* Wait till the worker task finishes */
+ status = rtems_event_receive(
+ wake_main_task_event,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_set
+ );
+ T_rsc_success( status );
+}
+
+static void CreatePostponedJobs(
+ RtemsRatemonReqCancel_Context *ctx,
+ uint32_t jobs_count
+)
+{
+ rtems_status_code status;
+ ctx->postponed_jobs_count = jobs_count;
+ if ( ctx->previous_state == RATE_MONOTONIC_ACTIVE ) {
+ TickTheClock( ctx, ( jobs_count + 1 ) * period_length );
+ status = rtems_rate_monotonic_period( ctx->period_id, period_length );
+ T_rsc( status, RTEMS_TIMEOUT );
+ } else {
+ /* ctx->previous_state == RATE_MONOTONIC_INACTIVE || _EXPIRED */
+ TickTheClock( ctx, jobs_count * period_length );
+ }
+}
+
+static void RtemsRatemonReqCancel_Pre_Id_Prepare(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Pre_Id state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Pre_Id_Valid: {
+ /*
+ * While the ``id`` parameter is valid.
+ */
+ ctx->id_param = ctx->period_id;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Id_Invalid: {
+ /*
+ * While the ``id`` parameter is invalid.
+ */
+ ctx->id_param = RTEMS_ID_NONE;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Id_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Pre_Caller_Prepare(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Pre_Caller state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Pre_Caller_OwnerTask: {
+ /*
+ * While the task invoking rtems_rate_monotonic_cancel() is the task
+ * which created the period - the owner task.
+ */
+ ctx->do_action = Action;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Caller_OtherTask: {
+ /*
+ * While the task invoking rtems_rate_monotonic_cancel() is not the owner
+ * task.
+ */
+ ctx->do_action = WorkerTaskAction;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Caller_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Pre_State_Prepare(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Pre_State state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Pre_State_Inactive: {
+ /*
+ * While the ``id`` parameter references an period object in inactive
+ * state.
+ */
+ /* Nothing to do here as the period is newly created. */
+ ctx->previous_state = RATE_MONOTONIC_INACTIVE;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_State_Active: {
+ /*
+ * While the ``id`` parameter references an period object in active
+ * state.
+ */
+ rtems_status_code status;
+ status = rtems_rate_monotonic_period( ctx->period_id, period_length );
+ T_rsc_success( status );
+ ctx->previous_state = RATE_MONOTONIC_ACTIVE;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_State_Expired: {
+ /*
+ * While the ``id`` parameter references an period object in expired
+ * state.
+ */
+ rtems_status_code status;
+ status = rtems_rate_monotonic_period( ctx->period_id, period_length );
+ T_rsc_success( status );
+ ctx->previous_state = RATE_MONOTONIC_EXPIRED;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_State_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Pre_Postponed_Prepare(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Pre_Postponed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Pre_Postponed_Zero: {
+ /*
+ * While the period is not in expired state.
+ */
+ ctx->postponed_jobs_count = 0;
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Postponed_One: {
+ /*
+ * While there is one postponed job.
+ */
+ CreatePostponedJobs( ctx, 1 );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Postponed_Several: {
+ /*
+ * While there are two or more postponed jobs.
+ */
+ CreatePostponedJobs( ctx, 5 );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Pre_Postponed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Post_Status_Check(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Post_Status_Ok: {
+ /*
+ * The return status of rtems_rate_monotonic_cancel() shall be
+ * RTEMS_SUCCESSFUL
+ */
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Status_InvId: {
+ /*
+ * The return status of rtems_rate_monotonic_cancel() shall be
+ * RTEMS_INVALID_ID.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Status_NotOwn: {
+ /*
+ * The return status of rtems_rate_monotonic_cancel() shall be
+ * RTEMS_NOT_OWNER_OF_RESOURCE.
+ */
+ T_rsc( ctx->status, RTEMS_NOT_OWNER_OF_RESOURCE );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Post_State_Check(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Post_State state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Post_State_Inactive: {
+ /*
+ * The state of the period shall be inactive after the return of the
+ * rtems_rate_monotonic_cancel() call.
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_INACTIVE );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_State_Nop: {
+ /*
+ * Objects referenced by the ``id`` parameter in past calls to
+ * rtems_rate_monotonic_cancel() shall not be accessed by the
+ * rtems_rate_monotonic_cancel() call (see also Nop).
+ */
+ T_eq_u32( ctx->period_status.state, ctx->previous_state );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_State_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Post_Postponed_Check(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Post_Postponed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Post_Postponed_Zero: {
+ /*
+ * There shall be no postponed jobs after the return of the
+ * rtems_rate_monotonic_cancel() call.
+ */
+ T_eq_u32( ctx->period_status.postponed_jobs_count, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Postponed_Nop: {
+ /*
+ * Objects referenced by the ``id`` parameter in past calls to
+ * rtems_rate_monotonic_cancel() shall not be accessed by the
+ * rtems_rate_monotonic_cancel() call (see also Nop).
+ */
+ T_eq_u32( ctx->period_status.postponed_jobs_count,
+ ctx->postponed_jobs_count );
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Postponed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Post_Scheduler_Check(
+ RtemsRatemonReqCancel_Context *ctx,
+ RtemsRatemonReqCancel_Post_Scheduler state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCancel_Post_Scheduler_Called: {
+ /*
+ * The last call of the rtems_rate_monotonic_cancel() function shall
+ * execute the ``cancel_job`` scheduler operation of the home scheduler.
+ */
+ /* Cannot be tested as the effect is unknown. */
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Scheduler_Nop: {
+ /*
+ * The last call of the rtems_rate_monotonic_cancel() function shall not
+ * execute any scheduler operation.
+ */
+ /* Cannot be tested as the effect is unknown. */
+ break;
+ }
+
+ case RtemsRatemonReqCancel_Post_Scheduler_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCancel_Setup( RtemsRatemonReqCancel_Context *ctx )
+{
+ rtems_status_code status;
+ rtems_task_priority priority;
+ rtems_event_set event_set;
+ ctx->worker_id = RTEMS_INVALID_ID;
+
+ status = rtems_task_ident(
+ RTEMS_SELF,
+ RTEMS_SEARCH_ALL_NODES,
+ &ctx->task_id
+ );
+ T_rsc_success( status );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &ctx->original_priority
+ );
+ T_rsc_success( status );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ background_task_priority,
+ &priority
+ );
+ T_rsc_success( status );
+
+ status = rtems_task_create(
+ rtems_build_name( 'W', 'O', 'R', 'K' ),
+ foreground_task_priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &ctx->worker_id
+ );
+ T_rsc_success( status );
+
+ /* Defensive programming: clean away any pending events */
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &event_set
+ );
+ T_true( status == RTEMS_SUCCESSFUL || status == RTEMS_UNSATISFIED );
+
+ status = rtems_task_start(
+ ctx->worker_id,
+ WorkerTask,
+ (rtems_task_argument) NULL
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqCancel_Setup_Wrap( void *arg )
+{
+ RtemsRatemonReqCancel_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqCancel_Setup( ctx );
+}
+
+static void RtemsRatemonReqCancel_Teardown(
+ RtemsRatemonReqCancel_Context *ctx
+)
+{
+ rtems_status_code status;
+ rtems_task_priority priority;
+
+ T_rsc_success( rtems_task_delete( ctx->worker_id ) );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ ctx->original_priority,
+ &priority
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqCancel_Teardown_Wrap( void *arg )
+{
+ RtemsRatemonReqCancel_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqCancel_Teardown( ctx );
+}
+
+static void RtemsRatemonReqCancel_Prepare( RtemsRatemonReqCancel_Context *ctx )
+{
+ rtems_status_code status;
+ status = rtems_rate_monotonic_create(
+ rtems_build_name( 'R', 'M', 'O', 'N' ),
+ &ctx->period_id
+ );
+ T_rsc_success( status );
+
+ ctx->postponed_jobs_count = 0;
+}
+
+static void RtemsRatemonReqCancel_Action( RtemsRatemonReqCancel_Context *ctx )
+{
+ rtems_status_code status;
+
+ ctx->do_action( ctx );
+
+ status = rtems_rate_monotonic_get_status(
+ ctx->period_id,
+ &ctx->period_status
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqCancel_Cleanup( RtemsRatemonReqCancel_Context *ctx )
+{
+ T_rsc_success( rtems_rate_monotonic_delete( ctx->period_id ) );
+}
+
+static const RtemsRatemonReqCancel_Entry
+RtemsRatemonReqCancel_Entries[] = {
+ { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_InvId,
+ RtemsRatemonReqCancel_Post_State_Nop,
+ RtemsRatemonReqCancel_Post_Postponed_Nop,
+ RtemsRatemonReqCancel_Post_Scheduler_Nop },
+ { 1, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_NA,
+ RtemsRatemonReqCancel_Post_State_NA,
+ RtemsRatemonReqCancel_Post_Postponed_NA,
+ RtemsRatemonReqCancel_Post_Scheduler_NA },
+ { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_Ok,
+ RtemsRatemonReqCancel_Post_State_Inactive,
+ RtemsRatemonReqCancel_Post_Postponed_Zero,
+ RtemsRatemonReqCancel_Post_Scheduler_Called },
+ { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_NotOwn,
+ RtemsRatemonReqCancel_Post_State_Nop,
+ RtemsRatemonReqCancel_Post_Postponed_Nop,
+ RtemsRatemonReqCancel_Post_Scheduler_Nop },
+ { 1, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_NA,
+ RtemsRatemonReqCancel_Post_State_NA,
+ RtemsRatemonReqCancel_Post_Postponed_NA,
+ RtemsRatemonReqCancel_Post_Scheduler_NA },
+ { 0, 0, 0, 0, 1, RtemsRatemonReqCancel_Post_Status_InvId,
+ RtemsRatemonReqCancel_Post_State_Nop,
+ RtemsRatemonReqCancel_Post_Postponed_Nop,
+ RtemsRatemonReqCancel_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 1, RtemsRatemonReqCancel_Post_Status_Ok,
+ RtemsRatemonReqCancel_Post_State_Inactive,
+ RtemsRatemonReqCancel_Post_Postponed_NA,
+ RtemsRatemonReqCancel_Post_Scheduler_Called },
+ { 0, 0, 0, 0, 1, RtemsRatemonReqCancel_Post_Status_NotOwn,
+ RtemsRatemonReqCancel_Post_State_Nop,
+ RtemsRatemonReqCancel_Post_Postponed_Nop,
+ RtemsRatemonReqCancel_Post_Scheduler_Nop }
+};
+
+static const uint8_t
+RtemsRatemonReqCancel_Map[] = {
+ 6, 1, 1, 2, 2, 2, 4, 2, 2, 7, 1, 1, 3, 3, 3, 4, 3, 3, 5, 1, 1, 0, 0, 0, 4, 0,
+ 0, 5, 1, 1, 0, 0, 0, 4, 0, 0
+};
+
+static size_t RtemsRatemonReqCancel_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsRatemonReqCancel_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsRatemonReqCancel_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsRatemonReqCancel_Fixture = {
+ .setup = RtemsRatemonReqCancel_Setup_Wrap,
+ .stop = NULL,
+ .teardown = RtemsRatemonReqCancel_Teardown_Wrap,
+ .scope = RtemsRatemonReqCancel_Scope,
+ .initial_context = &RtemsRatemonReqCancel_Instance
+};
+
+static inline RtemsRatemonReqCancel_Entry RtemsRatemonReqCancel_PopEntry(
+ RtemsRatemonReqCancel_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsRatemonReqCancel_Entries[
+ RtemsRatemonReqCancel_Map[ index ]
+ ];
+}
+
+static void RtemsRatemonReqCancel_SetPreConditionStates(
+ RtemsRatemonReqCancel_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+
+ if ( ctx->Map.entry.Pre_Postponed_NA ) {
+ ctx->Map.pcs[ 3 ] = RtemsRatemonReqCancel_Pre_Postponed_NA;
+ } else {
+ ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
+ }
+}
+
+static void RtemsRatemonReqCancel_TestVariant(
+ RtemsRatemonReqCancel_Context *ctx
+)
+{
+ RtemsRatemonReqCancel_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsRatemonReqCancel_Pre_Caller_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsRatemonReqCancel_Pre_State_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsRatemonReqCancel_Pre_Postponed_Prepare( ctx, ctx->Map.pcs[ 3 ] );
+ RtemsRatemonReqCancel_Action( ctx );
+ RtemsRatemonReqCancel_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+ RtemsRatemonReqCancel_Post_State_Check( ctx, ctx->Map.entry.Post_State );
+ RtemsRatemonReqCancel_Post_Postponed_Check(
+ ctx,
+ ctx->Map.entry.Post_Postponed
+ );
+ RtemsRatemonReqCancel_Post_Scheduler_Check(
+ ctx,
+ ctx->Map.entry.Post_Scheduler
+ );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonReqCancel( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsRatemonReqCancel, &RtemsRatemonReqCancel_Fixture )
+{
+ RtemsRatemonReqCancel_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pci[ 0 ] = RtemsRatemonReqCancel_Pre_Id_Valid;
+ ctx->Map.pci[ 0 ] < RtemsRatemonReqCancel_Pre_Id_NA;
+ ++ctx->Map.pci[ 0 ]
+ ) {
+ for (
+ ctx->Map.pci[ 1 ] = RtemsRatemonReqCancel_Pre_Caller_OwnerTask;
+ ctx->Map.pci[ 1 ] < RtemsRatemonReqCancel_Pre_Caller_NA;
+ ++ctx->Map.pci[ 1 ]
+ ) {
+ for (
+ ctx->Map.pci[ 2 ] = RtemsRatemonReqCancel_Pre_State_Inactive;
+ ctx->Map.pci[ 2 ] < RtemsRatemonReqCancel_Pre_State_NA;
+ ++ctx->Map.pci[ 2 ]
+ ) {
+ for (
+ ctx->Map.pci[ 3 ] = RtemsRatemonReqCancel_Pre_Postponed_Zero;
+ ctx->Map.pci[ 3 ] < RtemsRatemonReqCancel_Pre_Postponed_NA;
+ ++ctx->Map.pci[ 3 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqCancel_PopEntry( ctx );
+
+ if ( ctx->Map.entry.Skip ) {
+ continue;
+ }
+
+ RtemsRatemonReqCancel_SetPreConditionStates( ctx );
+ RtemsRatemonReqCancel_Prepare( ctx );
+ RtemsRatemonReqCancel_TestVariant( ctx );
+ RtemsRatemonReqCancel_Cleanup( ctx );
+ }
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-create.c b/testsuites/validation/tc-ratemon-create.c
new file mode 100644
index 0000000000..d86cd977c9
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-create.c
@@ -0,0 +1,529 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonReqCreate
+ */
+
+/*
+ * 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 <string.h>
+
+#include "tx-support.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsRatemonReqCreate spec:/rtems/ratemon/req/create
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsRatemonReqCreate_Pre_Name_Valid,
+ RtemsRatemonReqCreate_Pre_Name_Invalid,
+ RtemsRatemonReqCreate_Pre_Name_NA
+} RtemsRatemonReqCreate_Pre_Name;
+
+typedef enum {
+ RtemsRatemonReqCreate_Pre_Id_Valid,
+ RtemsRatemonReqCreate_Pre_Id_Null,
+ RtemsRatemonReqCreate_Pre_Id_NA
+} RtemsRatemonReqCreate_Pre_Id;
+
+typedef enum {
+ RtemsRatemonReqCreate_Pre_Free_Yes,
+ RtemsRatemonReqCreate_Pre_Free_No,
+ RtemsRatemonReqCreate_Pre_Free_NA
+} RtemsRatemonReqCreate_Pre_Free;
+
+typedef enum {
+ RtemsRatemonReqCreate_Post_Status_Ok,
+ RtemsRatemonReqCreate_Post_Status_InvName,
+ RtemsRatemonReqCreate_Post_Status_InvAddr,
+ RtemsRatemonReqCreate_Post_Status_TooMany,
+ RtemsRatemonReqCreate_Post_Status_NA
+} RtemsRatemonReqCreate_Post_Status;
+
+typedef enum {
+ RtemsRatemonReqCreate_Post_Name_Valid,
+ RtemsRatemonReqCreate_Post_Name_Invalid,
+ RtemsRatemonReqCreate_Post_Name_NA
+} RtemsRatemonReqCreate_Post_Name;
+
+typedef enum {
+ RtemsRatemonReqCreate_Post_IdVar_Set,
+ RtemsRatemonReqCreate_Post_IdVar_Nop,
+ RtemsRatemonReqCreate_Post_IdVar_NA
+} RtemsRatemonReqCreate_Post_IdVar;
+
+typedef struct {
+ uint16_t Skip : 1;
+ uint16_t Pre_Name_NA : 1;
+ uint16_t Pre_Id_NA : 1;
+ uint16_t Pre_Free_NA : 1;
+ uint16_t Post_Status : 3;
+ uint16_t Post_Name : 2;
+ uint16_t Post_IdVar : 2;
+} RtemsRatemonReqCreate_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/req/create test case.
+ */
+typedef struct {
+ void *seized_objects;
+
+ rtems_id id_value;
+
+ rtems_name name;
+
+ rtems_id *id;
+
+ rtems_status_code status;
+
+ 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.
+ */
+ RtemsRatemonReqCreate_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsRatemonReqCreate_Context;
+
+static RtemsRatemonReqCreate_Context
+ RtemsRatemonReqCreate_Instance;
+
+static const char * const RtemsRatemonReqCreate_PreDesc_Name[] = {
+ "Valid",
+ "Invalid",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqCreate_PreDesc_Id[] = {
+ "Valid",
+ "Null",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqCreate_PreDesc_Free[] = {
+ "Yes",
+ "No",
+ "NA"
+};
+
+static const char * const * const RtemsRatemonReqCreate_PreDesc[] = {
+ RtemsRatemonReqCreate_PreDesc_Name,
+ RtemsRatemonReqCreate_PreDesc_Id,
+ RtemsRatemonReqCreate_PreDesc_Free,
+ NULL
+};
+
+#define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
+
+static rtems_status_code Create( void *arg, uint32_t *id )
+{
+ return rtems_rate_monotonic_create(
+ rtems_build_name( 'S', 'I', 'Z', 'E' ),
+ id
+ );
+}
+
+static void RtemsRatemonReqCreate_Pre_Name_Prepare(
+ RtemsRatemonReqCreate_Context *ctx,
+ RtemsRatemonReqCreate_Pre_Name state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCreate_Pre_Name_Valid: {
+ /*
+ * While the ``name`` parameter is valid.
+ */
+ ctx->name = NAME;
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Pre_Name_Invalid: {
+ /*
+ * While the ``name`` parameter is invalid.
+ */
+ ctx->name = 0;
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Pre_Name_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCreate_Pre_Id_Prepare(
+ RtemsRatemonReqCreate_Context *ctx,
+ RtemsRatemonReqCreate_Pre_Id state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCreate_Pre_Id_Valid: {
+ /*
+ * While the ``id`` parameter references an object of type rtems_id.
+ */
+ ctx->id = &ctx->id_value;
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Pre_Id_Null: {
+ /*
+ * While the ``id`` parameter is NULL.
+ */
+ ctx->id = NULL;
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Pre_Id_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCreate_Pre_Free_Prepare(
+ RtemsRatemonReqCreate_Context *ctx,
+ RtemsRatemonReqCreate_Pre_Free state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCreate_Pre_Free_Yes: {
+ /*
+ * While the system has at least one inactive period object available.
+ */
+ /* Nothing to do */
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Pre_Free_No: {
+ /*
+ * While the system has no inactive period object available.
+ */
+ ctx->seized_objects = T_seize_objects( Create, NULL );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Pre_Free_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCreate_Post_Status_Check(
+ RtemsRatemonReqCreate_Context *ctx,
+ RtemsRatemonReqCreate_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCreate_Post_Status_Ok: {
+ /*
+ * The return status of rtems_rate_monotonic_create() shall be
+ * RTEMS_SUCCESSFUL.
+ */
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_Status_InvName: {
+ /*
+ * The return status of rtems_rate_monotonic_create() shall be
+ * RTEMS_INVALID_NAME.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_NAME );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_Status_InvAddr: {
+ /*
+ * The return status of rtems_rate_monotonic_create() shall be
+ * RTEMS_INVALID_ADDRESS.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_Status_TooMany: {
+ /*
+ * The return status of rtems_rate_monotonic_create() shall be
+ * RTEMS_TOO_MANY.
+ */
+ T_rsc( ctx->status, RTEMS_TOO_MANY );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCreate_Post_Name_Check(
+ RtemsRatemonReqCreate_Context *ctx,
+ RtemsRatemonReqCreate_Post_Name state
+)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ switch ( state ) {
+ case RtemsRatemonReqCreate_Post_Name_Valid: {
+ /*
+ * The unique object name shall identify the period created by the
+ * rtems_rate_monotonic_create() call.
+ */
+ id = 0;
+ sc = rtems_rate_monotonic_ident( NAME, &id );
+ T_rsc_success( sc );
+ T_eq_u32( id, ctx->id_value );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_Name_Invalid: {
+ /*
+ * The unique object name shall not identify a period.
+ */
+ sc = rtems_rate_monotonic_ident( NAME, &id );
+ T_rsc( sc, RTEMS_INVALID_NAME );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_Name_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCreate_Post_IdVar_Check(
+ RtemsRatemonReqCreate_Context *ctx,
+ RtemsRatemonReqCreate_Post_IdVar state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqCreate_Post_IdVar_Set: {
+ /*
+ * The value of the object referenced by the ``id`` parameter shall be
+ * set to the object identifier of the created period after the return of
+ * the rtems_rate_monotonic_create() call.
+ */
+ T_eq_ptr( ctx->id, &ctx->id_value );
+ T_ne_u32( ctx->id_value, INVALID_ID );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_IdVar_Nop: {
+ /*
+ * Objects referenced by the ``id`` parameter in past calls to
+ * rtems_rate_monotonic_create() shall not be accessed by the
+ * rtems_rate_monotonic_create() call.
+ */
+ T_eq_u32( ctx->id_value, INVALID_ID );
+ break;
+ }
+
+ case RtemsRatemonReqCreate_Post_IdVar_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqCreate_Setup( RtemsRatemonReqCreate_Context *ctx )
+{
+ memset( ctx, 0, sizeof( *ctx ) );
+ ctx->id_value = INVALID_ID;
+}
+
+static void RtemsRatemonReqCreate_Setup_Wrap( void *arg )
+{
+ RtemsRatemonReqCreate_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqCreate_Setup( ctx );
+}
+
+static void RtemsRatemonReqCreate_Action( RtemsRatemonReqCreate_Context *ctx )
+{
+ ctx->status = rtems_rate_monotonic_create( ctx->name, ctx->id );
+}
+
+static void RtemsRatemonReqCreate_Cleanup( RtemsRatemonReqCreate_Context *ctx )
+{
+ if ( ctx->id_value != INVALID_ID ) {
+ rtems_status_code sc;
+
+ sc = rtems_rate_monotonic_delete( ctx->id_value );
+ T_rsc_success( sc );
+
+ ctx->id_value = INVALID_ID;
+ }
+
+ T_surrender_objects( &ctx->seized_objects, rtems_rate_monotonic_delete );
+}
+
+static const RtemsRatemonReqCreate_Entry
+RtemsRatemonReqCreate_Entries[] = {
+ { 0, 0, 0, 0, RtemsRatemonReqCreate_Post_Status_InvName,
+ RtemsRatemonReqCreate_Post_Name_Invalid,
+ RtemsRatemonReqCreate_Post_IdVar_Nop },
+ { 0, 0, 0, 0, RtemsRatemonReqCreate_Post_Status_InvAddr,
+ RtemsRatemonReqCreate_Post_Name_Invalid,
+ RtemsRatemonReqCreate_Post_IdVar_Nop },
+ { 0, 0, 0, 0, RtemsRatemonReqCreate_Post_Status_Ok,
+ RtemsRatemonReqCreate_Post_Name_Valid, RtemsRatemonReqCreate_Post_IdVar_Set },
+ { 0, 0, 0, 0, RtemsRatemonReqCreate_Post_Status_TooMany,
+ RtemsRatemonReqCreate_Post_Name_Invalid,
+ RtemsRatemonReqCreate_Post_IdVar_Nop }
+};
+
+static const uint8_t
+RtemsRatemonReqCreate_Map[] = {
+ 2, 3, 1, 1, 0, 0, 0, 0
+};
+
+static size_t RtemsRatemonReqCreate_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsRatemonReqCreate_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsRatemonReqCreate_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsRatemonReqCreate_Fixture = {
+ .setup = RtemsRatemonReqCreate_Setup_Wrap,
+ .stop = NULL,
+ .teardown = NULL,
+ .scope = RtemsRatemonReqCreate_Scope,
+ .initial_context = &RtemsRatemonReqCreate_Instance
+};
+
+static inline RtemsRatemonReqCreate_Entry RtemsRatemonReqCreate_PopEntry(
+ RtemsRatemonReqCreate_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsRatemonReqCreate_Entries[
+ RtemsRatemonReqCreate_Map[ index ]
+ ];
+}
+
+static void RtemsRatemonReqCreate_TestVariant(
+ RtemsRatemonReqCreate_Context *ctx
+)
+{
+ RtemsRatemonReqCreate_Pre_Name_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsRatemonReqCreate_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsRatemonReqCreate_Pre_Free_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsRatemonReqCreate_Action( ctx );
+ RtemsRatemonReqCreate_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+ RtemsRatemonReqCreate_Post_Name_Check( ctx, ctx->Map.entry.Post_Name );
+ RtemsRatemonReqCreate_Post_IdVar_Check( ctx, ctx->Map.entry.Post_IdVar );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonReqCreate( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsRatemonReqCreate, &RtemsRatemonReqCreate_Fixture )
+{
+ RtemsRatemonReqCreate_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pcs[ 0 ] = RtemsRatemonReqCreate_Pre_Name_Valid;
+ ctx->Map.pcs[ 0 ] < RtemsRatemonReqCreate_Pre_Name_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 1 ] = RtemsRatemonReqCreate_Pre_Id_Valid;
+ ctx->Map.pcs[ 1 ] < RtemsRatemonReqCreate_Pre_Id_NA;
+ ++ctx->Map.pcs[ 1 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 2 ] = RtemsRatemonReqCreate_Pre_Free_Yes;
+ ctx->Map.pcs[ 2 ] < RtemsRatemonReqCreate_Pre_Free_NA;
+ ++ctx->Map.pcs[ 2 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqCreate_PopEntry( ctx );
+ RtemsRatemonReqCreate_TestVariant( ctx );
+ RtemsRatemonReqCreate_Cleanup( ctx );
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-delete.c b/testsuites/validation/tc-ratemon-delete.c
new file mode 100644
index 0000000000..3b30188fe1
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-delete.c
@@ -0,0 +1,368 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonReqDelete
+ */
+
+/*
+ * 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 <string.h>
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsRatemonReqDelete spec:/rtems/ratemon/req/delete
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsRatemonReqDelete_Pre_Id_NoObj,
+ RtemsRatemonReqDelete_Pre_Id_Period,
+ RtemsRatemonReqDelete_Pre_Id_NA
+} RtemsRatemonReqDelete_Pre_Id;
+
+typedef enum {
+ RtemsRatemonReqDelete_Post_Status_Ok,
+ RtemsRatemonReqDelete_Post_Status_InvId,
+ RtemsRatemonReqDelete_Post_Status_NA
+} RtemsRatemonReqDelete_Post_Status;
+
+typedef enum {
+ RtemsRatemonReqDelete_Post_Name_Valid,
+ RtemsRatemonReqDelete_Post_Name_Invalid,
+ RtemsRatemonReqDelete_Post_Name_NA
+} RtemsRatemonReqDelete_Post_Name;
+
+typedef struct {
+ uint8_t Skip : 1;
+ uint8_t Pre_Id_NA : 1;
+ uint8_t Post_Status : 2;
+ uint8_t Post_Name : 2;
+} RtemsRatemonReqDelete_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/req/delete test case.
+ */
+typedef struct {
+ rtems_id period_id;
+
+ rtems_id id;
+
+ rtems_status_code status;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 1 ];
+
+ /**
+ * @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.
+ */
+ RtemsRatemonReqDelete_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsRatemonReqDelete_Context;
+
+static RtemsRatemonReqDelete_Context
+ RtemsRatemonReqDelete_Instance;
+
+static const char * const RtemsRatemonReqDelete_PreDesc_Id[] = {
+ "NoObj",
+ "Period",
+ "NA"
+};
+
+static const char * const * const RtemsRatemonReqDelete_PreDesc[] = {
+ RtemsRatemonReqDelete_PreDesc_Id,
+ NULL
+};
+
+#define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
+
+static void RtemsRatemonReqDelete_Pre_Id_Prepare(
+ RtemsRatemonReqDelete_Context *ctx,
+ RtemsRatemonReqDelete_Pre_Id state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqDelete_Pre_Id_NoObj: {
+ /*
+ * While the ``id`` parameter is not associated with a period.
+ */
+ ctx->id = 0;
+ break;
+ }
+
+ case RtemsRatemonReqDelete_Pre_Id_Period: {
+ /*
+ * While the ``id`` parameter is associated with a period.
+ */
+ ctx->id = ctx->period_id;
+ break;
+ }
+
+ case RtemsRatemonReqDelete_Pre_Id_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqDelete_Post_Status_Check(
+ RtemsRatemonReqDelete_Context *ctx,
+ RtemsRatemonReqDelete_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqDelete_Post_Status_Ok: {
+ /*
+ * The return status of rtems_rate_monotonic_delete() shall be
+ * RTEMS_SUCCESSFUL.
+ */
+ ctx->period_id = 0;
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsRatemonReqDelete_Post_Status_InvId: {
+ /*
+ * The return status of rtems_rate_monotonic_delete() shall be
+ * RTEMS_INVALID_ID.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ break;
+ }
+
+ case RtemsRatemonReqDelete_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqDelete_Post_Name_Check(
+ RtemsRatemonReqDelete_Context *ctx,
+ RtemsRatemonReqDelete_Post_Name state
+)
+{
+ rtems_status_code sc;
+ rtems_id id;
+
+ switch ( state ) {
+ case RtemsRatemonReqDelete_Post_Name_Valid: {
+ /*
+ * The unique object name shall identify a period.
+ */
+ id = 0;
+ sc = rtems_rate_monotonic_ident( NAME, &id );
+ T_rsc_success( sc );
+ T_eq_u32( id, ctx->period_id );
+ break;
+ }
+
+ case RtemsRatemonReqDelete_Post_Name_Invalid: {
+ /*
+ * The unique object name shall not identify a period.
+ */
+ sc = rtems_rate_monotonic_ident( NAME, &id );
+ T_rsc( sc, RTEMS_INVALID_NAME );
+ break;
+ }
+
+ case RtemsRatemonReqDelete_Post_Name_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqDelete_Setup( RtemsRatemonReqDelete_Context *ctx )
+{
+ memset( ctx, 0, sizeof( *ctx ) );
+}
+
+static void RtemsRatemonReqDelete_Setup_Wrap( void *arg )
+{
+ RtemsRatemonReqDelete_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqDelete_Setup( ctx );
+}
+
+static void RtemsRatemonReqDelete_Teardown(
+ RtemsRatemonReqDelete_Context *ctx
+)
+{
+ if ( ctx->period_id != 0 ) {
+ rtems_status_code sc;
+
+ sc = rtems_rate_monotonic_delete( ctx->period_id );
+ T_rsc_success( sc );
+ }
+}
+
+static void RtemsRatemonReqDelete_Teardown_Wrap( void *arg )
+{
+ RtemsRatemonReqDelete_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqDelete_Teardown( ctx );
+}
+
+static void RtemsRatemonReqDelete_Prepare( RtemsRatemonReqDelete_Context *ctx )
+{
+ if ( ctx->period_id == 0 ) {
+ rtems_status_code sc;
+
+ sc = rtems_rate_monotonic_create( NAME, &ctx->period_id );
+ T_rsc_success( sc );
+ }
+}
+
+static void RtemsRatemonReqDelete_Action( RtemsRatemonReqDelete_Context *ctx )
+{
+ ctx->status = rtems_rate_monotonic_delete( ctx->id );
+}
+
+static const RtemsRatemonReqDelete_Entry
+RtemsRatemonReqDelete_Entries[] = {
+ { 0, 0, RtemsRatemonReqDelete_Post_Status_InvId,
+ RtemsRatemonReqDelete_Post_Name_Valid },
+ { 0, 0, RtemsRatemonReqDelete_Post_Status_Ok,
+ RtemsRatemonReqDelete_Post_Name_Invalid }
+};
+
+static const uint8_t
+RtemsRatemonReqDelete_Map[] = {
+ 0, 1
+};
+
+static size_t RtemsRatemonReqDelete_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsRatemonReqDelete_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsRatemonReqDelete_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsRatemonReqDelete_Fixture = {
+ .setup = RtemsRatemonReqDelete_Setup_Wrap,
+ .stop = NULL,
+ .teardown = RtemsRatemonReqDelete_Teardown_Wrap,
+ .scope = RtemsRatemonReqDelete_Scope,
+ .initial_context = &RtemsRatemonReqDelete_Instance
+};
+
+static inline RtemsRatemonReqDelete_Entry RtemsRatemonReqDelete_PopEntry(
+ RtemsRatemonReqDelete_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsRatemonReqDelete_Entries[
+ RtemsRatemonReqDelete_Map[ index ]
+ ];
+}
+
+static void RtemsRatemonReqDelete_TestVariant(
+ RtemsRatemonReqDelete_Context *ctx
+)
+{
+ RtemsRatemonReqDelete_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsRatemonReqDelete_Action( ctx );
+ RtemsRatemonReqDelete_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+ RtemsRatemonReqDelete_Post_Name_Check( ctx, ctx->Map.entry.Post_Name );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonReqDelete( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsRatemonReqDelete, &RtemsRatemonReqDelete_Fixture )
+{
+ RtemsRatemonReqDelete_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pcs[ 0 ] = RtemsRatemonReqDelete_Pre_Id_NoObj;
+ ctx->Map.pcs[ 0 ] < RtemsRatemonReqDelete_Pre_Id_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqDelete_PopEntry( ctx );
+ RtemsRatemonReqDelete_Prepare( ctx );
+ RtemsRatemonReqDelete_TestVariant( ctx );
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-get-status.c b/testsuites/validation/tc-ratemon-get-status.c
new file mode 100644
index 0000000000..fe3fb300e3
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-get-status.c
@@ -0,0 +1,1171 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonReqGetStatus
+ */
+
+/*
+ * 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/cpuuse.h>
+
+#include "tx-support.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsRatemonReqGetStatus \
+ * spec:/rtems/ratemon/req/get-status
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationOneCpu0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Pre_StatusAddr_Valid,
+ RtemsRatemonReqGetStatus_Pre_StatusAddr_Null,
+ RtemsRatemonReqGetStatus_Pre_StatusAddr_NA
+} RtemsRatemonReqGetStatus_Pre_StatusAddr;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Pre_Id_Valid,
+ RtemsRatemonReqGetStatus_Pre_Id_Invalid,
+ RtemsRatemonReqGetStatus_Pre_Id_NA
+} RtemsRatemonReqGetStatus_Pre_Id;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Pre_State_Inactive,
+ RtemsRatemonReqGetStatus_Pre_State_Active,
+ RtemsRatemonReqGetStatus_Pre_State_Expired,
+ RtemsRatemonReqGetStatus_Pre_State_NA
+} RtemsRatemonReqGetStatus_Pre_State;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Pre_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Pre_Elapsed_NA
+} RtemsRatemonReqGetStatus_Pre_Elapsed;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Pre_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Pre_Consumed_NA
+} RtemsRatemonReqGetStatus_Pre_Consumed;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Pre_Postponed_Zero,
+ RtemsRatemonReqGetStatus_Pre_Postponed_One,
+ RtemsRatemonReqGetStatus_Pre_Postponed_Several,
+ RtemsRatemonReqGetStatus_Pre_Postponed_NA
+} RtemsRatemonReqGetStatus_Pre_Postponed;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Status_InvAddr,
+ RtemsRatemonReqGetStatus_Post_Status_InvId,
+ RtemsRatemonReqGetStatus_Post_Status_NA
+} RtemsRatemonReqGetStatus_Post_Status;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_Owner_Nop,
+ RtemsRatemonReqGetStatus_Post_Owner_NA
+} RtemsRatemonReqGetStatus_Post_Owner;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Post_State_Inactive,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_State_Expired,
+ RtemsRatemonReqGetStatus_Post_State_Nop,
+ RtemsRatemonReqGetStatus_Post_State_NA
+} RtemsRatemonReqGetStatus_Post_State;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Post_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Zero,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Elapsed_NA
+} RtemsRatemonReqGetStatus_Post_Elapsed;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Post_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Post_Consumed_Zero,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_NA
+} RtemsRatemonReqGetStatus_Post_Consumed;
+
+typedef enum {
+ RtemsRatemonReqGetStatus_Post_Postponed_Zero,
+ RtemsRatemonReqGetStatus_Post_Postponed_One,
+ RtemsRatemonReqGetStatus_Post_Postponed_Several,
+ RtemsRatemonReqGetStatus_Post_Postponed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_NA
+} RtemsRatemonReqGetStatus_Post_Postponed;
+
+typedef struct {
+ uint32_t Skip : 1;
+ uint32_t Pre_StatusAddr_NA : 1;
+ uint32_t Pre_Id_NA : 1;
+ uint32_t Pre_State_NA : 1;
+ uint32_t Pre_Elapsed_NA : 1;
+ uint32_t Pre_Consumed_NA : 1;
+ uint32_t Pre_Postponed_NA : 1;
+ uint32_t Post_Status : 2;
+ uint32_t Post_Owner : 2;
+ uint32_t Post_State : 3;
+ uint32_t Post_Elapsed : 2;
+ uint32_t Post_Consumed : 2;
+ uint32_t Post_Postponed : 3;
+} RtemsRatemonReqGetStatus_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/req/get-status test case.
+ */
+typedef struct {
+ /**
+ * @brief This member contains a valid identifier of a period.
+ */
+ rtems_id period_id;
+
+ /**
+ * @brief This member contains the previous timecounter handler to restore.
+ */
+ GetTimecountHandler previous_timecounter_handler;
+
+ /**
+ * @brief This member is used to receive the
+ * rtems_rate_monotonic_period_status from the action.
+ */
+ rtems_rate_monotonic_period_status period_status;
+
+ /**
+ * @brief This member specifies the ``id`` parameter for the action.
+ */
+ rtems_id id_param;
+
+ /**
+ * @brief This member specifies the ``status`` parameter for the action.
+ */
+ rtems_rate_monotonic_period_status *status_param;
+
+ /**
+ * @brief This member contains the returned status code of the action.
+ */
+ rtems_status_code status;
+
+ /**
+ * @brief This member contains the task identifier of the owner task.
+ */
+ rtems_id task_id;
+
+ /**
+ * @brief This member contains the state before the action.
+ */
+ rtems_rate_monotonic_period_states previous_state;
+
+ /**
+ * @brief If the rtems_cpu_usage_reset() directive should be called before
+ * rtems_rate_monotonic_get_status(), this member contains a pointer to it.
+ */
+ void (*do_reset)( void );
+
+ /**
+ * @brief This member contains the CLOCK_MONOTONIC time elapsed.
+ */
+ struct timespec elapsed;
+
+ /**
+ * @brief This member contains the CPU time consumed by the owner task.
+ */
+ struct timespec consumed;
+
+ /**
+ * @brief This member contains the number of postponed jobs.
+ */
+ uint32_t postponed_jobs_count;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition indices for the next
+ * action.
+ */
+ size_t pci[ 6 ];
+
+ /**
+ * @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.
+ */
+ RtemsRatemonReqGetStatus_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsRatemonReqGetStatus_Context;
+
+static RtemsRatemonReqGetStatus_Context
+ RtemsRatemonReqGetStatus_Instance;
+
+static const char * const RtemsRatemonReqGetStatus_PreDesc_StatusAddr[] = {
+ "Valid",
+ "Null",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqGetStatus_PreDesc_Id[] = {
+ "Valid",
+ "Invalid",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqGetStatus_PreDesc_State[] = {
+ "Inactive",
+ "Active",
+ "Expired",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqGetStatus_PreDesc_Elapsed[] = {
+ "Time",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqGetStatus_PreDesc_Consumed[] = {
+ "CpuTime",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqGetStatus_PreDesc_Postponed[] = {
+ "Zero",
+ "One",
+ "Several",
+ "NA"
+};
+
+static const char * const * const RtemsRatemonReqGetStatus_PreDesc[] = {
+ RtemsRatemonReqGetStatus_PreDesc_StatusAddr,
+ RtemsRatemonReqGetStatus_PreDesc_Id,
+ RtemsRatemonReqGetStatus_PreDesc_State,
+ RtemsRatemonReqGetStatus_PreDesc_Elapsed,
+ RtemsRatemonReqGetStatus_PreDesc_Consumed,
+ RtemsRatemonReqGetStatus_PreDesc_Postponed,
+ NULL
+};
+
+static const rtems_id initial_owner = 0xFFFFFFFF;
+static const rtems_rate_monotonic_period_states initial_state =
+ (rtems_rate_monotonic_period_states) 0xFFFFFFFF;
+static const struct timespec initial_period = { 0xFFFFFFFF, 0xFFFFFFFF };
+static const uint32_t initial_postponed_jobs_count = 0xFFFFFFFF;
+static const rtems_interval period_length = 5;
+static const uint32_t elapsed_cpu_ticks = 3;
+
+static uint32_t FreezeTime( void )
+{
+ return GetTimecountCounter() - 1;
+}
+
+static void TickTheClock(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ uint32_t ticks
+)
+{
+ uint32_t i;
+ for ( i = 0; i < ticks; ++i ) {
+ TimecounterTick();
+ }
+ ctx->elapsed.tv_nsec +=
+ rtems_configuration_get_nanoseconds_per_tick() * ticks;
+}
+
+static void CreatePostponedJobs(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ uint32_t jobs_count
+)
+{
+ rtems_status_code status;
+ ctx->postponed_jobs_count = jobs_count;
+ if ( ctx->previous_state == RATE_MONOTONIC_ACTIVE ) {
+ jobs_count++;
+ TickTheClock( ctx, jobs_count * period_length );
+ status = rtems_rate_monotonic_period( ctx->period_id, period_length );
+ T_rsc( status, RTEMS_TIMEOUT );
+ } else {
+ /* ctx->previous_state == RATE_MONOTONIC_INACTIVE || _EXPIRED */
+ TickTheClock( ctx, jobs_count * period_length );
+ }
+ ctx->consumed.tv_nsec +=
+ rtems_configuration_get_nanoseconds_per_tick() *
+ jobs_count * period_length;
+}
+
+static void RtemsRatemonReqGetStatus_Pre_StatusAddr_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_StatusAddr state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_StatusAddr_Valid: {
+ /*
+ * While the ``status`` parameter references an object of type
+ * rtems_rate_monotonic_period_status.
+ */
+ ctx->status_param = &ctx->period_status;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_StatusAddr_Null: {
+ /*
+ * While the ``status`` parameter is NULL.
+ */
+ ctx->status_param = NULL;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_StatusAddr_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Pre_Id_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_Id state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_Id_Valid: {
+ /*
+ * While the ``id`` parameter is valid.
+ */
+ ctx->id_param = ctx->period_id;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Id_Invalid: {
+ /*
+ * While the ``id`` parameter is invalid.
+ */
+ ctx->id_param = RTEMS_ID_NONE;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Id_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Pre_State_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_State state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_State_Inactive: {
+ /*
+ * While the ``id`` parameter references an period object in inactive
+ * state.
+ */
+ /* Nothing to do here as the period is newly created. */
+ ctx->previous_state = RATE_MONOTONIC_INACTIVE;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_State_Active: {
+ /*
+ * While the ``id`` parameter references an period object in active
+ * state.
+ */
+ rtems_status_code status;
+ status = rtems_rate_monotonic_period( ctx->period_id, period_length );
+ T_rsc_success( status );
+ ctx->previous_state = RATE_MONOTONIC_ACTIVE;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_State_Expired: {
+ /*
+ * While the ``id`` parameter references an period object in expired
+ * state.
+ */
+ rtems_status_code status;
+ status = rtems_rate_monotonic_period( ctx->period_id, period_length );
+ T_rsc_success( status );
+ ctx->previous_state = RATE_MONOTONIC_EXPIRED;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_State_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Pre_Elapsed_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_Elapsed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_Elapsed_Time: {
+ /*
+ * While a certain time of the CLOCK_MONOTONIC has elapsed.
+ */
+ /* Time elapsed while having a CPU is added below in "CpuTime". */
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Elapsed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Pre_Consumed_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_Consumed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_Consumed_CpuTime: {
+ /*
+ * While the owner task has consumed a certain amount of CPU time.
+ */
+ TickTheClock( ctx, elapsed_cpu_ticks );
+ ctx->consumed.tv_nsec +=
+ rtems_configuration_get_nanoseconds_per_tick() * elapsed_cpu_ticks;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Consumed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Pre_Postponed_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_Postponed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_Postponed_Zero: {
+ /*
+ * While the period is not in expired state.
+ */
+ ctx->postponed_jobs_count = 0;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Postponed_One: {
+ /*
+ * While there is one postponed job.
+ */
+ CreatePostponedJobs( ctx, 1 );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Postponed_Several: {
+ /*
+ * While there are two or more postponed job.
+ */
+ CreatePostponedJobs( ctx, 5 );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_Postponed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Post_Status_Check(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Post_Status_Ok: {
+ /*
+ * The return status of rtems_rate_monotonic_get_status() shall be
+ * RTEMS_SUCCESSFUL
+ */
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Status_InvAddr: {
+ /*
+ * The return status of rtems_rate_monotonic_get_status() shall be
+ * RTEMS_INVALID_ADDRESS.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Status_InvId: {
+ /*
+ * The return status of rtems_rate_monotonic_get_status() shall be
+ * RTEMS_INVALID_ID.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Post_Owner_Check(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Post_Owner state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Post_Owner_OwnerTask: {
+ /*
+ * The value of the member owner of the object referenced by the
+ * ``status`` parameter shall be set to the object identifier of the
+ * owner task of the period after the return of the
+ * rtems_rate_monotonic_get_status() call.
+ */
+ T_eq_u32( ctx->period_status.owner, ctx->task_id );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Owner_Nop: {
+ /*
+ * Objects referenced by the ``status`` parameter in past call to
+ * rtems_rate_monotonic_get_status() shall not be accessed by the
+ * rtems_rate_monotonic_get_status() call (see also Nop).
+ */
+ T_eq_u32( ctx->period_status.owner, initial_owner );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Owner_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Post_State_Check(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Post_State state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Post_State_Inactive: {
+ /*
+ * The value of the member state of the object referenced by the
+ * ``status`` parameter shall be set to RATE_MONOTONIC_INACTIVE after the
+ * return of the rtems_rate_monotonic_get_status() call. (See also
+ * inactive)
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_INACTIVE );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_State_Active: {
+ /*
+ * The value of the member state of the object referenced by the
+ * ``status`` parameter shall be set to RATE_MONOTONIC_ACTIVE after the
+ * return of the rtems_rate_monotonic_get_status() call. (See also
+ * active)
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_ACTIVE );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_State_Expired: {
+ /*
+ * The value of the member state of the object referenced by the
+ * ``status`` parameter shall be set to RATE_MONOTONIC_EXPIRED after the
+ * return of the rtems_rate_monotonic_get_status() call. (See also
+ * expired)
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_EXPIRED );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_State_Nop: {
+ /*
+ * Objects referenced by the ``status`` parameter in past calls to
+ * rtems_rate_monotonic_get_status() shall not be accessed by the
+ * rtems_rate_monotonic_get_status() call (see also Nop).
+ */
+ T_eq_u32( ctx->period_status.state, initial_state );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_State_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Post_Elapsed_Check(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Post_Elapsed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Post_Elapsed_Time: {
+ /*
+ * The value of the member since_last_period of the object referenced by
+ * the ``status`` parameter shall be set to the time elapsed.
+ */
+ T_log( T_VERBOSE, "Elapsed: %lld.%ld (expected: %lld.%ld)",
+ ctx->period_status.since_last_period.tv_sec,
+ ctx->period_status.since_last_period.tv_nsec,
+ ctx->elapsed.tv_sec,
+ ctx->elapsed.tv_nsec
+ );
+ T_eq_u64(
+ ctx->period_status.since_last_period.tv_sec,
+ ctx->elapsed.tv_sec
+ );
+ /* period_status integer arithmetic is plagued by a rounding error. */
+ T_le_long(
+ ctx->period_status.since_last_period.tv_nsec,
+ ctx->elapsed.tv_nsec + 1
+ );
+ T_ge_long(
+ ctx->period_status.since_last_period.tv_nsec,
+ ctx->elapsed.tv_nsec - 1
+ );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Elapsed_Zero: {
+ /*
+ * The value of the member since_last_period of the object referenced by
+ * the ``status`` parameter shall be set to 0.
+ */
+ T_eq_u64( ctx->period_status.since_last_period.tv_sec, 0 );
+ T_eq_long( ctx->period_status.since_last_period.tv_nsec, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Elapsed_Nop: {
+ /*
+ * Objects referenced by the ``status`` parameter in past calls to
+ * rtems_rate_monotonic_get_status() shall not be accessed by the
+ * rtems_rate_monotonic_get_status() call (see also Nop).
+ */
+ T_eq_u64(
+ ctx->period_status.since_last_period.tv_sec,
+ initial_period.tv_sec
+ );
+ T_eq_long(
+ ctx->period_status.since_last_period.tv_nsec,
+ initial_period.tv_nsec
+ );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Elapsed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Post_Consumed_Check(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Post_Consumed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Post_Consumed_CpuTime: {
+ /*
+ * The value of the member executed_since_last_period of the object
+ * referenced by the ``status`` parameter shall be set to the CPU time
+ * consumed by the owner task.
+ */
+ T_log( T_VERBOSE, "CPU elapsed: %lld.%ld (expected: %lld.%ld)",
+ ctx->period_status.executed_since_last_period.tv_sec,
+ ctx->period_status.executed_since_last_period.tv_nsec,
+ ctx->consumed.tv_sec,
+ ctx->consumed.tv_nsec
+ );
+ T_eq_u64(
+ ctx->period_status.executed_since_last_period.tv_sec,
+ ctx->consumed.tv_sec
+ );
+ /* period_status integer arithmetic is plagued by a rounding error. */
+ T_le_long(
+ ctx->period_status.executed_since_last_period.tv_nsec,
+ ctx->consumed.tv_nsec + 1
+ );
+ T_ge_long(
+ ctx->period_status.executed_since_last_period.tv_nsec,
+ ctx->consumed.tv_nsec - 1
+ );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Consumed_Zero: {
+ /*
+ * The value of the member since_last_period of the object referenced by
+ * the ``status`` parameter shall be set to 0.
+ */
+ T_eq_u64( ctx->period_status.executed_since_last_period.tv_sec, 0 );
+ T_eq_long( ctx->period_status.executed_since_last_period.tv_nsec, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Consumed_Nop: {
+ /*
+ * Objects referenced by the ``status`` parameter in past calls to
+ * rtems_rate_monotonic_get_status() shall not be accessed by the
+ * rtems_rate_monotonic_get_status() call (see also Nop).
+ */
+ T_eq_u64(
+ ctx->period_status.executed_since_last_period.tv_sec,
+ initial_period.tv_sec
+ );
+ T_eq_long(
+ ctx->period_status.executed_since_last_period.tv_nsec,
+ initial_period.tv_nsec
+ );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Consumed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Post_Postponed_Check(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Post_Postponed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Post_Postponed_Zero: {
+ /*
+ * The value of the member postponed_jobs_count of the object referenced
+ * by the ``status`` parameter shall be set to 0 after the return of the
+ * rtems_rate_monotonic_get_status() call.
+ */
+ T_eq_u32( ctx->period_status.postponed_jobs_count, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Postponed_One: {
+ /*
+ * The value of the member postponed_jobs_count of the object referenced
+ * by the ``status`` parameter shall be set to the number of postponed
+ * jobs (here 1) after the return of the
+ * rtems_rate_monotonic_get_status() call.
+ */
+ T_eq_u32( ctx->period_status.postponed_jobs_count, 1 );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Postponed_Several: {
+ /*
+ * The value of the member postponed_jobs_count of the object referenced
+ * by the ``status`` parameter shall be set to the number of postponed
+ * jobs after the return of the rtems_rate_monotonic_get_status() call.
+ */
+ T_eq_u32(
+ ctx->period_status.postponed_jobs_count,
+ ctx->postponed_jobs_count
+ );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Postponed_Nop: {
+ /*
+ * Objects referenced by the ``status`` parameter in past calls to
+ * rtems_rate_monotonic_get_status() shall not be accessed by the
+ * rtems_rate_monotonic_get_status() call (see also Nop).
+ */
+ T_eq_u32( ctx->period_status.postponed_jobs_count,
+ initial_postponed_jobs_count );
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Post_Postponed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqGetStatus_Setup(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ ctx->previous_timecounter_handler = SetGetTimecountHandler( FreezeTime );
+ ctx->task_id = rtems_task_self();
+}
+
+static void RtemsRatemonReqGetStatus_Setup_Wrap( void *arg )
+{
+ RtemsRatemonReqGetStatus_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqGetStatus_Setup( ctx );
+}
+
+static void RtemsRatemonReqGetStatus_Teardown(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ SetGetTimecountHandler( ctx->previous_timecounter_handler );
+}
+
+static void RtemsRatemonReqGetStatus_Teardown_Wrap( void *arg )
+{
+ RtemsRatemonReqGetStatus_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqGetStatus_Teardown( ctx );
+}
+
+static void RtemsRatemonReqGetStatus_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ rtems_status_code status;
+ status = rtems_rate_monotonic_create(
+ rtems_build_name( 'R', 'M', 'O', 'N' ),
+ &ctx->period_id
+ );
+ T_rsc_success( status );
+
+ ctx->period_status = (rtems_rate_monotonic_period_status) {
+ .owner = initial_owner,
+ .state = initial_state,
+ .since_last_period = initial_period,
+ .executed_since_last_period = initial_period,
+ .postponed_jobs_count = initial_postponed_jobs_count
+ };
+
+ ctx->elapsed.tv_sec = 0;
+ ctx->elapsed.tv_nsec = 0;
+ ctx->consumed.tv_sec = 0;
+ ctx->consumed.tv_nsec = 0;
+ ctx->postponed_jobs_count = 0;
+ TimecounterTick();
+}
+
+static void RtemsRatemonReqGetStatus_Action(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ if ( ctx->do_reset != NULL ) {
+ ctx->do_reset();
+ }
+ ctx->status = rtems_rate_monotonic_get_status(
+ ctx->id_param,
+ ctx->status_param
+ );
+}
+
+static void RtemsRatemonReqGetStatus_Cleanup(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ T_rsc_success( rtems_rate_monotonic_delete( ctx->period_id ) );
+}
+
+static const RtemsRatemonReqGetStatus_Entry
+RtemsRatemonReqGetStatus_Entries[] = {
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_InvAddr,
+ RtemsRatemonReqGetStatus_Post_Owner_Nop,
+ RtemsRatemonReqGetStatus_Post_State_Nop,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Nop },
+ { 1, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NA,
+ RtemsRatemonReqGetStatus_Post_Owner_NA,
+ RtemsRatemonReqGetStatus_Post_State_NA,
+ RtemsRatemonReqGetStatus_Post_Elapsed_NA,
+ RtemsRatemonReqGetStatus_Post_Consumed_NA,
+ RtemsRatemonReqGetStatus_Post_Postponed_NA },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_InvId,
+ RtemsRatemonReqGetStatus_Post_Owner_Nop,
+ RtemsRatemonReqGetStatus_Post_State_Nop,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Nop },
+ { 1, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NA,
+ RtemsRatemonReqGetStatus_Post_Owner_NA,
+ RtemsRatemonReqGetStatus_Post_State_NA,
+ RtemsRatemonReqGetStatus_Post_Elapsed_NA,
+ RtemsRatemonReqGetStatus_Post_Consumed_NA,
+ RtemsRatemonReqGetStatus_Post_Postponed_NA },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqGetStatus_Post_Status_InvAddr,
+ RtemsRatemonReqGetStatus_Post_Owner_Nop,
+ RtemsRatemonReqGetStatus_Post_State_Nop,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Nop },
+ { 0, 0, 0, 0, 1, 1, 1, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Inactive,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Zero,
+ RtemsRatemonReqGetStatus_Post_Consumed_Zero,
+ RtemsRatemonReqGetStatus_Post_Postponed_NA },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Post_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Post_Postponed_Zero },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Post_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Post_Postponed_One },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Post_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Post_Postponed_Several },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Expired,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Post_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Post_Postponed_One },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Expired,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Time,
+ RtemsRatemonReqGetStatus_Post_Consumed_CpuTime,
+ RtemsRatemonReqGetStatus_Post_Postponed_Several },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqGetStatus_Post_Status_InvId,
+ RtemsRatemonReqGetStatus_Post_Owner_Nop,
+ RtemsRatemonReqGetStatus_Post_State_Nop,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Nop }
+};
+
+static const uint8_t
+RtemsRatemonReqGetStatus_Map[] = {
+ 5, 1, 1, 6, 7, 8, 3, 9, 10, 11, 1, 1, 2, 2, 2, 3, 2, 2, 4, 1, 1, 0, 0, 0, 3,
+ 0, 0, 4, 1, 1, 0, 0, 0, 3, 0, 0
+};
+
+static size_t RtemsRatemonReqGetStatus_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsRatemonReqGetStatus_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope(
+ RtemsRatemonReqGetStatus_PreDesc,
+ buf,
+ n,
+ ctx->Map.pcs
+ );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsRatemonReqGetStatus_Fixture = {
+ .setup = RtemsRatemonReqGetStatus_Setup_Wrap,
+ .stop = NULL,
+ .teardown = RtemsRatemonReqGetStatus_Teardown_Wrap,
+ .scope = RtemsRatemonReqGetStatus_Scope,
+ .initial_context = &RtemsRatemonReqGetStatus_Instance
+};
+
+static inline RtemsRatemonReqGetStatus_Entry RtemsRatemonReqGetStatus_PopEntry(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsRatemonReqGetStatus_Entries[
+ RtemsRatemonReqGetStatus_Map[ index ]
+ ];
+}
+
+static void RtemsRatemonReqGetStatus_SetPreConditionStates(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+
+ if ( ctx->Map.entry.Pre_Elapsed_NA ) {
+ ctx->Map.pcs[ 3 ] = RtemsRatemonReqGetStatus_Pre_Elapsed_NA;
+ } else {
+ ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
+ }
+
+ if ( ctx->Map.entry.Pre_Consumed_NA ) {
+ ctx->Map.pcs[ 4 ] = RtemsRatemonReqGetStatus_Pre_Consumed_NA;
+ } else {
+ ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
+ }
+
+ if ( ctx->Map.entry.Pre_Postponed_NA ) {
+ ctx->Map.pcs[ 5 ] = RtemsRatemonReqGetStatus_Pre_Postponed_NA;
+ } else {
+ ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ];
+ }
+}
+
+static void RtemsRatemonReqGetStatus_TestVariant(
+ RtemsRatemonReqGetStatus_Context *ctx
+)
+{
+ RtemsRatemonReqGetStatus_Pre_StatusAddr_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsRatemonReqGetStatus_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsRatemonReqGetStatus_Pre_State_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsRatemonReqGetStatus_Pre_Elapsed_Prepare( ctx, ctx->Map.pcs[ 3 ] );
+ RtemsRatemonReqGetStatus_Pre_Consumed_Prepare( ctx, ctx->Map.pcs[ 4 ] );
+ RtemsRatemonReqGetStatus_Pre_Postponed_Prepare( ctx, ctx->Map.pcs[ 5 ] );
+ RtemsRatemonReqGetStatus_Action( ctx );
+ RtemsRatemonReqGetStatus_Post_Status_Check(
+ ctx,
+ ctx->Map.entry.Post_Status
+ );
+ RtemsRatemonReqGetStatus_Post_Owner_Check( ctx, ctx->Map.entry.Post_Owner );
+ RtemsRatemonReqGetStatus_Post_State_Check( ctx, ctx->Map.entry.Post_State );
+ RtemsRatemonReqGetStatus_Post_Elapsed_Check(
+ ctx,
+ ctx->Map.entry.Post_Elapsed
+ );
+ RtemsRatemonReqGetStatus_Post_Consumed_Check(
+ ctx,
+ ctx->Map.entry.Post_Consumed
+ );
+ RtemsRatemonReqGetStatus_Post_Postponed_Check(
+ ctx,
+ ctx->Map.entry.Post_Postponed
+ );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonReqGetStatus( void )
+ */
+T_TEST_CASE_FIXTURE(
+ RtemsRatemonReqGetStatus,
+ &RtemsRatemonReqGetStatus_Fixture
+)
+{
+ RtemsRatemonReqGetStatus_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pci[ 0 ] = RtemsRatemonReqGetStatus_Pre_StatusAddr_Valid;
+ ctx->Map.pci[ 0 ] < RtemsRatemonReqGetStatus_Pre_StatusAddr_NA;
+ ++ctx->Map.pci[ 0 ]
+ ) {
+ for (
+ ctx->Map.pci[ 1 ] = RtemsRatemonReqGetStatus_Pre_Id_Valid;
+ ctx->Map.pci[ 1 ] < RtemsRatemonReqGetStatus_Pre_Id_NA;
+ ++ctx->Map.pci[ 1 ]
+ ) {
+ for (
+ ctx->Map.pci[ 2 ] = RtemsRatemonReqGetStatus_Pre_State_Inactive;
+ ctx->Map.pci[ 2 ] < RtemsRatemonReqGetStatus_Pre_State_NA;
+ ++ctx->Map.pci[ 2 ]
+ ) {
+ for (
+ ctx->Map.pci[ 3 ] = RtemsRatemonReqGetStatus_Pre_Elapsed_Time;
+ ctx->Map.pci[ 3 ] < RtemsRatemonReqGetStatus_Pre_Elapsed_NA;
+ ++ctx->Map.pci[ 3 ]
+ ) {
+ for (
+ ctx->Map.pci[ 4 ] = RtemsRatemonReqGetStatus_Pre_Consumed_CpuTime;
+ ctx->Map.pci[ 4 ] < RtemsRatemonReqGetStatus_Pre_Consumed_NA;
+ ++ctx->Map.pci[ 4 ]
+ ) {
+ for (
+ ctx->Map.pci[ 5 ] = RtemsRatemonReqGetStatus_Pre_Postponed_Zero;
+ ctx->Map.pci[ 5 ] < RtemsRatemonReqGetStatus_Pre_Postponed_NA;
+ ++ctx->Map.pci[ 5 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqGetStatus_PopEntry( ctx );
+
+ if ( ctx->Map.entry.Skip ) {
+ continue;
+ }
+
+ RtemsRatemonReqGetStatus_SetPreConditionStates( ctx );
+ RtemsRatemonReqGetStatus_Prepare( ctx );
+ RtemsRatemonReqGetStatus_TestVariant( ctx );
+ RtemsRatemonReqGetStatus_Cleanup( ctx );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-ident.c b/testsuites/validation/tc-ratemon-ident.c
new file mode 100644
index 0000000000..1126fcacab
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-ident.c
@@ -0,0 +1,114 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonValIdent
+ */
+
+/*
+ * 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 RTEMSTestCaseRtemsRatemonValIdent spec:/rtems/ratemon/val/ident
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @brief Test the rtems_rate_monotonic_ident() directive.
+ *
+ * This test case performs the following actions:
+ *
+ * - Run the generic object identification tests for Classic API rate monotonic
+ * class objects defined by /rtems/req/ident-local.
+ *
+ * @{
+ */
+
+static rtems_status_code ClassicRatemonIdentAction(
+ rtems_name name,
+ rtems_id *id
+)
+{
+ return rtems_rate_monotonic_ident( name, id );
+}
+
+/**
+ * @brief Run the generic object identification tests for Classic API rate
+ * monotonic class objects defined by /rtems/req/ident-local.
+ */
+static void RtemsRatemonValIdent_Action_0( void )
+{
+ rtems_status_code sc;
+ rtems_id id_local_object;
+
+ sc = rtems_rate_monotonic_create(
+ ClassicObjectLocalIdentName,
+ &id_local_object
+ );
+ T_assert_rsc_success( sc );
+
+ RtemsReqIdentLocal_Run(
+ id_local_object,
+ ClassicRatemonIdentAction
+ );
+
+ sc = rtems_rate_monotonic_delete( id_local_object );
+ T_rsc_success( sc );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonValIdent( void )
+ */
+T_TEST_CASE( RtemsRatemonValIdent )
+{
+ RtemsRatemonValIdent_Action_0();
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-period.c b/testsuites/validation/tc-ratemon-period.c
new file mode 100644
index 0000000000..9e2d294581
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-period.c
@@ -0,0 +1,1273 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonReqPeriod
+ */
+
+/*
+ * 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 RTEMSTestCaseRtemsRatemonReqPeriod spec:/rtems/ratemon/req/period
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationOneCpu0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsRatemonReqPeriod_Pre_Id_Valid,
+ RtemsRatemonReqPeriod_Pre_Id_Invalid,
+ RtemsRatemonReqPeriod_Pre_Id_NA
+} RtemsRatemonReqPeriod_Pre_Id;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Pre_Caller_OwnerTask,
+ RtemsRatemonReqPeriod_Pre_Caller_OtherTask,
+ RtemsRatemonReqPeriod_Pre_Caller_NA
+} RtemsRatemonReqPeriod_Pre_Caller;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Pre_Length_Ticks,
+ RtemsRatemonReqPeriod_Pre_Length_Status,
+ RtemsRatemonReqPeriod_Pre_Length_NA
+} RtemsRatemonReqPeriod_Pre_Length;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Pre_State_Inactive,
+ RtemsRatemonReqPeriod_Pre_State_Active,
+ RtemsRatemonReqPeriod_Pre_State_Expired,
+ RtemsRatemonReqPeriod_Pre_State_NA
+} RtemsRatemonReqPeriod_Pre_State;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Pre_Postponed_Zero,
+ RtemsRatemonReqPeriod_Pre_Postponed_One,
+ RtemsRatemonReqPeriod_Pre_Postponed_Several,
+ RtemsRatemonReqPeriod_Pre_Postponed_NA
+} RtemsRatemonReqPeriod_Pre_Postponed;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Pre_InactiveCause_New,
+ RtemsRatemonReqPeriod_Pre_InactiveCause_Canceled,
+ RtemsRatemonReqPeriod_Pre_InactiveCause_NA
+} RtemsRatemonReqPeriod_Pre_InactiveCause;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Post_Status_Ok,
+ RtemsRatemonReqPeriod_Post_Status_InvId,
+ RtemsRatemonReqPeriod_Post_Status_NotOwn,
+ RtemsRatemonReqPeriod_Post_Status_NotDef,
+ RtemsRatemonReqPeriod_Post_Status_TimeOut,
+ RtemsRatemonReqPeriod_Post_Status_NA
+} RtemsRatemonReqPeriod_Post_Status;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Post_State_Inactive,
+ RtemsRatemonReqPeriod_Post_State_Active,
+ RtemsRatemonReqPeriod_Post_State_Expired,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_State_NA
+} RtemsRatemonReqPeriod_Post_State;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Post_Postponed_Zero,
+ RtemsRatemonReqPeriod_Post_Postponed_OneOrMore,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_NA
+} RtemsRatemonReqPeriod_Post_Postponed;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Delay_TillDeadline,
+ RtemsRatemonReqPeriod_Post_Delay_NA
+} RtemsRatemonReqPeriod_Post_Delay;
+
+typedef enum {
+ RtemsRatemonReqPeriod_Post_Scheduler_Called,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop,
+ RtemsRatemonReqPeriod_Post_Scheduler_NA
+} RtemsRatemonReqPeriod_Post_Scheduler;
+
+typedef struct {
+ uint32_t Skip : 1;
+ uint32_t Pre_Id_NA : 1;
+ uint32_t Pre_Caller_NA : 1;
+ uint32_t Pre_Length_NA : 1;
+ uint32_t Pre_State_NA : 1;
+ uint32_t Pre_Postponed_NA : 1;
+ uint32_t Pre_InactiveCause_NA : 1;
+ uint32_t Post_Status : 3;
+ uint32_t Post_State : 3;
+ uint32_t Post_Postponed : 2;
+ uint32_t Post_Delay : 2;
+ uint32_t Post_Scheduler : 2;
+} RtemsRatemonReqPeriod_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/req/period test case.
+ */
+typedef struct {
+ /**
+ * @brief This member contains a valid identifier of a period.
+ */
+ rtems_id period_id;
+
+ /**
+ * @brief This member is used to receive the
+ * rtems_rate_monotonic_period_status after the action.
+ */
+ rtems_rate_monotonic_period_status period_status;
+
+ /**
+ * @brief This member specifies the ``id`` parameter for the action.
+ */
+ rtems_id id_param;
+
+ /**
+ * @brief This member specifies the ``length`` parameter for the action.
+ */
+ rtems_interval length_param;
+
+ /**
+ * @brief This member contains the returned status code of the action.
+ */
+ rtems_status_code status;
+
+ /**
+ * @brief This member contains the pointer to the function which executes the
+ * action.
+ *
+ * The action is either executed by the owner task or by the worker task
+ * depending on the function pointer used here. ``ctx_arg`` must be a
+ * pointer to this context structure.
+ */
+ uint32_t ( *do_action )( void *ctx, void (*todo)( void *ctx_arg ) );
+
+ /**
+ * @brief This member serves to pass the pointer to the function which the
+ * work owner task shall execute from function ``OwnerDoWork`` to function
+ * ``WorkerTask``.
+ */
+ void (*worker_todo)( void *ctx );
+
+ /**
+ * @brief This member contains the owner task identifier of the owner task.
+ */
+ rtems_id task_id;
+
+ /**
+ * @brief This member contains the owner task identifier of the worker task
+ * (which is not the owner task).
+ */
+ rtems_id worker_id;
+
+ /**
+ * @brief This member contains a backup of the task priority before the
+ * execution of this test.
+ */
+ rtems_id original_priority;
+
+ /**
+ * @brief This member contains the number of postponed jobs before the
+ * action.
+ */
+ uint32_t postponed_jobs_count;
+
+ /**
+ * @brief This member contains the state before the action.
+ */
+ rtems_rate_monotonic_period_states previous_state;
+
+ /**
+ * @brief This member contains the number of clock ticks passed since the
+ * test started.
+ */
+ uint32_t test_duration;
+
+ /**
+ * @brief This member contains the number of clock ticks passed since the
+ * test started till (before) the rtems_rate_monotonic_period() action is
+ * invoked.
+ */
+ uint32_t test_duration_till_action;
+
+ /**
+ * @brief This member contains the number of times the
+ * rtems_rate_monotonic_period() function returned since the test started.
+ */
+ uint32_t period_calls;
+
+ /**
+ * @brief This member contains the number of clock ticks which passed in the
+ * action till the rtems_rate_monotonic_period() function returned.
+ */
+ uint32_t action_duration;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition indices for the next
+ * action.
+ */
+ size_t pci[ 6 ];
+
+ /**
+ * @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.
+ */
+ RtemsRatemonReqPeriod_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsRatemonReqPeriod_Context;
+
+static RtemsRatemonReqPeriod_Context
+ RtemsRatemonReqPeriod_Instance;
+
+static const char * const RtemsRatemonReqPeriod_PreDesc_Id[] = {
+ "Valid",
+ "Invalid",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqPeriod_PreDesc_Caller[] = {
+ "OwnerTask",
+ "OtherTask",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqPeriod_PreDesc_Length[] = {
+ "Ticks",
+ "Status",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqPeriod_PreDesc_State[] = {
+ "Inactive",
+ "Active",
+ "Expired",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqPeriod_PreDesc_Postponed[] = {
+ "Zero",
+ "One",
+ "Several",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqPeriod_PreDesc_InactiveCause[] = {
+ "New",
+ "Canceled",
+ "NA"
+};
+
+static const char * const * const RtemsRatemonReqPeriod_PreDesc[] = {
+ RtemsRatemonReqPeriod_PreDesc_Id,
+ RtemsRatemonReqPeriod_PreDesc_Caller,
+ RtemsRatemonReqPeriod_PreDesc_Length,
+ RtemsRatemonReqPeriod_PreDesc_State,
+ RtemsRatemonReqPeriod_PreDesc_Postponed,
+ RtemsRatemonReqPeriod_PreDesc_InactiveCause,
+ NULL
+};
+
+static const rtems_interval period_length = 5;
+static const rtems_task_priority background_task_priority = 100;
+static const rtems_task_priority foreground_task_priority = 10;
+static const rtems_event_set wake_main_task_event = RTEMS_EVENT_17;
+
+static void TickTheClock(
+ RtemsRatemonReqPeriod_Context *ctx,
+ uint32_t ticks
+)
+{
+ uint32_t i;
+ for ( i = 0; i < ticks; ++i ) {
+ TimecounterTick();
+ ctx->test_duration++;
+ }
+}
+
+static rtems_status_code CallPeriodFunction(
+ RtemsRatemonReqPeriod_Context *ctx,
+ rtems_id id,
+ rtems_interval length
+)
+{
+ rtems_status_code status;
+ status = rtems_rate_monotonic_period( id, length );
+ ctx->period_calls++;
+ return status;
+}
+
+static void CreatePeriod( void *ctx_in )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ rtems_status_code status;
+ status = rtems_rate_monotonic_create(
+ rtems_build_name( 'R', 'M', 'O', 'N' ),
+ &ctx->period_id
+ );
+ T_rsc_success( status );
+}
+
+static void DeletePeriod( void *ctx_in )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ T_rsc_success( rtems_rate_monotonic_delete( ctx->period_id ) );
+}
+
+static void CancelPeriod( void *ctx_in )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ T_rsc_success( rtems_rate_monotonic_cancel( ctx->period_id ) );
+}
+
+static void CallPeriod( void *ctx_in )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ T_rsc_success( CallPeriodFunction( ctx, ctx->period_id, period_length ) );
+}
+
+static void CallPeriodTimeout( void *ctx_in )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ rtems_status_code status;
+ status = CallPeriodFunction( ctx, ctx->period_id, period_length );
+ T_rsc( status, RTEMS_TIMEOUT );
+}
+
+static void DoAction( void *ctx_in )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ ctx->status = CallPeriodFunction( ctx, ctx->id_param, ctx->length_param );
+}
+
+static void WorkerTask( rtems_task_argument argument )
+{
+ RtemsRatemonReqPeriod_Context *ctx =
+ (RtemsRatemonReqPeriod_Context *) argument;
+ if ( ctx != NULL ) {
+ ctx->worker_todo( ctx );
+ T_rsc_success( rtems_event_send( ctx->task_id, wake_main_task_event ) );
+ }
+ T_rsc_success( rtems_task_suspend( RTEMS_SELF ) );
+}
+
+static uint32_t OwnerDoWork( void *ctx_in, void (*todo)( void *ctx_arg ) )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ uint32_t ticks_to_wait = period_length + 1;
+ rtems_status_code status;
+ rtems_event_set event_set;
+
+ ctx->worker_todo = todo;
+ status = rtems_task_restart( ctx->worker_id, (rtems_task_argument) ctx );
+ T_rsc_success( status );
+
+ for ( ; ticks_to_wait > 0; --ticks_to_wait ) {
+ /* Check whether the worker finished executing the action */
+ status = rtems_event_receive(
+ RTEMS_PENDING_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &event_set
+ );
+ T_rsc_success( status );
+
+ if ( ( event_set & wake_main_task_event ) == wake_main_task_event ) {
+ break;
+ }
+ TickTheClock( ctx, 1 );
+ }
+
+ /* Wait till the worker task finishes */
+ status = rtems_event_receive(
+ wake_main_task_event,
+ RTEMS_DEFAULT_OPTIONS,
+ RTEMS_NO_TIMEOUT,
+ &event_set
+ );
+ T_rsc_success( status );
+
+ return period_length + 1 - ticks_to_wait;
+}
+
+static uint32_t OtherDoWork( void *ctx_in, void (*todo)( void *ctx_arg ) )
+{
+ RtemsRatemonReqPeriod_Context *ctx = ctx_in;
+ todo( ctx );
+ /* Duration = 0 ticks as DoAction() does not call TickTheClock() */
+ return 0;
+}
+
+static void CreatePostponedJobs(
+ RtemsRatemonReqPeriod_Context *ctx,
+ uint32_t jobs_count
+)
+{
+ ctx->postponed_jobs_count = jobs_count;
+ if ( ctx->previous_state == RATE_MONOTONIC_ACTIVE ) {
+ TickTheClock( ctx, ( jobs_count + 1 ) * period_length );
+ OwnerDoWork( ctx, CallPeriodTimeout );
+ } else {
+ /* ctx->previous_state == RATE_MONOTONIC_INACTIVE || _EXPIRED */
+ TickTheClock( ctx, jobs_count * period_length );
+ }
+}
+
+static void RtemsRatemonReqPeriod_Pre_Id_Prepare(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Pre_Id state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Pre_Id_Valid: {
+ /*
+ * While the ``id`` parameter is valid.
+ */
+ ctx->id_param = ctx->period_id;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Id_Invalid: {
+ /*
+ * While the ``id`` parameter is invalid.
+ */
+ ctx->id_param = RTEMS_ID_NONE;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Id_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Pre_Caller_Prepare(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Pre_Caller state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Pre_Caller_OwnerTask: {
+ /*
+ * While the task invoking rtems_rate_monotonic_period() is the task
+ * which created the period - the owner task.
+ */
+ ctx->do_action = OwnerDoWork;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Caller_OtherTask: {
+ /*
+ * While the task invoking rtems_rate_monotonic_period() is not the owner
+ * task.
+ */
+ ctx->do_action = OtherDoWork;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Caller_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Pre_Length_Prepare(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Pre_Length state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Pre_Length_Ticks: {
+ /*
+ * While the ``length`` parameter is a number larger than 0.
+ *
+ * Note:
+ *
+ * * RTEMS_PERIOD_STATUS == 0
+ *
+ * * The ``length`` parameter of all calls to
+ * rtems_rate_monotonic_period() must have the same value (see
+ * interval).
+ */
+ ctx->length_param = period_length;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Length_Status: {
+ /*
+ * While the ``length`` parameter is RTEMS_PERIOD_STATUS.
+ */
+ ctx->length_param = RTEMS_PERIOD_STATUS;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Length_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Pre_State_Prepare(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Pre_State state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Pre_State_Inactive: {
+ /*
+ * While the ``id`` parameter references an period object in inactive
+ * state.
+ */
+ /* Nothing to do here as the period is newly created. */
+ ctx->previous_state = RATE_MONOTONIC_INACTIVE;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_State_Active: {
+ /*
+ * While the ``id`` parameter references an period object in active
+ * state.
+ */
+ OwnerDoWork( ctx, CallPeriod );
+ ctx->previous_state = RATE_MONOTONIC_ACTIVE;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_State_Expired: {
+ /*
+ * While the ``id`` parameter references an period object in expired
+ * state.
+ */
+ OwnerDoWork( ctx, CallPeriod );
+ ctx->previous_state = RATE_MONOTONIC_EXPIRED;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_State_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Pre_Postponed_Prepare(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Pre_Postponed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Pre_Postponed_Zero: {
+ /*
+ * While there is no postponed job.
+ */
+ ctx->postponed_jobs_count = 0;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Postponed_One: {
+ /*
+ * While there is one postponed job.
+ */
+ CreatePostponedJobs( ctx, 1 );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Postponed_Several: {
+ /*
+ * While there are two or more postponed jobs.
+ */
+ CreatePostponedJobs( ctx, 5 );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_Postponed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Pre_InactiveCause_Prepare(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Pre_InactiveCause state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Pre_InactiveCause_New: {
+ /*
+ * While rtems_rate_monotonic_period() has never been invoked with result
+ * RTEMS_SUCCESSFUL on the period object referenced by the ``id``
+ * parameter since that period object has been created.
+ */
+ /* Nothing to do here as the period is newly created. */
+ ctx->postponed_jobs_count = 0;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_InactiveCause_Canceled: {
+ /*
+ * While rtems_rate_monotonic_period() has never been invoked with result
+ * RTEMS_SUCCESSFUL on the period object referenced by the ``id``
+ * parameter since that period object has been canceled using
+ * rtems_rate_monotonic_cancel().
+ */
+ if ( ctx->period_calls == 0 ) {
+ OwnerDoWork( ctx, CallPeriod );
+ TickTheClock( ctx, ctx->postponed_jobs_count * period_length );
+ }
+ OwnerDoWork( ctx, CancelPeriod );
+ ctx->postponed_jobs_count = 0;
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Pre_InactiveCause_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Post_Status_Check(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Post_Status state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Post_Status_Ok: {
+ /*
+ * The return status of rtems_rate_monotonic_period() shall be
+ * RTEMS_SUCCESSFUL
+ */
+ T_rsc_success( ctx->status );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Status_InvId: {
+ /*
+ * The return status of rtems_rate_monotonic_period() shall be
+ * RTEMS_INVALID_ID.
+ */
+ T_rsc( ctx->status, RTEMS_INVALID_ID );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Status_NotOwn: {
+ /*
+ * The return status of rtems_rate_monotonic_period() shall be
+ * RTEMS_NOT_OWNER_OF_RESOURCE.
+ */
+ T_rsc( ctx->status, RTEMS_NOT_OWNER_OF_RESOURCE );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Status_NotDef: {
+ /*
+ * The return status of rtems_rate_monotonic_period() shall be
+ * RTEMS_NOT_DEFINED.
+ */
+ T_rsc( ctx->status, RTEMS_NOT_DEFINED );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Status_TimeOut: {
+ /*
+ * The return status of rtems_rate_monotonic_period() shall be
+ * RTEMS_TIMEOUT.
+ */
+ T_rsc( ctx->status, RTEMS_TIMEOUT );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Status_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Post_State_Check(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Post_State state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Post_State_Inactive: {
+ /*
+ * The state of the period shall be inactive after the return of the
+ * rtems_rate_monotonic_period() call.
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_INACTIVE );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_State_Active: {
+ /*
+ * The state of the period shall be RATE_MONOTONIC_ACTIVE after the
+ * return of the rtems_rate_monotonic_period() call.
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_ACTIVE );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_State_Expired: {
+ /*
+ * The state of the period shall be RATE_MONOTONIC_EXPIRED after the
+ * return of the rtems_rate_monotonic_period() call.
+ */
+ T_eq_int( ctx->period_status.state, RATE_MONOTONIC_EXPIRED );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_State_Nop: {
+ /*
+ * Objects referenced by the ``id`` parameter in past calls to
+ * rtems_rate_monotonic_period() shall not be accessed by the
+ * rtems_rate_monotonic_period() call (see also Nop).
+ */
+ T_eq_u32( ctx->period_status.state, ctx->previous_state );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_State_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Post_Postponed_Check(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Post_Postponed state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Post_Postponed_Zero: {
+ /*
+ * There shall be no postponed jobs after the return of the
+ * rtems_rate_monotonic_period() call.
+ */
+ T_eq_u32( ctx->period_status.postponed_jobs_count, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Postponed_OneOrMore: {
+ /*
+ * The number of postponed jobs shall be the number of deadlines passed
+ * minus the number of returned calls to rtems_rate_monotonic_period().
+ *
+ * The last call to rtems_rate_monotonic_period() where the state changes
+ * from inactive to RATE_MONOTONIC_ACTIVE is counted as the first
+ * returned call. The first deadline occurred at a point in time during
+ * that call to rtems_rate_monotonic_period().
+ */
+ T_eq_u32(
+ ctx->period_status.postponed_jobs_count,
+ ( ctx->test_duration / period_length + 1 ) - ctx->period_calls
+ );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Postponed_Nop: {
+ /*
+ * Objects referenced by the ``id`` parameter in past calls to
+ * rtems_rate_monotonic_period() shall not be accessed by the
+ * rtems_rate_monotonic_period() call (see also Nop).
+ */
+ T_eq_u32(
+ ctx->period_status.postponed_jobs_count,
+ ctx->postponed_jobs_count
+ );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Postponed_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Post_Delay_Check(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Post_Delay state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Post_Delay_None: {
+ /*
+ * The last call to rtems_rate_monotonic_period() shall return without
+ * delay.
+ */
+ T_eq_u32( ctx->action_duration, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Delay_TillDeadline: {
+ /*
+ * The last call to rtems_rate_monotonic_period() shall block the owner
+ * task till the next deadline and return afterwards.
+ */
+ T_eq_u32(
+ ctx->action_duration,
+ ( ctx->test_duration_till_action % period_length + 1 ) * period_length -
+ ctx->test_duration_till_action
+ );
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Delay_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Post_Scheduler_Check(
+ RtemsRatemonReqPeriod_Context *ctx,
+ RtemsRatemonReqPeriod_Post_Scheduler state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqPeriod_Post_Scheduler_Called: {
+ /*
+ * The last call of the rtems_rate_monotonic_period() function shall
+ * execute the ``release_job`` scheduler operation of the home scheduler.
+ */
+ /* Cannot be tested as the effect is unknown. */
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Scheduler_Nop: {
+ /*
+ * The last call of the rtems_rate_monotonic_period() function shall not
+ * execute any scheduler operation.
+ */
+ /* Cannot be tested as the effect is unknown. */
+ break;
+ }
+
+ case RtemsRatemonReqPeriod_Post_Scheduler_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqPeriod_Setup( RtemsRatemonReqPeriod_Context *ctx )
+{
+ rtems_status_code status;
+ rtems_task_priority priority;
+ rtems_event_set event_set;
+ ctx->worker_id = RTEMS_INVALID_ID;
+
+ status = rtems_task_ident(
+ RTEMS_SELF,
+ RTEMS_SEARCH_ALL_NODES,
+ &ctx->task_id
+ );
+ T_rsc_success( status );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ RTEMS_CURRENT_PRIORITY,
+ &ctx->original_priority
+ );
+ T_rsc_success( status );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ background_task_priority,
+ &priority
+ );
+ T_rsc_success( status );
+
+ status = rtems_task_create(
+ rtems_build_name( 'W', 'O', 'R', 'K' ),
+ foreground_task_priority,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &ctx->worker_id
+ );
+ T_rsc_success( status );
+
+ /* Defensive programming: clean away any pending events */
+ status = rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ RTEMS_NO_TIMEOUT,
+ &event_set
+ );
+ T_true( status == RTEMS_SUCCESSFUL || status == RTEMS_UNSATISFIED );
+
+ status = rtems_task_start(
+ ctx->worker_id,
+ WorkerTask,
+ (rtems_task_argument) NULL
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqPeriod_Setup_Wrap( void *arg )
+{
+ RtemsRatemonReqPeriod_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqPeriod_Setup( ctx );
+}
+
+static void RtemsRatemonReqPeriod_Teardown(
+ RtemsRatemonReqPeriod_Context *ctx
+)
+{
+ rtems_status_code status;
+ rtems_task_priority priority;
+
+ T_rsc_success( rtems_task_delete( ctx->worker_id ) );
+
+ status = rtems_task_set_priority(
+ RTEMS_SELF,
+ ctx->original_priority,
+ &priority
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqPeriod_Teardown_Wrap( void *arg )
+{
+ RtemsRatemonReqPeriod_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqPeriod_Teardown( ctx );
+}
+
+static void RtemsRatemonReqPeriod_Prepare( RtemsRatemonReqPeriod_Context *ctx )
+{
+ rtems_status_code status;
+ rtems_rate_monotonic_period_status period_status;
+ ctx->test_duration = 0;
+ ctx->period_calls = 0;
+ OwnerDoWork( ctx, CreatePeriod );
+
+ /*
+ * In case of a new period the postponed jobs count is arbitrary
+ * (what ever value happens to be stored in that field of the internal data
+ * structure) until period() is called.
+ */
+ status = rtems_rate_monotonic_get_status(
+ ctx->period_id,
+ &period_status
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqPeriod_Action( RtemsRatemonReqPeriod_Context *ctx )
+{
+ rtems_status_code status;
+
+ ctx->test_duration_till_action = ctx->test_duration;
+ ctx->action_duration = ctx->do_action( ctx, DoAction );
+
+ status = rtems_rate_monotonic_get_status(
+ ctx->period_id,
+ &ctx->period_status
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonReqPeriod_Cleanup( RtemsRatemonReqPeriod_Context *ctx )
+{
+ OwnerDoWork( ctx, DeletePeriod );
+}
+
+static const RtemsRatemonReqPeriod_Entry
+RtemsRatemonReqPeriod_Entries[] = {
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_InvId,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_NotOwn,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 1, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_NA,
+ RtemsRatemonReqPeriod_Post_State_NA,
+ RtemsRatemonReqPeriod_Post_Postponed_NA,
+ RtemsRatemonReqPeriod_Post_Delay_NA,
+ RtemsRatemonReqPeriod_Post_Scheduler_NA },
+ { 0, 0, 0, 0, 0, 1, 0, RtemsRatemonReqPeriod_Post_Status_InvId,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqPeriod_Post_Status_InvId,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_Ok,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 1, 0, RtemsRatemonReqPeriod_Post_Status_NotOwn,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqPeriod_Post_Status_NotOwn,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_TimeOut,
+ RtemsRatemonReqPeriod_Post_State_Active,
+ RtemsRatemonReqPeriod_Post_Postponed_Zero,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Called },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_TimeOut,
+ RtemsRatemonReqPeriod_Post_State_Active,
+ RtemsRatemonReqPeriod_Post_Postponed_OneOrMore,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Called },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_TimeOut,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 1, 0, RtemsRatemonReqPeriod_Post_Status_Ok,
+ RtemsRatemonReqPeriod_Post_State_Active,
+ RtemsRatemonReqPeriod_Post_Postponed_Zero,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Called },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqPeriod_Post_Status_Ok,
+ RtemsRatemonReqPeriod_Post_State_Active,
+ RtemsRatemonReqPeriod_Post_Postponed_Zero,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Called },
+ { 0, 0, 0, 0, 0, 1, 0, RtemsRatemonReqPeriod_Post_Status_NotDef,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqPeriod_Post_Status_NotDef,
+ RtemsRatemonReqPeriod_Post_State_Nop,
+ RtemsRatemonReqPeriod_Post_Postponed_Nop,
+ RtemsRatemonReqPeriod_Post_Delay_None,
+ RtemsRatemonReqPeriod_Post_Scheduler_Nop },
+ { 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqPeriod_Post_Status_Ok,
+ RtemsRatemonReqPeriod_Post_State_Active,
+ RtemsRatemonReqPeriod_Post_Postponed_Zero,
+ RtemsRatemonReqPeriod_Post_Delay_TillDeadline,
+ RtemsRatemonReqPeriod_Post_Scheduler_Called }
+};
+
+static const uint8_t
+RtemsRatemonReqPeriod_Map[] = {
+ 11, 12, 11, 12, 11, 12, 15, 15, 8, 8, 9, 9, 2, 2, 8, 8, 9, 9, 13, 14, 13, 14,
+ 13, 14, 5, 5, 5, 5, 5, 5, 2, 2, 10, 10, 10, 10, 6, 7, 6, 7, 6, 7, 1, 1, 1, 1,
+ 1, 1, 2, 2, 1, 1, 1, 1, 6, 7, 6, 7, 6, 7, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1,
+ 3, 4, 3, 4, 3, 4, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 3, 4, 3, 4, 3, 4, 0, 0,
+ 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 3, 4, 3, 4, 3, 4, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0,
+ 0, 0, 3, 4, 3, 4, 3, 4, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0
+};
+
+static size_t RtemsRatemonReqPeriod_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsRatemonReqPeriod_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsRatemonReqPeriod_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsRatemonReqPeriod_Fixture = {
+ .setup = RtemsRatemonReqPeriod_Setup_Wrap,
+ .stop = NULL,
+ .teardown = RtemsRatemonReqPeriod_Teardown_Wrap,
+ .scope = RtemsRatemonReqPeriod_Scope,
+ .initial_context = &RtemsRatemonReqPeriod_Instance
+};
+
+static inline RtemsRatemonReqPeriod_Entry RtemsRatemonReqPeriod_PopEntry(
+ RtemsRatemonReqPeriod_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsRatemonReqPeriod_Entries[
+ RtemsRatemonReqPeriod_Map[ index ]
+ ];
+}
+
+static void RtemsRatemonReqPeriod_SetPreConditionStates(
+ RtemsRatemonReqPeriod_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+ ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
+
+ if ( ctx->Map.entry.Pre_Postponed_NA ) {
+ ctx->Map.pcs[ 4 ] = RtemsRatemonReqPeriod_Pre_Postponed_NA;
+ } else {
+ ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
+ }
+
+ if ( ctx->Map.entry.Pre_InactiveCause_NA ) {
+ ctx->Map.pcs[ 5 ] = RtemsRatemonReqPeriod_Pre_InactiveCause_NA;
+ } else {
+ ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ];
+ }
+}
+
+static void RtemsRatemonReqPeriod_TestVariant(
+ RtemsRatemonReqPeriod_Context *ctx
+)
+{
+ RtemsRatemonReqPeriod_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsRatemonReqPeriod_Pre_Caller_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsRatemonReqPeriod_Pre_Length_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsRatemonReqPeriod_Pre_State_Prepare( ctx, ctx->Map.pcs[ 3 ] );
+ RtemsRatemonReqPeriod_Pre_Postponed_Prepare( ctx, ctx->Map.pcs[ 4 ] );
+ RtemsRatemonReqPeriod_Pre_InactiveCause_Prepare( ctx, ctx->Map.pcs[ 5 ] );
+ RtemsRatemonReqPeriod_Action( ctx );
+ RtemsRatemonReqPeriod_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
+ RtemsRatemonReqPeriod_Post_State_Check( ctx, ctx->Map.entry.Post_State );
+ RtemsRatemonReqPeriod_Post_Postponed_Check(
+ ctx,
+ ctx->Map.entry.Post_Postponed
+ );
+ RtemsRatemonReqPeriod_Post_Delay_Check( ctx, ctx->Map.entry.Post_Delay );
+ RtemsRatemonReqPeriod_Post_Scheduler_Check(
+ ctx,
+ ctx->Map.entry.Post_Scheduler
+ );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonReqPeriod( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsRatemonReqPeriod, &RtemsRatemonReqPeriod_Fixture )
+{
+ RtemsRatemonReqPeriod_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pci[ 0 ] = RtemsRatemonReqPeriod_Pre_Id_Valid;
+ ctx->Map.pci[ 0 ] < RtemsRatemonReqPeriod_Pre_Id_NA;
+ ++ctx->Map.pci[ 0 ]
+ ) {
+ for (
+ ctx->Map.pci[ 1 ] = RtemsRatemonReqPeriod_Pre_Caller_OwnerTask;
+ ctx->Map.pci[ 1 ] < RtemsRatemonReqPeriod_Pre_Caller_NA;
+ ++ctx->Map.pci[ 1 ]
+ ) {
+ for (
+ ctx->Map.pci[ 2 ] = RtemsRatemonReqPeriod_Pre_Length_Ticks;
+ ctx->Map.pci[ 2 ] < RtemsRatemonReqPeriod_Pre_Length_NA;
+ ++ctx->Map.pci[ 2 ]
+ ) {
+ for (
+ ctx->Map.pci[ 3 ] = RtemsRatemonReqPeriod_Pre_State_Inactive;
+ ctx->Map.pci[ 3 ] < RtemsRatemonReqPeriod_Pre_State_NA;
+ ++ctx->Map.pci[ 3 ]
+ ) {
+ for (
+ ctx->Map.pci[ 4 ] = RtemsRatemonReqPeriod_Pre_Postponed_Zero;
+ ctx->Map.pci[ 4 ] < RtemsRatemonReqPeriod_Pre_Postponed_NA;
+ ++ctx->Map.pci[ 4 ]
+ ) {
+ for (
+ ctx->Map.pci[ 5 ] = RtemsRatemonReqPeriod_Pre_InactiveCause_New;
+ ctx->Map.pci[ 5 ] < RtemsRatemonReqPeriod_Pre_InactiveCause_NA;
+ ++ctx->Map.pci[ 5 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqPeriod_PopEntry( ctx );
+
+ if ( ctx->Map.entry.Skip ) {
+ continue;
+ }
+
+ RtemsRatemonReqPeriod_SetPreConditionStates( ctx );
+ RtemsRatemonReqPeriod_Prepare( ctx );
+ RtemsRatemonReqPeriod_TestVariant( ctx );
+ RtemsRatemonReqPeriod_Cleanup( ctx );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-timeout.c b/testsuites/validation/tc-ratemon-timeout.c
new file mode 100644
index 0000000000..b70a5cc85c
--- /dev/null
+++ b/testsuites/validation/tc-ratemon-timeout.c
@@ -0,0 +1,962 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonReqTimeout
+ */
+
+/*
+ * 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/test-scheduler.h>
+#include <rtems/rtems/ratemonimpl.h>
+
+#include "tx-support.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsRatemonReqTimeout \
+ * spec:/rtems/ratemon/req/timeout
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationOneCpu0
+ *
+ * @{
+ */
+
+typedef enum {
+ RtemsRatemonReqTimeout_Pre_WaitFor_PeriodSelf,
+ RtemsRatemonReqTimeout_Pre_WaitFor_PeriodOther,
+ RtemsRatemonReqTimeout_Pre_WaitFor_Other,
+ RtemsRatemonReqTimeout_Pre_WaitFor_NA
+} RtemsRatemonReqTimeout_Pre_WaitFor;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Pre_WaitState_Blocked,
+ RtemsRatemonReqTimeout_Pre_WaitState_IntendToBlock,
+ RtemsRatemonReqTimeout_Pre_WaitState_NA
+} RtemsRatemonReqTimeout_Pre_WaitState;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Pre_PostponedJobs_Zero,
+ RtemsRatemonReqTimeout_Pre_PostponedJobs_NotZeroOrMax,
+ RtemsRatemonReqTimeout_Pre_PostponedJobs_Max,
+ RtemsRatemonReqTimeout_Pre_PostponedJobs_NA
+} RtemsRatemonReqTimeout_Pre_PostponedJobs;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_PostponedJobs_Nop,
+ RtemsRatemonReqTimeout_Post_PostponedJobs_PlusOne,
+ RtemsRatemonReqTimeout_Post_PostponedJobs_NA
+} RtemsRatemonReqTimeout_Post_PostponedJobs;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_ReleaseJob_Yes,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_No,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_NA
+} RtemsRatemonReqTimeout_Post_ReleaseJob;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_Unblock_Yes,
+ RtemsRatemonReqTimeout_Post_Unblock_No,
+ RtemsRatemonReqTimeout_Post_Unblock_NA
+} RtemsRatemonReqTimeout_Post_Unblock;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_PeriodState_Active,
+ RtemsRatemonReqTimeout_Post_PeriodState_Expired,
+ RtemsRatemonReqTimeout_Post_PeriodState_NA
+} RtemsRatemonReqTimeout_Post_PeriodState;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_Timer_Active,
+ RtemsRatemonReqTimeout_Post_Timer_NA
+} RtemsRatemonReqTimeout_Post_Timer;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_Uptime_Nop,
+ RtemsRatemonReqTimeout_Post_Uptime_Set,
+ RtemsRatemonReqTimeout_Post_Uptime_NA
+} RtemsRatemonReqTimeout_Post_Uptime;
+
+typedef enum {
+ RtemsRatemonReqTimeout_Post_CPUUsage_Nop,
+ RtemsRatemonReqTimeout_Post_CPUUsage_Set,
+ RtemsRatemonReqTimeout_Post_CPUUsage_NA
+} RtemsRatemonReqTimeout_Post_CPUUsage;
+
+typedef struct {
+ uint32_t Skip : 1;
+ uint32_t Pre_WaitFor_NA : 1;
+ uint32_t Pre_WaitState_NA : 1;
+ uint32_t Pre_PostponedJobs_NA : 1;
+ uint32_t Post_PostponedJobs : 2;
+ uint32_t Post_ReleaseJob : 2;
+ uint32_t Post_Unblock : 2;
+ uint32_t Post_PeriodState : 2;
+ uint32_t Post_Timer : 1;
+ uint32_t Post_Uptime : 2;
+ uint32_t Post_CPUUsage : 2;
+} RtemsRatemonReqTimeout_Entry;
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/req/timeout test case.
+ */
+typedef struct {
+ /**
+ * @brief This member contains the period identifier.
+ */
+ rtems_id period_id;
+
+ /**
+ * @brief This member references the period control block.
+ */
+ Rate_monotonic_Control *period;
+
+ /**
+ * @brief This member contains another period identifier.
+ */
+ rtems_id other_period_id;
+
+ /**
+ * @brief This member contains the worker task identifier.
+ */
+ rtems_id worker_id;
+
+ /**
+ * @brief This member contains the call within ISR request.
+ */
+ CallWithinISRRequest request;
+
+ /**
+ * @brief If this member is true, then the worker shall wait for a period.
+ */
+ bool wait_for_period;
+
+ /**
+ * @brief If this member is true, then the worker shall wait for another
+ * period.
+ */
+ bool period_is_other;
+
+ /**
+ * @brief If this member is true, then the worker shall intend to block for a
+ * period.
+ */
+ bool intend_to_block;
+
+ /**
+ * @brief This member contains the postponed jobs count before the timeout.
+ */
+ uint32_t postponed_jobs;
+
+ /**
+ * @brief This member contains the uptime of the period before the timeout.
+ */
+ Timestamp_Control uptime_before;
+
+ /**
+ * @brief This member contains the CPU usage of the period before the
+ * timeout.
+ */
+ Timestamp_Control cpu_usage_before;
+
+ /**
+ * @brief This member contains the release job counter.
+ */
+ uint32_t release_job_counter;
+
+ /**
+ * @brief This member contains the unblock counter.
+ */
+ uint32_t unblock_counter;
+
+ 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.
+ */
+ 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.
+ */
+ RtemsRatemonReqTimeout_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} RtemsRatemonReqTimeout_Context;
+
+static RtemsRatemonReqTimeout_Context
+ RtemsRatemonReqTimeout_Instance;
+
+static const char * const RtemsRatemonReqTimeout_PreDesc_WaitFor[] = {
+ "PeriodSelf",
+ "PeriodOther",
+ "Other",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqTimeout_PreDesc_WaitState[] = {
+ "Blocked",
+ "IntendToBlock",
+ "NA"
+};
+
+static const char * const RtemsRatemonReqTimeout_PreDesc_PostponedJobs[] = {
+ "Zero",
+ "NotZeroOrMax",
+ "Max",
+ "NA"
+};
+
+static const char * const * const RtemsRatemonReqTimeout_PreDesc[] = {
+ RtemsRatemonReqTimeout_PreDesc_WaitFor,
+ RtemsRatemonReqTimeout_PreDesc_WaitState,
+ RtemsRatemonReqTimeout_PreDesc_PostponedJobs,
+ NULL
+};
+
+typedef RtemsRatemonReqTimeout_Context Context;
+
+typedef enum {
+ EVENT_RESET = RTEMS_EVENT_0,
+ EVENT_PERIOD_WAIT = RTEMS_EVENT_1,
+ EVENT_PERIOD_OTHER = RTEMS_EVENT_2
+} Event;
+
+static void Tick( void *arg )
+{
+ Context *ctx;
+ T_scheduler_log_10 scheduler_log_10;
+ const T_scheduler_log *scheduler_log;
+ size_t index;
+
+ ctx = arg;
+ ctx->release_job_counter = 0;
+ ctx->unblock_counter = 0;
+ ctx->uptime_before = ctx->period->time_period_initiated;
+ ctx->cpu_usage_before = ctx->period->cpu_usage_period_initiated;
+ scheduler_log = T_scheduler_record_10( &scheduler_log_10 );
+ T_null( scheduler_log );
+ ClockTick();
+ scheduler_log = T_scheduler_record( NULL );
+ T_eq_ptr( &scheduler_log->header, &scheduler_log_10.header );
+
+ index = 0;
+
+ while ( true ) {
+ const T_scheduler_event *event;
+
+ event = T_scheduler_next_any( &scheduler_log_10.header, &index );
+
+ if ( event == &T_scheduler_event_null ) {
+ break;
+ }
+
+ T_eq_u32( event->thread->Object.id, ctx->worker_id );
+
+ switch ( event->operation ) {
+ case T_SCHEDULER_RELEASE_JOB:
+ ++ctx->release_job_counter;
+ T_eq_u64(
+ event->release_job.deadline,
+ rtems_clock_get_ticks_since_boot() + 1
+ );
+ break;
+ case T_SCHEDULER_UNBLOCK:
+ ++ctx->unblock_counter;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void SchedulerBlock(
+ void *arg,
+ const T_scheduler_event *event,
+ T_scheduler_when when
+)
+{
+ Context *ctx;
+
+ ctx = arg;
+
+ if (
+ when == T_SCHEDULER_BEFORE &&
+ event->operation == T_SCHEDULER_BLOCK
+ ) {
+ T_scheduler_set_event_handler( NULL, NULL );
+ ctx->request.handler = Tick;
+ CallWithinISRSubmit( &ctx->request );
+ }
+}
+
+static Rate_monotonic_Control *GetControl( rtems_id id )
+{
+ Rate_monotonic_Control *period;
+ ISR_lock_Context lock_context;
+
+ period = _Rate_monotonic_Get( id, &lock_context );
+ T_assert_not_null( period );
+ _ISR_lock_ISR_enable( &lock_context );
+
+ return period;
+}
+
+static void Worker( rtems_task_argument arg )
+{
+ Context *ctx;
+ rtems_status_code sc;
+
+ ctx = (Context *) arg;
+
+ sc = rtems_rate_monotonic_create( OBJECT_NAME, &ctx->period_id );
+ T_rsc_success( sc );
+
+ sc = rtems_rate_monotonic_create( OBJECT_NAME, &ctx->other_period_id );
+ T_rsc_success( sc );
+
+ while ( true ) {
+ rtems_event_set events;
+
+ events = ReceiveAnyEvents();
+
+ if ( ( events & EVENT_RESET ) != 0 ) {
+ sc = rtems_rate_monotonic_cancel( ctx->period_id );
+ T_rsc_success( sc );
+
+ sc = rtems_rate_monotonic_cancel( ctx->other_period_id );
+ T_rsc_success( sc );
+
+ sc = rtems_rate_monotonic_period( ctx->period_id, 1 );
+ T_rsc_success( sc );
+
+ ctx->period->postponed_jobs = ctx->postponed_jobs;
+ }
+
+ if ( ( events & EVENT_PERIOD_WAIT ) != 0 ) {
+ if ( ctx->intend_to_block ) {
+ T_scheduler_set_event_handler( SchedulerBlock, ctx );
+ }
+
+ sc = rtems_rate_monotonic_period( ctx->period_id, 1 );
+ T_rsc_success( sc );
+ }
+
+ if ( ( events & EVENT_PERIOD_OTHER ) != 0 ) {
+ sc = rtems_rate_monotonic_period( ctx->other_period_id, 2 );
+ T_rsc_success( sc );
+
+ sc = rtems_rate_monotonic_period( ctx->other_period_id, 2 );
+ T_rsc_success( sc );
+ }
+ }
+}
+
+static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Pre_WaitFor state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Pre_WaitFor_PeriodSelf: {
+ /*
+ * While the owner task of the period waits for the period.
+ */
+ ctx->wait_for_period = true;
+ ctx->period_is_other = false;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_WaitFor_PeriodOther: {
+ /*
+ * While the owner task of the period waits for another period.
+ */
+ ctx->wait_for_period = true;
+ ctx->period_is_other = true;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_WaitFor_Other: {
+ /*
+ * While the owner task of the period does not wait for a period.
+ */
+ ctx->wait_for_period = false;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_WaitFor_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Pre_WaitState_Prepare(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Pre_WaitState state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Pre_WaitState_Blocked: {
+ /*
+ * While the owner task is in the blocked wait state.
+ */
+ ctx->intend_to_block = false;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_WaitState_IntendToBlock: {
+ /*
+ * While the owner task is in the intend to block wait state.
+ */
+ ctx->intend_to_block = true;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_WaitState_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Pre_PostponedJobs_Prepare(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Pre_PostponedJobs state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Pre_PostponedJobs_Zero: {
+ /*
+ * While the count of postponed jobs is equal to zero.
+ */
+ ctx->postponed_jobs = 0;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_PostponedJobs_NotZeroOrMax: {
+ /*
+ * While the count of postponed jobs is not equal to zero or UINT32_MAX.
+ */
+ ctx->postponed_jobs = 123;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_PostponedJobs_Max: {
+ /*
+ * While the count of postponed jobs is equal to UINT32_MAX.
+ */
+ ctx->postponed_jobs = UINT32_MAX;
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Pre_PostponedJobs_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_PostponedJobs_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_PostponedJobs state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_PostponedJobs_Nop: {
+ /*
+ * The count of postponed jobs of the period shall not be modified.
+ */
+ T_eq_u32( ctx->period->postponed_jobs, ctx->postponed_jobs );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_PostponedJobs_PlusOne: {
+ /*
+ * The count of postponed jobs of the period shall be incremented by one.
+ */
+ T_eq_u32( ctx->period->postponed_jobs, ctx->postponed_jobs + 1 );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_PostponedJobs_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_ReleaseJob_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_ReleaseJob state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_ReleaseJob_Yes: {
+ /*
+ * The owner task of the period shall release a job with a deadline equal
+ * to the clock tick plus the next period length by the timeout
+ * operation.
+ */
+ T_eq_u32( ctx->release_job_counter, 1 );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_ReleaseJob_No: {
+ /*
+ * The owner task of the period shall not release a job by the timeout
+ * operation.
+ */
+ T_eq_u32( ctx->release_job_counter, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_ReleaseJob_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_Unblock_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_Unblock state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_Unblock_Yes: {
+ /*
+ * The owner task of the period shall be unblocked by the timeout
+ * operation.
+ */
+ T_eq_u32( ctx->unblock_counter, 1 );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_Unblock_No: {
+ /*
+ * The owner task of the period shall not be unblocked by the timeout
+ * operation.
+ */
+ T_eq_u32( ctx->unblock_counter, 0 );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_Unblock_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_PeriodState_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_PeriodState state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_PeriodState_Active: {
+ /*
+ * The period state shall be active.
+ */
+ T_eq_int( ctx->period->state, RATE_MONOTONIC_ACTIVE );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_PeriodState_Expired: {
+ /*
+ * The period state shall be expired.
+ */
+ T_eq_int( ctx->period->state, RATE_MONOTONIC_EXPIRED );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_PeriodState_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_Timer_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_Timer state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_Timer_Active: {
+ /*
+ * The timeout timer of the period shall expired at the current clock
+ * tick plus the next period length.
+ */
+ T_true( _Watchdog_Is_scheduled( &ctx->period->Timer ) );
+ T_eq_u64(
+ ctx->period->Timer.expire,
+ rtems_clock_get_ticks_since_boot() + 1
+ );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_Timer_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_Uptime_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_Uptime state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_Uptime_Nop: {
+ /*
+ * The period initiated CLOCK_MONOTONIC value shall not be modified.
+ */
+ T_eq_i64( ctx->uptime_before, ctx->period->time_period_initiated );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_Uptime_Set: {
+ /*
+ * The period initiated CLOCK_MONOTONIC value shall be set to the
+ * CLOCK_MONOTONIC at some time point during the timeout operation.
+ */
+ T_ne_i64( ctx->uptime_before, ctx->period->time_period_initiated );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_Uptime_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Post_CPUUsage_Check(
+ RtemsRatemonReqTimeout_Context *ctx,
+ RtemsRatemonReqTimeout_Post_CPUUsage state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqTimeout_Post_CPUUsage_Nop: {
+ /*
+ * The period initiated CPU usage of the owner task value shall not be
+ * modified.
+ */
+ T_eq_i64(
+ ctx->cpu_usage_before,
+ ctx->period->cpu_usage_period_initiated
+ );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_CPUUsage_Set: {
+ /*
+ * The period initiated CPU usage of the owner task value shall be set to
+ * the CPU usage of the owner task at some time point during the timeout
+ * operation.
+ */
+ T_ne_i64(
+ ctx->cpu_usage_before,
+ ctx->period->cpu_usage_period_initiated
+ );
+ break;
+ }
+
+ case RtemsRatemonReqTimeout_Post_CPUUsage_NA:
+ break;
+ }
+}
+
+static void RtemsRatemonReqTimeout_Setup( RtemsRatemonReqTimeout_Context *ctx )
+{
+ ctx->request.arg = ctx;
+ ctx->worker_id = CreateTask( "WORK", GetSelfPriority() );
+ StartTask( ctx->worker_id, Worker, ctx );
+ Yield();
+ ctx->period = GetControl( ctx->period_id );
+}
+
+static void RtemsRatemonReqTimeout_Setup_Wrap( void *arg )
+{
+ RtemsRatemonReqTimeout_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqTimeout_Setup( ctx );
+}
+
+static void RtemsRatemonReqTimeout_Teardown(
+ RtemsRatemonReqTimeout_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ DeleteTask( ctx->worker_id );
+
+ sc = rtems_rate_monotonic_delete( ctx->period_id );
+ T_rsc_success( sc );
+
+ sc = rtems_rate_monotonic_delete( ctx->other_period_id );
+ T_rsc_success( sc );
+}
+
+static void RtemsRatemonReqTimeout_Teardown_Wrap( void *arg )
+{
+ RtemsRatemonReqTimeout_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ RtemsRatemonReqTimeout_Teardown( ctx );
+}
+
+static void RtemsRatemonReqTimeout_Action(
+ RtemsRatemonReqTimeout_Context *ctx
+)
+{
+ SendEvents( ctx->worker_id, EVENT_RESET );
+ Yield();
+
+ if ( ctx->wait_for_period ) {
+ if ( ctx->period_is_other ) {
+ SendEvents( ctx->worker_id, EVENT_PERIOD_OTHER );
+ Yield();
+ Tick( ctx );
+ } else {
+ SendEvents( ctx->worker_id, EVENT_PERIOD_WAIT );
+ Yield();
+
+ if ( !ctx->intend_to_block ) {
+ Tick( ctx );
+ }
+ }
+ } else {
+ Tick( ctx );
+ }
+}
+
+static void RtemsRatemonReqTimeout_Cleanup(
+ RtemsRatemonReqTimeout_Context *ctx
+)
+{
+ ClockTick();
+ Yield();
+}
+
+static const RtemsRatemonReqTimeout_Entry
+RtemsRatemonReqTimeout_Entries[] = {
+ { 0, 0, 1, 0, RtemsRatemonReqTimeout_Post_PostponedJobs_PlusOne,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_No,
+ RtemsRatemonReqTimeout_Post_Unblock_No,
+ RtemsRatemonReqTimeout_Post_PeriodState_Expired,
+ RtemsRatemonReqTimeout_Post_Timer_Active,
+ RtemsRatemonReqTimeout_Post_Uptime_Nop,
+ RtemsRatemonReqTimeout_Post_CPUUsage_Nop },
+ { 1, 0, 0, 0, RtemsRatemonReqTimeout_Post_PostponedJobs_NA,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_NA,
+ RtemsRatemonReqTimeout_Post_Unblock_NA,
+ RtemsRatemonReqTimeout_Post_PeriodState_NA,
+ RtemsRatemonReqTimeout_Post_Timer_NA,
+ RtemsRatemonReqTimeout_Post_Uptime_NA,
+ RtemsRatemonReqTimeout_Post_CPUUsage_NA },
+ { 0, 0, 1, 0, RtemsRatemonReqTimeout_Post_PostponedJobs_Nop,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_No,
+ RtemsRatemonReqTimeout_Post_Unblock_No,
+ RtemsRatemonReqTimeout_Post_PeriodState_Expired,
+ RtemsRatemonReqTimeout_Post_Timer_Active,
+ RtemsRatemonReqTimeout_Post_Uptime_Nop,
+ RtemsRatemonReqTimeout_Post_CPUUsage_Nop },
+ { 0, 0, 0, 0, RtemsRatemonReqTimeout_Post_PostponedJobs_Nop,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_Yes,
+ RtemsRatemonReqTimeout_Post_Unblock_Yes,
+ RtemsRatemonReqTimeout_Post_PeriodState_Active,
+ RtemsRatemonReqTimeout_Post_Timer_Active,
+ RtemsRatemonReqTimeout_Post_Uptime_Set,
+ RtemsRatemonReqTimeout_Post_CPUUsage_Set },
+ { 0, 0, 0, 0, RtemsRatemonReqTimeout_Post_PostponedJobs_Nop,
+ RtemsRatemonReqTimeout_Post_ReleaseJob_Yes,
+ RtemsRatemonReqTimeout_Post_Unblock_No,
+ RtemsRatemonReqTimeout_Post_PeriodState_Active,
+ RtemsRatemonReqTimeout_Post_Timer_Active,
+ RtemsRatemonReqTimeout_Post_Uptime_Set,
+ RtemsRatemonReqTimeout_Post_CPUUsage_Set }
+};
+
+static const uint8_t
+RtemsRatemonReqTimeout_Map[] = {
+ 3, 1, 1, 4, 1, 1, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2
+};
+
+static size_t RtemsRatemonReqTimeout_Scope( void *arg, char *buf, size_t n )
+{
+ RtemsRatemonReqTimeout_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope( RtemsRatemonReqTimeout_PreDesc, buf, n, ctx->Map.pcs );
+ }
+
+ return 0;
+}
+
+static T_fixture RtemsRatemonReqTimeout_Fixture = {
+ .setup = RtemsRatemonReqTimeout_Setup_Wrap,
+ .stop = NULL,
+ .teardown = RtemsRatemonReqTimeout_Teardown_Wrap,
+ .scope = RtemsRatemonReqTimeout_Scope,
+ .initial_context = &RtemsRatemonReqTimeout_Instance
+};
+
+static inline RtemsRatemonReqTimeout_Entry RtemsRatemonReqTimeout_PopEntry(
+ RtemsRatemonReqTimeout_Context *ctx
+)
+{
+ size_t index;
+
+ index = ctx->Map.index;
+ ctx->Map.index = index + 1;
+ return RtemsRatemonReqTimeout_Entries[
+ RtemsRatemonReqTimeout_Map[ index ]
+ ];
+}
+
+static void RtemsRatemonReqTimeout_SetPreConditionStates(
+ RtemsRatemonReqTimeout_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+
+ if ( ctx->Map.entry.Pre_WaitState_NA ) {
+ ctx->Map.pcs[ 1 ] = RtemsRatemonReqTimeout_Pre_WaitState_NA;
+ } else {
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+ }
+
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+}
+
+static void RtemsRatemonReqTimeout_TestVariant(
+ RtemsRatemonReqTimeout_Context *ctx
+)
+{
+ RtemsRatemonReqTimeout_Pre_WaitFor_Prepare( ctx, ctx->Map.pcs[ 0 ] );
+ RtemsRatemonReqTimeout_Pre_WaitState_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsRatemonReqTimeout_Pre_PostponedJobs_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsRatemonReqTimeout_Action( ctx );
+ RtemsRatemonReqTimeout_Post_PostponedJobs_Check(
+ ctx,
+ ctx->Map.entry.Post_PostponedJobs
+ );
+ RtemsRatemonReqTimeout_Post_ReleaseJob_Check(
+ ctx,
+ ctx->Map.entry.Post_ReleaseJob
+ );
+ RtemsRatemonReqTimeout_Post_Unblock_Check(
+ ctx,
+ ctx->Map.entry.Post_Unblock
+ );
+ RtemsRatemonReqTimeout_Post_PeriodState_Check(
+ ctx,
+ ctx->Map.entry.Post_PeriodState
+ );
+ RtemsRatemonReqTimeout_Post_Timer_Check( ctx, ctx->Map.entry.Post_Timer );
+ RtemsRatemonReqTimeout_Post_Uptime_Check( ctx, ctx->Map.entry.Post_Uptime );
+ RtemsRatemonReqTimeout_Post_CPUUsage_Check(
+ ctx,
+ ctx->Map.entry.Post_CPUUsage
+ );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonReqTimeout( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsRatemonReqTimeout, &RtemsRatemonReqTimeout_Fixture )
+{
+ RtemsRatemonReqTimeout_Context *ctx;
+
+ ctx = T_fixture_context();
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+
+ for (
+ ctx->Map.pci[ 0 ] = RtemsRatemonReqTimeout_Pre_WaitFor_PeriodSelf;
+ ctx->Map.pci[ 0 ] < RtemsRatemonReqTimeout_Pre_WaitFor_NA;
+ ++ctx->Map.pci[ 0 ]
+ ) {
+ for (
+ ctx->Map.pci[ 1 ] = RtemsRatemonReqTimeout_Pre_WaitState_Blocked;
+ ctx->Map.pci[ 1 ] < RtemsRatemonReqTimeout_Pre_WaitState_NA;
+ ++ctx->Map.pci[ 1 ]
+ ) {
+ for (
+ ctx->Map.pci[ 2 ] = RtemsRatemonReqTimeout_Pre_PostponedJobs_Zero;
+ ctx->Map.pci[ 2 ] < RtemsRatemonReqTimeout_Pre_PostponedJobs_NA;
+ ++ctx->Map.pci[ 2 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqTimeout_PopEntry( ctx );
+
+ if ( ctx->Map.entry.Skip ) {
+ continue;
+ }
+
+ RtemsRatemonReqTimeout_SetPreConditionStates( ctx );
+ RtemsRatemonReqTimeout_TestVariant( ctx );
+ RtemsRatemonReqTimeout_Cleanup( ctx );
+ }
+ }
+ }
+}
+
+/** @} */