summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-08 16:11:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-08 16:16:54 +0200
commit6ced88294bf04abe046ec78ad983707d0b1c727e (patch)
tree5af2562c2e770f5fdc82405a8a15dec8fbef5475
parentcf400e041be4a9cae56c941a0574d67a45b5437b (diff)
validation/unit: Rate monotonic manager
-rw-r--r--spec/build/testsuites/unit/unit-no-clock-0.yml1
-rw-r--r--testsuites/unit/tc-ratemon-statistics.c242
-rw-r--r--testsuites/validation/tc-ratemon-cancel.c45
-rw-r--r--testsuites/validation/tc-ratemon-get-status.c203
-rw-r--r--testsuites/validation/tc-ratemon-period.c6
-rw-r--r--testsuites/validation/tc-ratemon-timeout.c28
6 files changed, 421 insertions, 104 deletions
diff --git a/spec/build/testsuites/unit/unit-no-clock-0.yml b/spec/build/testsuites/unit/unit-no-clock-0.yml
index 1c13d4e47c..0d5180cbff 100644
--- a/spec/build/testsuites/unit/unit-no-clock-0.yml
+++ b/spec/build/testsuites/unit/unit-no-clock-0.yml
@@ -11,6 +11,7 @@ includes: []
ldflags: []
links: []
source:
+- testsuites/unit/tc-ratemon-statistics.c
- testsuites/unit/tc-score-kern-tc.c
- testsuites/unit/tc-score-msgq.c
- testsuites/unit/ts-unit-no-clock-0.c
diff --git a/testsuites/unit/tc-ratemon-statistics.c b/testsuites/unit/tc-ratemon-statistics.c
new file mode 100644
index 0000000000..4989c393b5
--- /dev/null
+++ b/testsuites/unit/tc-ratemon-statistics.c
@@ -0,0 +1,242 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsRatemonUnitStatistics
+ */
+
+/*
+ * 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 "../validation/tx-support.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsRatemonUnitStatistics \
+ * spec:/rtems/ratemon/unit/statistics
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesUnitNoClock0
+ *
+ * @brief Unit tests for the Rate Monotonic Manager.
+ *
+ * A line in the file ``cpukit/rtems/src/ratemonperiod.c`` is not reached by
+ * validation tests. The space qualified code subset does not contain
+ * rtems_rate_monotonic_get_statistics(). This test exercises the code parts
+ * otherwise not reached in order to achieve full code coverage.
+ *
+ * This test case performs the following actions:
+ *
+ * - Start a period, reset the CPU usage counters and then call
+ * rtems_rate_monotonic_period() again. This second call will invoke
+ * ``_Rate_monotonic_Update_statistics()`` and enter the ``if()`` otherwise
+ * not reached.
+ *
+ * After each call to rtems_rate_monotonic_period(),
+ * rtems_rate_monotonic_period_status will be called in order to check that
+ * the period status recovers from the reset with the start of the second
+ * period.
+ *
+ * - Check status returned by the two calls to rtems_rate_monotonic_period().
+ *
+ * - Check the first call to rtems_rate_monotonic_period_status is not
+ * defined due to the preceding reset of the CUP usage counters.
+ *
+ * - Check that the second call to rtems_rate_monotonic_period_status is not
+ * longer affected by the reset of the CUP usage counters in the previous
+ * period.
+ *
+ * @{
+ */
+
+static uint32_t FreezeTime( void );
+#define PERIOD_LENGTH 1
+
+/**
+ * @brief Test context for spec:/rtems/ratemon/unit/statistics 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;
+} RtemsRatemonUnitStatistics_Context;
+
+static RtemsRatemonUnitStatistics_Context
+ RtemsRatemonUnitStatistics_Instance;
+
+static void RtemsRatemonUnitStatistics_Setup(
+ RtemsRatemonUnitStatistics_Context *ctx
+)
+{
+ rtems_status_code status;
+ ctx->previous_timecounter_handler = SetGetTimecountHandler( FreezeTime );
+
+ status = rtems_rate_monotonic_create(
+ rtems_build_name( 'R', 'M', 'O', 'N' ),
+ &ctx->period_id
+ );
+ T_rsc_success( status );
+}
+
+static void RtemsRatemonUnitStatistics_Setup_Wrap( void *arg )
+{
+ RtemsRatemonUnitStatistics_Context *ctx;
+
+ ctx = arg;
+ RtemsRatemonUnitStatistics_Setup( ctx );
+}
+
+static void RtemsRatemonUnitStatistics_Teardown(
+ RtemsRatemonUnitStatistics_Context *ctx
+)
+{
+ T_rsc_success( rtems_rate_monotonic_delete( ctx->period_id ) );
+ SetGetTimecountHandler( ctx->previous_timecounter_handler );
+}
+
+static void RtemsRatemonUnitStatistics_Teardown_Wrap( void *arg )
+{
+ RtemsRatemonUnitStatistics_Context *ctx;
+
+ ctx = arg;
+ RtemsRatemonUnitStatistics_Teardown( ctx );
+}
+
+static T_fixture RtemsRatemonUnitStatistics_Fixture = {
+ .setup = RtemsRatemonUnitStatistics_Setup_Wrap,
+ .stop = NULL,
+ .teardown = RtemsRatemonUnitStatistics_Teardown_Wrap,
+ .scope = NULL,
+ .initial_context = &RtemsRatemonUnitStatistics_Instance
+};
+
+static uint32_t FreezeTime( void )
+{
+ return GetTimecountCounter() - 1;
+}
+
+/**
+ * @brief Start a period, reset the CPU usage counters and then call
+ * rtems_rate_monotonic_period() again. This second call will invoke
+ * ``_Rate_monotonic_Update_statistics()`` and enter the ``if()`` otherwise
+ * not reached.
+ *
+ * After each call to rtems_rate_monotonic_period(),
+ * rtems_rate_monotonic_period_status will be called in order to check that
+ * the period status recovers from the reset with the start of the second
+ * period.
+ */
+static void RtemsRatemonUnitStatistics_Action_0(
+ RtemsRatemonUnitStatistics_Context *ctx
+)
+{
+ rtems_status_code status_0;
+ rtems_status_code status_1;
+ rtems_status_code status_code_0;
+ rtems_status_code status_code_1;
+ rtems_rate_monotonic_period_status status_data;
+
+ status_0 = rtems_rate_monotonic_period( ctx->period_id, PERIOD_LENGTH );
+ rtems_cpu_usage_reset();
+
+ status_code_0 = rtems_rate_monotonic_get_status(
+ ctx->period_id,
+ &status_data
+ );
+
+ TimecounterTick();
+ status_1 = rtems_rate_monotonic_period( ctx->period_id, PERIOD_LENGTH );
+ status_code_1 = rtems_rate_monotonic_get_status(
+ ctx->period_id,
+ &status_data
+ );
+
+ /*
+ * Check status returned by the two calls to rtems_rate_monotonic_period().
+ */
+ T_rsc_success( status_0 );
+ T_rsc( status_1, RTEMS_TIMEOUT );
+
+ /*
+ * Check the first call to rtems_rate_monotonic_period_status is not defined
+ * due to the preceding reset of the CUP usage counters.
+ */
+ T_rsc( status_code_0, RTEMS_NOT_DEFINED );
+
+ /*
+ * Check that the second call to rtems_rate_monotonic_period_status is not
+ * longer affected by the reset of the CUP usage counters in the previous
+ * period.
+ */
+ T_rsc_success( status_code_1 );
+}
+
+/**
+ * @fn void T_case_body_RtemsRatemonUnitStatistics( void )
+ */
+T_TEST_CASE_FIXTURE(
+ RtemsRatemonUnitStatistics,
+ &RtemsRatemonUnitStatistics_Fixture
+)
+{
+ RtemsRatemonUnitStatistics_Context *ctx;
+
+ ctx = T_fixture_context();
+
+ RtemsRatemonUnitStatistics_Action_0( ctx );
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-ratemon-cancel.c b/testsuites/validation/tc-ratemon-cancel.c
index 23d4383dcb..d8bce4de67 100644
--- a/testsuites/validation/tc-ratemon-cancel.c
+++ b/testsuites/validation/tc-ratemon-cancel.c
@@ -108,8 +108,6 @@ typedef enum {
typedef enum {
RtemsRatemonReqCancel_Post_Postponed_Zero,
- RtemsRatemonReqCancel_Post_Postponed_One,
- RtemsRatemonReqCancel_Post_Postponed_Several,
RtemsRatemonReqCancel_Post_Postponed_Nop,
RtemsRatemonReqCancel_Post_Postponed_NA
} RtemsRatemonReqCancel_Post_Postponed;
@@ -128,7 +126,7 @@ typedef struct {
uint16_t Pre_Postponed_NA : 1;
uint16_t Post_Status : 2;
uint16_t Post_State : 2;
- uint16_t Post_Postponed : 3;
+ uint16_t Post_Postponed : 2;
uint16_t Post_Scheduler : 2;
} RtemsRatemonReqCancel_Entry;
@@ -557,27 +555,6 @@ static void RtemsRatemonReqCancel_Post_Postponed_Check(
break;
}
- case RtemsRatemonReqCancel_Post_Postponed_One: {
- /*
- * The number of postponed jobs shall not be changed by the past call to
- * rtems_rate_monotonic_cancel().
- */
- T_eq_u32( ctx->period_status.postponed_jobs_count, 1 );
- break;
- }
-
- case RtemsRatemonReqCancel_Post_Postponed_Several: {
- /*
- * The number of postponed jobs shall not be changed by the past call to
- * rtems_rate_monotonic_cancel().
- */
- T_eq_u32(
- ctx->period_status.postponed_jobs_count,
- ctx->postponed_jobs_count
- );
- break;
- }
-
case RtemsRatemonReqCancel_Post_Postponed_Nop: {
/*
* Objects referenced by the ``id`` parameter in past calls to
@@ -753,6 +730,10 @@ RtemsRatemonReqCancel_Entries[] = {
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,
@@ -761,14 +742,6 @@ RtemsRatemonReqCancel_Entries[] = {
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_One,
- RtemsRatemonReqCancel_Post_Scheduler_Called },
- { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_Ok,
- RtemsRatemonReqCancel_Post_State_Inactive,
- RtemsRatemonReqCancel_Post_Postponed_Several,
- RtemsRatemonReqCancel_Post_Scheduler_Called },
{ 0, 0, 0, 0, 1, RtemsRatemonReqCancel_Post_Status_InvId,
RtemsRatemonReqCancel_Post_State_Nop,
RtemsRatemonReqCancel_Post_Postponed_Nop,
@@ -777,10 +750,6 @@ RtemsRatemonReqCancel_Entries[] = {
RtemsRatemonReqCancel_Post_State_Inactive,
RtemsRatemonReqCancel_Post_Postponed_NA,
RtemsRatemonReqCancel_Post_Scheduler_Called },
- { 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, 1, RtemsRatemonReqCancel_Post_Status_NotOwn,
RtemsRatemonReqCancel_Post_State_Nop,
RtemsRatemonReqCancel_Post_Postponed_Nop,
@@ -789,8 +758,8 @@ RtemsRatemonReqCancel_Entries[] = {
static const uint8_t
RtemsRatemonReqCancel_Map[] = {
- 7, 1, 1, 8, 4, 5, 3, 4, 5, 9, 1, 1, 2, 2, 2, 3, 2, 2, 6, 1, 1, 0, 0, 0, 3, 0,
- 0, 6, 1, 1, 0, 0, 0, 3, 0, 0
+ 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 )
diff --git a/testsuites/validation/tc-ratemon-get-status.c b/testsuites/validation/tc-ratemon-get-status.c
index 32e2fed118..69ead1ab9e 100644
--- a/testsuites/validation/tc-ratemon-get-status.c
+++ b/testsuites/validation/tc-ratemon-get-status.c
@@ -53,6 +53,7 @@
#endif
#include <rtems.h>
+#include <rtems/cpuuse.h>
#include "tx-support.h"
@@ -81,6 +82,12 @@ typedef enum {
} RtemsRatemonReqGetStatus_Pre_Id;
typedef enum {
+ RtemsRatemonReqGetStatus_Pre_CpuUse_Kept,
+ RtemsRatemonReqGetStatus_Pre_CpuUse_Reset,
+ RtemsRatemonReqGetStatus_Pre_CpuUse_NA
+} RtemsRatemonReqGetStatus_Pre_CpuUse;
+
+typedef enum {
RtemsRatemonReqGetStatus_Pre_State_Inactive,
RtemsRatemonReqGetStatus_Pre_State_Active,
RtemsRatemonReqGetStatus_Pre_State_Expired,
@@ -108,6 +115,7 @@ typedef enum {
RtemsRatemonReqGetStatus_Post_Status_Ok,
RtemsRatemonReqGetStatus_Post_Status_InvAddr,
RtemsRatemonReqGetStatus_Post_Status_InvId,
+ RtemsRatemonReqGetStatus_Post_Status_NotDef,
RtemsRatemonReqGetStatus_Post_Status_NA
} RtemsRatemonReqGetStatus_Post_Status;
@@ -151,11 +159,12 @@ typedef struct {
uint32_t Skip : 1;
uint32_t Pre_StatusAddr_NA : 1;
uint32_t Pre_Id_NA : 1;
+ uint32_t Pre_CpuUse_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_Status : 3;
uint32_t Post_Owner : 2;
uint32_t Post_State : 3;
uint32_t Post_Elapsed : 2;
@@ -209,6 +218,12 @@ typedef struct {
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;
@@ -228,12 +243,12 @@ typedef struct {
* @brief This member defines the pre-condition indices for the next
* action.
*/
- size_t pci[ 6 ];
+ size_t pci[ 7 ];
/**
* @brief This member defines the pre-condition states for the next action.
*/
- size_t pcs[ 6 ];
+ size_t pcs[ 7 ];
/**
* @brief If this member is true, then the test action loop is executed.
@@ -273,6 +288,12 @@ static const char * const RtemsRatemonReqGetStatus_PreDesc_Id[] = {
"NA"
};
+static const char * const RtemsRatemonReqGetStatus_PreDesc_CpuUse[] = {
+ "Kept",
+ "Reset",
+ "NA"
+};
+
static const char * const RtemsRatemonReqGetStatus_PreDesc_State[] = {
"Inactive",
"Active",
@@ -300,6 +321,7 @@ static const char * const RtemsRatemonReqGetStatus_PreDesc_Postponed[] = {
static const char * const * const RtemsRatemonReqGetStatus_PreDesc[] = {
RtemsRatemonReqGetStatus_PreDesc_StatusAddr,
RtemsRatemonReqGetStatus_PreDesc_Id,
+ RtemsRatemonReqGetStatus_PreDesc_CpuUse,
RtemsRatemonReqGetStatus_PreDesc_State,
RtemsRatemonReqGetStatus_PreDesc_Elapsed,
RtemsRatemonReqGetStatus_PreDesc_Consumed,
@@ -409,6 +431,35 @@ static void RtemsRatemonReqGetStatus_Pre_Id_Prepare(
}
}
+static void RtemsRatemonReqGetStatus_Pre_CpuUse_Prepare(
+ RtemsRatemonReqGetStatus_Context *ctx,
+ RtemsRatemonReqGetStatus_Pre_CpuUse state
+)
+{
+ switch ( state ) {
+ case RtemsRatemonReqGetStatus_Pre_CpuUse_Kept: {
+ /*
+ * While the CPU usage statistics in not changed.
+ */
+ ctx->do_reset = NULL;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_CpuUse_Reset: {
+ /*
+ * While the rtems_cpu_usage_reset() directive is called between the call
+ * to rtems_rate_monotonic_period() which started the period and the call
+ * to rtems_rate_monotonic_get_status().
+ */
+ ctx->do_reset = rtems_cpu_usage_reset;
+ break;
+ }
+
+ case RtemsRatemonReqGetStatus_Pre_CpuUse_NA:
+ break;
+ }
+}
+
static void RtemsRatemonReqGetStatus_Pre_State_Prepare(
RtemsRatemonReqGetStatus_Context *ctx,
RtemsRatemonReqGetStatus_Pre_State state
@@ -562,6 +613,15 @@ static void RtemsRatemonReqGetStatus_Post_Status_Check(
break;
}
+ case RtemsRatemonReqGetStatus_Post_Status_NotDef: {
+ /*
+ * The return status of rtems_rate_monotonic_get_status() shall be
+ * RTEMS_NOT_DEFINED.
+ */
+ T_rsc( ctx->status, RTEMS_NOT_DEFINED );
+ break;
+ }
+
case RtemsRatemonReqGetStatus_Post_Status_NA:
break;
}
@@ -829,9 +889,6 @@ static void RtemsRatemonReqGetStatus_Post_Postponed_Check(
* 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).
- *
- * Note: A newly created period has an arbitrary the number of postponed
- * jobs because rtems_rate_monotonic_create() does not set this value 0.
*/
T_eq_u32( ctx->period_status.postponed_jobs_count,
initial_postponed_jobs_count );
@@ -907,6 +964,9 @@ 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
@@ -922,73 +982,109 @@ static void RtemsRatemonReqGetStatus_Cleanup(
static const RtemsRatemonReqGetStatus_Entry
RtemsRatemonReqGetStatus_Entries[] = {
- { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_InvAddr,
+ { 0, 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,
+ { 1, 0, 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,
+ { 0, 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,
+ { 1, 0, 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,
+ { 1, 0, 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, 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,
+ { 0, 0, 0, 0, 0, 1, 1, 1, RtemsRatemonReqGetStatus_Post_Status_Ok,
RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
RtemsRatemonReqGetStatus_Post_State_Inactive,
- RtemsRatemonReqGetStatus_Post_Elapsed_NA,
- RtemsRatemonReqGetStatus_Post_Consumed_NA,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Zero,
+ RtemsRatemonReqGetStatus_Post_Consumed_Zero,
RtemsRatemonReqGetStatus_Post_Postponed_NA },
- { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok,
+ { 0, 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,
+ { 0, 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,
+ { 0, 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,
+ { 0, 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,
+ { 0, 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,
+ { 0, 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NotDef,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Zero },
+ { 0, 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NotDef,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_One },
+ { 0, 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NotDef,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Active,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Several },
+ { 0, 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NotDef,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Expired,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_One },
+ { 0, 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_NotDef,
+ RtemsRatemonReqGetStatus_Post_Owner_OwnerTask,
+ RtemsRatemonReqGetStatus_Post_State_Expired,
+ RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
+ RtemsRatemonReqGetStatus_Post_Consumed_Nop,
+ RtemsRatemonReqGetStatus_Post_Postponed_Several },
+ { 0, 0, 0, 0, 0, 0, 0, 1, RtemsRatemonReqGetStatus_Post_Status_InvId,
RtemsRatemonReqGetStatus_Post_Owner_Nop,
RtemsRatemonReqGetStatus_Post_State_Nop,
RtemsRatemonReqGetStatus_Post_Elapsed_Nop,
@@ -998,8 +1094,9 @@ RtemsRatemonReqGetStatus_Entries[] = {
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
+ 6, 3, 3, 7, 8, 9, 4, 10, 11, 1, 1, 1, 12, 13, 14, 4, 15, 16, 17, 3, 3, 2, 2,
+ 2, 4, 2, 2, 1, 1, 1, 2, 2, 2, 4, 2, 2, 5, 3, 3, 0, 0, 0, 4, 0, 0, 1, 1, 1, 0,
+ 0, 0, 4, 0, 0, 5, 3, 3, 0, 0, 0, 4, 0, 0, 1, 1, 1, 0, 0, 0, 4, 0, 0
};
static size_t RtemsRatemonReqGetStatus_Scope( void *arg, char *buf, size_t n )
@@ -1048,23 +1145,24 @@ static void RtemsRatemonReqGetStatus_SetPreConditionStates(
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_Elapsed_NA ) {
- ctx->Map.pcs[ 3 ] = RtemsRatemonReqGetStatus_Pre_Elapsed_NA;
+ ctx->Map.pcs[ 4 ] = RtemsRatemonReqGetStatus_Pre_Elapsed_NA;
} else {
- ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
+ ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
}
if ( ctx->Map.entry.Pre_Consumed_NA ) {
- ctx->Map.pcs[ 4 ] = RtemsRatemonReqGetStatus_Pre_Consumed_NA;
+ ctx->Map.pcs[ 5 ] = RtemsRatemonReqGetStatus_Pre_Consumed_NA;
} else {
- ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
+ ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ];
}
if ( ctx->Map.entry.Pre_Postponed_NA ) {
- ctx->Map.pcs[ 5 ] = RtemsRatemonReqGetStatus_Pre_Postponed_NA;
+ ctx->Map.pcs[ 6 ] = RtemsRatemonReqGetStatus_Pre_Postponed_NA;
} else {
- ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ];
+ ctx->Map.pcs[ 6 ] = ctx->Map.pci[ 6 ];
}
}
@@ -1074,10 +1172,11 @@ static void RtemsRatemonReqGetStatus_TestVariant(
{
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_Pre_CpuUse_Prepare( ctx, ctx->Map.pcs[ 2 ] );
+ RtemsRatemonReqGetStatus_Pre_State_Prepare( ctx, ctx->Map.pcs[ 3 ] );
+ RtemsRatemonReqGetStatus_Pre_Elapsed_Prepare( ctx, ctx->Map.pcs[ 4 ] );
+ RtemsRatemonReqGetStatus_Pre_Consumed_Prepare( ctx, ctx->Map.pcs[ 5 ] );
+ RtemsRatemonReqGetStatus_Pre_Postponed_Prepare( ctx, ctx->Map.pcs[ 6 ] );
RtemsRatemonReqGetStatus_Action( ctx );
RtemsRatemonReqGetStatus_Post_Status_Check(
ctx,
@@ -1124,35 +1223,41 @@ T_TEST_CASE_FIXTURE(
++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 ] = RtemsRatemonReqGetStatus_Pre_CpuUse_Kept;
+ ctx->Map.pci[ 2 ] < RtemsRatemonReqGetStatus_Pre_CpuUse_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 ] = RtemsRatemonReqGetStatus_Pre_State_Inactive;
+ ctx->Map.pci[ 3 ] < RtemsRatemonReqGetStatus_Pre_State_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 ] = RtemsRatemonReqGetStatus_Pre_Elapsed_Time;
+ ctx->Map.pci[ 4 ] < RtemsRatemonReqGetStatus_Pre_Elapsed_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 ] = RtemsRatemonReqGetStatus_Pre_Consumed_CpuTime;
+ ctx->Map.pci[ 5 ] < RtemsRatemonReqGetStatus_Pre_Consumed_NA;
++ctx->Map.pci[ 5 ]
) {
- ctx->Map.entry = RtemsRatemonReqGetStatus_PopEntry( ctx );
-
- if ( ctx->Map.entry.Skip ) {
- continue;
+ for (
+ ctx->Map.pci[ 6 ] = RtemsRatemonReqGetStatus_Pre_Postponed_Zero;
+ ctx->Map.pci[ 6 ] < RtemsRatemonReqGetStatus_Pre_Postponed_NA;
+ ++ctx->Map.pci[ 6 ]
+ ) {
+ ctx->Map.entry = RtemsRatemonReqGetStatus_PopEntry( ctx );
+
+ if ( ctx->Map.entry.Skip ) {
+ continue;
+ }
+
+ RtemsRatemonReqGetStatus_SetPreConditionStates( ctx );
+ RtemsRatemonReqGetStatus_Prepare( ctx );
+ RtemsRatemonReqGetStatus_TestVariant( ctx );
+ RtemsRatemonReqGetStatus_Cleanup( ctx );
}
-
- RtemsRatemonReqGetStatus_SetPreConditionStates( ctx );
- RtemsRatemonReqGetStatus_Prepare( ctx );
- RtemsRatemonReqGetStatus_TestVariant( ctx );
- RtemsRatemonReqGetStatus_Cleanup( ctx );
}
}
}
diff --git a/testsuites/validation/tc-ratemon-period.c b/testsuites/validation/tc-ratemon-period.c
index 3385d76536..6055e8f976 100644
--- a/testsuites/validation/tc-ratemon-period.c
+++ b/testsuites/validation/tc-ratemon-period.c
@@ -667,6 +667,7 @@ static void RtemsRatemonReqPeriod_Pre_InactiveCause_Prepare(
* parameter since that period object has been created.
*/
/* Nothing to do here as the period is newly created. */
+ ctx->postponed_jobs_count = 0;
break;
}
@@ -682,6 +683,7 @@ static void RtemsRatemonReqPeriod_Pre_InactiveCause_Prepare(
TickTheClock( ctx, ctx->postponed_jobs_count * period_length );
}
OwnerDoWork( ctx, CancelPeriod );
+ ctx->postponed_jobs_count = 0;
break;
}
@@ -831,9 +833,6 @@ static void RtemsRatemonReqPeriod_Post_Postponed_Check(
* 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).
- *
- * Note: A newly created period has an arbitrary the number of postponed
- * jobs because rtems_rate_monotonic_create() does not set this value 0.
*/
T_eq_u32(
ctx->period_status.postponed_jobs_count,
@@ -1017,7 +1016,6 @@ static void RtemsRatemonReqPeriod_Prepare( RtemsRatemonReqPeriod_Context *ctx )
&period_status
);
T_rsc_success( status );
- ctx->postponed_jobs_count = period_status.postponed_jobs_count;
}
static void RtemsRatemonReqPeriod_Action( RtemsRatemonReqPeriod_Context *ctx )
diff --git a/testsuites/validation/tc-ratemon-timeout.c b/testsuites/validation/tc-ratemon-timeout.c
index 9025f9ec2b..b70a5cc85c 100644
--- a/testsuites/validation/tc-ratemon-timeout.c
+++ b/testsuites/validation/tc-ratemon-timeout.c
@@ -427,7 +427,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare(
switch ( state ) {
case RtemsRatemonReqTimeout_Pre_WaitFor_PeriodSelf: {
/*
- * While the owner of the period waits for the period.
+ * While the owner task of the period waits for the period.
*/
ctx->wait_for_period = true;
ctx->period_is_other = false;
@@ -436,7 +436,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare(
case RtemsRatemonReqTimeout_Pre_WaitFor_PeriodOther: {
/*
- * While the owner of the period waits for another period.
+ * While the owner task of the period waits for another period.
*/
ctx->wait_for_period = true;
ctx->period_is_other = true;
@@ -445,7 +445,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare(
case RtemsRatemonReqTimeout_Pre_WaitFor_Other: {
/*
- * While the owner of the period does not wait for a period.
+ * While the owner task of the period does not wait for a period.
*/
ctx->wait_for_period = false;
break;
@@ -464,7 +464,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitState_Prepare(
switch ( state ) {
case RtemsRatemonReqTimeout_Pre_WaitState_Blocked: {
/*
- * While the owner is in the blocked wait state.
+ * While the owner task is in the blocked wait state.
*/
ctx->intend_to_block = false;
break;
@@ -472,7 +472,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitState_Prepare(
case RtemsRatemonReqTimeout_Pre_WaitState_IntendToBlock: {
/*
- * While the owner is in the intend to block wait state.
+ * While the owner task is in the intend to block wait state.
*/
ctx->intend_to_block = true;
break;
@@ -553,8 +553,9 @@ static void RtemsRatemonReqTimeout_Post_ReleaseJob_Check(
switch ( state ) {
case RtemsRatemonReqTimeout_Post_ReleaseJob_Yes: {
/*
- * The owner of the period shall release a job with a deadline equal to
- * the clock tick plus the next period length by the timeout operation.
+ * 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;
@@ -562,7 +563,7 @@ static void RtemsRatemonReqTimeout_Post_ReleaseJob_Check(
case RtemsRatemonReqTimeout_Post_ReleaseJob_No: {
/*
- * The owner of the period shall not release a job by the timeout
+ * The owner task of the period shall not release a job by the timeout
* operation.
*/
T_eq_u32( ctx->release_job_counter, 0 );
@@ -582,7 +583,8 @@ static void RtemsRatemonReqTimeout_Post_Unblock_Check(
switch ( state ) {
case RtemsRatemonReqTimeout_Post_Unblock_Yes: {
/*
- * The owner of the period shall be unblocked by the timeout operation.
+ * The owner task of the period shall be unblocked by the timeout
+ * operation.
*/
T_eq_u32( ctx->unblock_counter, 1 );
break;
@@ -590,7 +592,7 @@ static void RtemsRatemonReqTimeout_Post_Unblock_Check(
case RtemsRatemonReqTimeout_Post_Unblock_No: {
/*
- * The owner of the period shall not be unblocked by the timeout
+ * The owner task of the period shall not be unblocked by the timeout
* operation.
*/
T_eq_u32( ctx->unblock_counter, 0 );
@@ -689,7 +691,7 @@ static void RtemsRatemonReqTimeout_Post_CPUUsage_Check(
switch ( state ) {
case RtemsRatemonReqTimeout_Post_CPUUsage_Nop: {
/*
- * The period initiated CPU usage of the owner value shall not be
+ * The period initiated CPU usage of the owner task value shall not be
* modified.
*/
T_eq_i64(
@@ -701,8 +703,8 @@ static void RtemsRatemonReqTimeout_Post_CPUUsage_Check(
case RtemsRatemonReqTimeout_Post_CPUUsage_Set: {
/*
- * The period initiated CPU usage of the owner value shall be set to the
- * CPU usage of the owner at some time point during the timeout
+ * 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(