summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-12 13:49:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-12 13:54:22 +0200
commit03622d96aaa28e1fd2173e810b0eca915a124cd6 (patch)
treee783c66153e938be92f46a4f5bd05afe8c12705a
parent65080360bb01bf61aa84160f3912a9913dd97dc7 (diff)
testsuites/unit/tc-ratemon-statistics.c
-rw-r--r--spec/build/testsuites/unit/unit-no-clock-0.yml1
-rw-r--r--testsuites/unit/tc-ratemon-statistics.c242
2 files changed, 0 insertions, 243 deletions
diff --git a/spec/build/testsuites/unit/unit-no-clock-0.yml b/spec/build/testsuites/unit/unit-no-clock-0.yml
index dc12e75b0a..7fb984e185 100644
--- a/spec/build/testsuites/unit/unit-no-clock-0.yml
+++ b/spec/build/testsuites/unit/unit-no-clock-0.yml
@@ -11,7 +11,6 @@ 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/tc-score-rbtree.c
diff --git a/testsuites/unit/tc-ratemon-statistics.c b/testsuites/unit/tc-ratemon-statistics.c
deleted file mode 100644
index 4989c393b5..0000000000
--- a/testsuites/unit/tc-ratemon-statistics.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/* 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 );
-}
-
-/** @} */