summaryrefslogtreecommitdiffstats
path: root/testsuites/validation
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-15 10:02:40 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-03-24 11:10:48 +0100
commit1410d5b8bff73b42796088571f302575e68ae809 (patch)
tree117bdeb1fec693312c900a58db40fca3fba6c9cf /testsuites/validation
parentvalidation: Test attributes (diff)
downloadrtems-1410d5b8bff73b42796088571f302575e68ae809.tar.bz2
validation: Test Barrier Manager
The test source code is generated from specification items by the "./spec2modules.py" script contained in the git://git.rtems.org/rtems-central.git Git repository. Please read the "How-To" section in the "Software Requirements Engineering" chapter of the RTEMS Software Engineering manual to get more information about the process. Update #3716.
Diffstat (limited to 'testsuites/validation')
-rw-r--r--testsuites/validation/tc-barrier-create.c2
-rw-r--r--testsuites/validation/tc-barrier-delete.c2
-rw-r--r--testsuites/validation/tc-barrier-ident.c116
-rw-r--r--testsuites/validation/tc-barrier-performance.c602
-rw-r--r--testsuites/validation/tc-barrier-release.c46
-rw-r--r--testsuites/validation/tc-barrier-wait.c76
6 files changed, 806 insertions, 38 deletions
diff --git a/testsuites/validation/tc-barrier-create.c b/testsuites/validation/tc-barrier-create.c
index 628d1a4a09..64b2540c79 100644
--- a/testsuites/validation/tc-barrier-create.c
+++ b/testsuites/validation/tc-barrier-create.c
@@ -62,7 +62,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierReqCreate spec:/rtems/barrier/req/create
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
diff --git a/testsuites/validation/tc-barrier-delete.c b/testsuites/validation/tc-barrier-delete.c
index df974fd374..1915ffb7ad 100644
--- a/testsuites/validation/tc-barrier-delete.c
+++ b/testsuites/validation/tc-barrier-delete.c
@@ -62,7 +62,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierReqDelete spec:/rtems/barrier/req/delete
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
diff --git a/testsuites/validation/tc-barrier-ident.c b/testsuites/validation/tc-barrier-ident.c
new file mode 100644
index 0000000000..71e7051f66
--- /dev/null
+++ b/testsuites/validation/tc-barrier-ident.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsBarrierValIdent
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file is part of the RTEMS quality process and was automatically
+ * generated. If you find something that needs to be fixed or
+ * worded better please post a report or patch to an RTEMS mailing list
+ * or raise a bug report:
+ *
+ * https://www.rtems.org/bugs.html
+ *
+ * For information on updating and regenerating please refer to the How-To
+ * section in the Software Requirements Engineering chapter of the
+ * RTEMS Software Engineering manual. The manual is provided as a part of
+ * a release. For development sources please refer to the online
+ * documentation at:
+ *
+ * https://docs.rtems.org
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tr-object-ident-local.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseRtemsBarrierValIdent spec:/rtems/barrier/val/ident
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @brief Test the rtems_barrier_ident() directive.
+ *
+ * This test case performs the following actions:
+ *
+ * - Run the generic object identification tests for Classic API partition
+ * class objects defined by /rtems/req/ident-local.
+ *
+ * @{
+ */
+
+static rtems_status_code ClassicBarrierIdentAction(
+ rtems_name name,
+ rtems_id *id
+)
+{
+ return rtems_barrier_ident( name, id );
+}
+
+/**
+ * @brief Run the generic object identification tests for Classic API partition
+ * class objects defined by /rtems/req/ident-local.
+ */
+static void RtemsBarrierValIdent_Action_0( void )
+{
+ rtems_status_code sc;
+ rtems_id id_local_object;
+
+ sc = rtems_barrier_create(
+ ClassicObjectLocalIdentName,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ 1,
+ &id_local_object
+ );
+ T_assert_rsc_success( sc );
+
+ RtemsReqIdentLocal_Run(
+ id_local_object,
+ ClassicBarrierIdentAction
+ );
+
+ sc = rtems_barrier_delete( id_local_object );
+ T_rsc_success( sc );
+}
+
+/**
+ * @fn void T_case_body_RtemsBarrierValIdent( void )
+ */
+T_TEST_CASE( RtemsBarrierValIdent )
+{
+ RtemsBarrierValIdent_Action_0();
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-barrier-performance.c b/testsuites/validation/tc-barrier-performance.c
new file mode 100644
index 0000000000..91573e4c10
--- /dev/null
+++ b/testsuites/validation/tc-barrier-performance.c
@@ -0,0 +1,602 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseRtemsBarrierValPerf
+ */
+
+/*
+ * 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 RTEMSTestCaseRtemsBarrierValPerf spec:/rtems/barrier/val/perf
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
+ *
+ * @brief This test case provides a context to run @ref RTEMSAPIClassicBarrier
+ * performance tests.
+ *
+ * @{
+ */
+
+/**
+ * @brief Test context for spec:/rtems/barrier/val/perf test case.
+ */
+typedef struct {
+ /**
+ * @brief This member provides a barrier identifier.
+ */
+ rtems_id barrier_id;
+
+ /**
+ * @brief This member provides a worker identifier.
+ */
+ rtems_id worker_id;
+
+ /**
+ * @brief This member provides a status code.
+ */
+ rtems_status_code status;
+
+ /**
+ * @brief This member references the measure runtime context.
+ */
+ T_measure_runtime_context *context;
+
+ /**
+ * @brief This member provides the measure runtime request.
+ */
+ T_measure_runtime_request request;
+
+ /**
+ * @brief This member provides an optional measurement begin time point.
+ */
+ T_ticks begin;
+
+ /**
+ * @brief This member provides an optional measurement end time point.
+ */
+ T_ticks end;
+} RtemsBarrierValPerf_Context;
+
+static RtemsBarrierValPerf_Context
+ RtemsBarrierValPerf_Instance;
+
+typedef RtemsBarrierValPerf_Context Context;
+
+static void BarrierWaitWorker( rtems_task_argument arg )
+{
+ Context *ctx;
+
+ ctx = (Context *) arg;
+
+ while ( true ) {
+ rtems_status_code sc;
+
+ sc = rtems_barrier_wait( ctx->barrier_id, RTEMS_NO_TIMEOUT );
+ ctx->end = T_tick();
+ T_quiet_rsc_success( sc );
+ }
+}
+
+static void RtemsBarrierValPerf_Setup_Context(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ T_measure_runtime_config config;
+
+ memset( &config, 0, sizeof( config ) );
+ config.sample_count = 100;
+ ctx->request.arg = ctx;
+ ctx->request.flags = T_MEASURE_RUNTIME_REPORT_SAMPLES;
+ ctx->context = T_measure_runtime_create( &config );
+ T_assert_not_null( ctx->context );
+}
+
+static void RtemsBarrierValPerf_Setup_Wrap( void *arg )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsBarrierValPerf_Setup_Context( ctx );
+}
+
+static T_fixture RtemsBarrierValPerf_Fixture = {
+ .setup = RtemsBarrierValPerf_Setup_Wrap,
+ .stop = NULL,
+ .teardown = NULL,
+ .scope = NULL,
+ .initial_context = &RtemsBarrierValPerf_Instance
+};
+
+/**
+ * @brief Create an automatic release barrier.
+ */
+static void RtemsBarrierReqPerfReleaseAuto_Prepare(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ sc = rtems_barrier_create(
+ OBJECT_NAME,
+ RTEMS_BARRIER_AUTOMATIC_RELEASE,
+ 1,
+ &ctx->barrier_id
+ );
+ T_rsc_success( sc );
+}
+
+/**
+ * @brief Automatically release the barrier.
+ */
+static void RtemsBarrierReqPerfReleaseAuto_Body(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ ctx->status = rtems_barrier_wait( ctx->barrier_id, RTEMS_NO_TIMEOUT );
+}
+
+static void RtemsBarrierReqPerfReleaseAuto_Body_Wrap( void *arg )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsBarrierReqPerfReleaseAuto_Body( ctx );
+}
+
+/**
+ * @brief Discard samples interrupted by a clock tick.
+ */
+static bool RtemsBarrierReqPerfReleaseAuto_Teardown(
+ RtemsBarrierValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ T_quiet_rsc_success( ctx->status );
+
+ return tic == toc;
+}
+
+static bool RtemsBarrierReqPerfReleaseAuto_Teardown_Wrap(
+ void *arg,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ return RtemsBarrierReqPerfReleaseAuto_Teardown(
+ ctx,
+ delta,
+ tic,
+ toc,
+ retry
+ );
+}
+
+/**
+ * @brief Delete the barrier and the worker.
+ */
+static void RtemsBarrierReqPerfReleaseAuto_Cleanup(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ sc = rtems_barrier_delete( ctx->barrier_id );
+ T_rsc_success( sc );
+}
+
+#if defined(RTEMS_SMP)
+/**
+ * @brief Create an automatic release barrier. Create and start a worker task.
+ */
+static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Prepare(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ sc = rtems_barrier_create(
+ OBJECT_NAME,
+ RTEMS_BARRIER_AUTOMATIC_RELEASE,
+ 2,
+ &ctx->barrier_id
+ );
+ T_rsc_success( sc );
+
+ ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
+ SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
+ StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
+ WaitForNextTask( 1, ctx->worker_id );
+}
+
+/**
+ * @brief Automatically release the barrier.
+ */
+static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Body(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ ctx->begin = T_tick();
+ ctx->status = rtems_barrier_wait( ctx->barrier_id, RTEMS_NO_TIMEOUT );
+}
+
+static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Body_Wrap( void *arg )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsBarrierReqPerfReleaseAutoOtherCpu_Body( ctx );
+}
+
+/**
+ * @brief Make sure the worker waits for the next event. Set the measured
+ * runtime. Discard samples interrupted by a clock tick.
+ */
+static bool RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown(
+ RtemsBarrierValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ T_quiet_rsc_success( ctx->status );
+
+ WaitForNextTask( 1, ctx->worker_id );
+ *delta = ctx->end - ctx->begin;
+
+ return tic == toc;
+}
+
+static bool RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown_Wrap(
+ void *arg,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ return RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown(
+ ctx,
+ delta,
+ tic,
+ toc,
+ retry
+ );
+}
+
+/**
+ * @brief Delete the barrier and the worker.
+ */
+static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Cleanup(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ DeleteTask( ctx->worker_id );
+
+ sc = rtems_barrier_delete( ctx->barrier_id );
+ T_rsc_success( sc );
+}
+#endif
+
+/**
+ * @brief Create a manual release barrier. Create and start a worker task.
+ */
+static void RtemsBarrierReqPerfReleaseManual_Prepare(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ sc = rtems_barrier_create(
+ OBJECT_NAME,
+ RTEMS_BARRIER_MANUAL_RELEASE,
+ 0,
+ &ctx->barrier_id
+ );
+ T_rsc_success( sc );
+
+ SetSelfPriority( PRIO_NORMAL );
+ ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
+ StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
+}
+
+/**
+ * @brief Make sure the worker task is fully blocked on the barrier.
+ */
+static void RtemsBarrierReqPerfReleaseManual_Setup(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ Yield();
+}
+
+static void RtemsBarrierReqPerfReleaseManual_Setup_Wrap( void *arg )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsBarrierReqPerfReleaseManual_Setup( ctx );
+}
+
+/**
+ * @brief Release the barrier.
+ */
+static void RtemsBarrierReqPerfReleaseManual_Body(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ uint32_t count;
+
+ ctx->status = rtems_barrier_release( ctx->barrier_id, &count );
+}
+
+static void RtemsBarrierReqPerfReleaseManual_Body_Wrap( void *arg )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsBarrierReqPerfReleaseManual_Body( ctx );
+}
+
+/**
+ * @brief Discard samples interrupted by a clock tick.
+ */
+static bool RtemsBarrierReqPerfReleaseManual_Teardown(
+ RtemsBarrierValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ T_quiet_rsc_success( ctx->status );
+
+ return tic == toc;
+}
+
+static bool RtemsBarrierReqPerfReleaseManual_Teardown_Wrap(
+ void *arg,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ return RtemsBarrierReqPerfReleaseManual_Teardown(
+ ctx,
+ delta,
+ tic,
+ toc,
+ retry
+ );
+}
+
+/**
+ * @brief Delete the barrier and the worker.
+ */
+static void RtemsBarrierReqPerfReleaseManual_Cleanup(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ DeleteTask( ctx->worker_id );
+
+ sc = rtems_barrier_delete( ctx->barrier_id );
+ T_rsc_success( sc );
+
+ RestoreRunnerPriority();
+}
+
+/**
+ * @brief Create a manual release barrier. Create and start a worker task.
+ */
+static void RtemsBarrierReqPerfReleaseManualPreempt_Prepare(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ sc = rtems_barrier_create(
+ OBJECT_NAME,
+ RTEMS_BARRIER_MANUAL_RELEASE,
+ 0,
+ &ctx->barrier_id
+ );
+ T_rsc_success( sc );
+
+ SetSelfPriority( PRIO_NORMAL );
+ ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
+ StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
+}
+
+/**
+ * @brief Release the barrier.
+ */
+static void RtemsBarrierReqPerfReleaseManualPreempt_Body(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ uint32_t count;
+
+ ctx->begin = T_tick();
+ ctx->status = rtems_barrier_release( ctx->barrier_id, &count );
+}
+
+static void RtemsBarrierReqPerfReleaseManualPreempt_Body_Wrap( void *arg )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsBarrierReqPerfReleaseManualPreempt_Body( ctx );
+}
+
+/**
+ * @brief Set the measured runtime. Discard samples interrupted by a clock
+ * tick.
+ */
+static bool RtemsBarrierReqPerfReleaseManualPreempt_Teardown(
+ RtemsBarrierValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ T_quiet_rsc_success( ctx->status );
+
+ *delta = ctx->end - ctx->begin;
+
+ return tic == toc;
+}
+
+static bool RtemsBarrierReqPerfReleaseManualPreempt_Teardown_Wrap(
+ void *arg,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = arg;
+ return RtemsBarrierReqPerfReleaseManualPreempt_Teardown(
+ ctx,
+ delta,
+ tic,
+ toc,
+ retry
+ );
+}
+
+/**
+ * @brief Delete the barrier and the worker.
+ */
+static void RtemsBarrierReqPerfReleaseManualPreempt_Cleanup(
+ RtemsBarrierValPerf_Context *ctx
+)
+{
+ rtems_status_code sc;
+
+ DeleteTask( ctx->worker_id );
+
+ sc = rtems_barrier_delete( ctx->barrier_id );
+ T_rsc_success( sc );
+
+ RestoreRunnerPriority();
+}
+
+/**
+ * @fn void T_case_body_RtemsBarrierValPerf( void )
+ */
+T_TEST_CASE_FIXTURE( RtemsBarrierValPerf, &RtemsBarrierValPerf_Fixture )
+{
+ RtemsBarrierValPerf_Context *ctx;
+
+ ctx = T_fixture_context();
+
+ RtemsBarrierReqPerfReleaseAuto_Prepare( ctx );
+ ctx->request.name = "RtemsBarrierReqPerfReleaseAuto";
+ ctx->request.setup = NULL;
+ ctx->request.body = RtemsBarrierReqPerfReleaseAuto_Body_Wrap;
+ ctx->request.teardown = RtemsBarrierReqPerfReleaseAuto_Teardown_Wrap;
+ T_measure_runtime( ctx->context, &ctx->request );
+ RtemsBarrierReqPerfReleaseAuto_Cleanup( ctx );
+
+ #if defined(RTEMS_SMP)
+ RtemsBarrierReqPerfReleaseAutoOtherCpu_Prepare( ctx );
+ ctx->request.name = "RtemsBarrierReqPerfReleaseAutoOtherCpu";
+ ctx->request.setup = NULL;
+ ctx->request.body = RtemsBarrierReqPerfReleaseAutoOtherCpu_Body_Wrap;
+ ctx->request.teardown = RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown_Wrap;
+ T_measure_runtime( ctx->context, &ctx->request );
+ RtemsBarrierReqPerfReleaseAutoOtherCpu_Cleanup( ctx );
+ #endif
+
+ RtemsBarrierReqPerfReleaseManual_Prepare( ctx );
+ ctx->request.name = "RtemsBarrierReqPerfReleaseManual";
+ ctx->request.setup = RtemsBarrierReqPerfReleaseManual_Setup_Wrap;
+ ctx->request.body = RtemsBarrierReqPerfReleaseManual_Body_Wrap;
+ ctx->request.teardown = RtemsBarrierReqPerfReleaseManual_Teardown_Wrap;
+ T_measure_runtime( ctx->context, &ctx->request );
+ RtemsBarrierReqPerfReleaseManual_Cleanup( ctx );
+
+ RtemsBarrierReqPerfReleaseManualPreempt_Prepare( ctx );
+ ctx->request.name = "RtemsBarrierReqPerfReleaseManualPreempt";
+ ctx->request.setup = NULL;
+ ctx->request.body = RtemsBarrierReqPerfReleaseManualPreempt_Body_Wrap;
+ ctx->request.teardown = RtemsBarrierReqPerfReleaseManualPreempt_Teardown_Wrap;
+ T_measure_runtime( ctx->context, &ctx->request );
+ RtemsBarrierReqPerfReleaseManualPreempt_Cleanup( ctx );
+}
+
+/** @} */
diff --git a/testsuites/validation/tc-barrier-release.c b/testsuites/validation/tc-barrier-release.c
index de77e22027..beb26f4660 100644
--- a/testsuites/validation/tc-barrier-release.c
+++ b/testsuites/validation/tc-barrier-release.c
@@ -63,7 +63,7 @@
* @defgroup RTEMSTestCaseRtemsBarrierReqRelease \
* spec:/rtems/barrier/req/release
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
@@ -131,6 +131,12 @@ typedef struct {
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 ];
@@ -500,16 +506,27 @@ static inline RtemsBarrierReqRelease_Entry RtemsBarrierReqRelease_PopEntry(
];
}
+static void RtemsBarrierReqRelease_SetPreConditionStates(
+ RtemsBarrierReqRelease_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+
+ if ( ctx->Map.entry.Pre_Waiting_NA ) {
+ ctx->Map.pcs[ 2 ] = RtemsBarrierReqRelease_Pre_Waiting_NA;
+ } else {
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+ }
+}
+
static void RtemsBarrierReqRelease_TestVariant(
RtemsBarrierReqRelease_Context *ctx
)
{
RtemsBarrierReqRelease_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
RtemsBarrierReqRelease_Pre_Released_Prepare( ctx, ctx->Map.pcs[ 1 ] );
- RtemsBarrierReqRelease_Pre_Waiting_Prepare(
- ctx,
- ctx->Map.entry.Pre_Waiting_NA ? RtemsBarrierReqRelease_Pre_Waiting_NA : ctx->Map.pcs[ 2 ]
- );
+ RtemsBarrierReqRelease_Pre_Waiting_Prepare( ctx, ctx->Map.pcs[ 2 ] );
RtemsBarrierReqRelease_Action( ctx );
RtemsBarrierReqRelease_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
RtemsBarrierReqRelease_Post_ReleasedVar_Check(
@@ -530,21 +547,22 @@ T_TEST_CASE_FIXTURE( RtemsBarrierReqRelease, &RtemsBarrierReqRelease_Fixture )
ctx->Map.index = 0;
for (
- ctx->Map.pcs[ 0 ] = RtemsBarrierReqRelease_Pre_Id_NoObj;
- ctx->Map.pcs[ 0 ] < RtemsBarrierReqRelease_Pre_Id_NA;
- ++ctx->Map.pcs[ 0 ]
+ ctx->Map.pci[ 0 ] = RtemsBarrierReqRelease_Pre_Id_NoObj;
+ ctx->Map.pci[ 0 ] < RtemsBarrierReqRelease_Pre_Id_NA;
+ ++ctx->Map.pci[ 0 ]
) {
for (
- ctx->Map.pcs[ 1 ] = RtemsBarrierReqRelease_Pre_Released_Valid;
- ctx->Map.pcs[ 1 ] < RtemsBarrierReqRelease_Pre_Released_NA;
- ++ctx->Map.pcs[ 1 ]
+ ctx->Map.pci[ 1 ] = RtemsBarrierReqRelease_Pre_Released_Valid;
+ ctx->Map.pci[ 1 ] < RtemsBarrierReqRelease_Pre_Released_NA;
+ ++ctx->Map.pci[ 1 ]
) {
for (
- ctx->Map.pcs[ 2 ] = RtemsBarrierReqRelease_Pre_Waiting_Zero;
- ctx->Map.pcs[ 2 ] < RtemsBarrierReqRelease_Pre_Waiting_NA;
- ++ctx->Map.pcs[ 2 ]
+ ctx->Map.pci[ 2 ] = RtemsBarrierReqRelease_Pre_Waiting_Zero;
+ ctx->Map.pci[ 2 ] < RtemsBarrierReqRelease_Pre_Waiting_NA;
+ ++ctx->Map.pci[ 2 ]
) {
ctx->Map.entry = RtemsBarrierReqRelease_PopEntry( ctx );
+ RtemsBarrierReqRelease_SetPreConditionStates( ctx );
RtemsBarrierReqRelease_TestVariant( ctx );
}
}
diff --git a/testsuites/validation/tc-barrier-wait.c b/testsuites/validation/tc-barrier-wait.c
index 54632cf7ca..700b846cad 100644
--- a/testsuites/validation/tc-barrier-wait.c
+++ b/testsuites/validation/tc-barrier-wait.c
@@ -62,7 +62,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierReqWait spec:/rtems/barrier/req/wait
*
- * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
*
* @{
*/
@@ -127,6 +127,12 @@ typedef struct {
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 ];
@@ -187,7 +193,7 @@ static const char * const * const RtemsBarrierReqWait_PreDesc[] = {
#define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
-#define EVENT_CHECK_TIMER RTEMS_EVENT_0
+#define EVENT_TIMER_INACTIVE RTEMS_EVENT_0
#define EVENT_WAIT RTEMS_EVENT_1
@@ -195,6 +201,8 @@ static const char * const * const RtemsBarrierReqWait_PreDesc[] = {
#define EVENT_DELETE RTEMS_EVENT_3
+#define EVENT_TIMER_EXPIRE RTEMS_EVENT_4
+
typedef RtemsBarrierReqWait_Context Context;
static void Worker( rtems_task_argument arg )
@@ -209,7 +217,7 @@ static void Worker( rtems_task_argument arg )
events = ReceiveAnyEvents();
- if ( ( events & EVENT_CHECK_TIMER ) != 0 ) {
+ if ( ( events & EVENT_TIMER_INACTIVE ) != 0 ) {
T_eq_int(
T_get_thread_timer_state( ctx->main_id ),
T_THREAD_TIMER_INACTIVE
@@ -256,6 +264,14 @@ static void Worker( rtems_task_argument arg )
prio = SetSelfPriority( prio );
T_eq_u32( prio, PRIO_HIGH );
}
+
+ if ( ( events & EVENT_TIMER_EXPIRE ) != 0 ) {
+ T_eq_int(
+ T_get_thread_timer_state( ctx->main_id ),
+ T_THREAD_TIMER_SCHEDULED
+ );
+ FinalClockTick();
+ }
}
}
@@ -306,7 +322,7 @@ static void RtemsBarrierReqWait_Pre_Timeout_Prepare(
/*
* While the ``released`` parameter is a clock tick interval.
*/
- ctx->timeout = 2;
+ ctx->timeout = UINT32_MAX;
break;
}
@@ -335,7 +351,9 @@ static void RtemsBarrierReqWait_Pre_Satisfy_Prepare(
* released or deleted.
*/
if ( ctx->timeout == RTEMS_NO_TIMEOUT ) {
- SendEvents( ctx->low_worker_id, EVENT_CHECK_TIMER | EVENT_RELEASE );
+ SendEvents( ctx->low_worker_id, EVENT_TIMER_INACTIVE | EVENT_RELEASE );
+ } else {
+ SendEvents( ctx->low_worker_id, EVENT_TIMER_EXPIRE );
}
break;
}
@@ -544,17 +562,30 @@ static inline RtemsBarrierReqWait_Entry RtemsBarrierReqWait_PopEntry(
];
}
+static void RtemsBarrierReqWait_SetPreConditionStates(
+ RtemsBarrierReqWait_Context *ctx
+)
+{
+ ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
+
+ if ( ctx->Map.entry.Pre_Timeout_NA ) {
+ ctx->Map.pcs[ 1 ] = RtemsBarrierReqWait_Pre_Timeout_NA;
+ } else {
+ ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
+ }
+
+ if ( ctx->Map.entry.Pre_Satisfy_NA ) {
+ ctx->Map.pcs[ 2 ] = RtemsBarrierReqWait_Pre_Satisfy_NA;
+ } else {
+ ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
+ }
+}
+
static void RtemsBarrierReqWait_TestVariant( RtemsBarrierReqWait_Context *ctx )
{
RtemsBarrierReqWait_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
- RtemsBarrierReqWait_Pre_Timeout_Prepare(
- ctx,
- ctx->Map.entry.Pre_Timeout_NA ? RtemsBarrierReqWait_Pre_Timeout_NA : ctx->Map.pcs[ 1 ]
- );
- RtemsBarrierReqWait_Pre_Satisfy_Prepare(
- ctx,
- ctx->Map.entry.Pre_Satisfy_NA ? RtemsBarrierReqWait_Pre_Satisfy_NA : ctx->Map.pcs[ 2 ]
- );
+ RtemsBarrierReqWait_Pre_Timeout_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ RtemsBarrierReqWait_Pre_Satisfy_Prepare( ctx, ctx->Map.pcs[ 2 ] );
RtemsBarrierReqWait_Action( ctx );
RtemsBarrierReqWait_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
}
@@ -571,19 +602,19 @@ T_TEST_CASE_FIXTURE( RtemsBarrierReqWait, &RtemsBarrierReqWait_Fixture )
ctx->Map.index = 0;
for (
- ctx->Map.pcs[ 0 ] = RtemsBarrierReqWait_Pre_Id_NoObj;
- ctx->Map.pcs[ 0 ] < RtemsBarrierReqWait_Pre_Id_NA;
- ++ctx->Map.pcs[ 0 ]
+ ctx->Map.pci[ 0 ] = RtemsBarrierReqWait_Pre_Id_NoObj;
+ ctx->Map.pci[ 0 ] < RtemsBarrierReqWait_Pre_Id_NA;
+ ++ctx->Map.pci[ 0 ]
) {
for (
- ctx->Map.pcs[ 1 ] = RtemsBarrierReqWait_Pre_Timeout_Ticks;
- ctx->Map.pcs[ 1 ] < RtemsBarrierReqWait_Pre_Timeout_NA;
- ++ctx->Map.pcs[ 1 ]
+ ctx->Map.pci[ 1 ] = RtemsBarrierReqWait_Pre_Timeout_Ticks;
+ ctx->Map.pci[ 1 ] < RtemsBarrierReqWait_Pre_Timeout_NA;
+ ++ctx->Map.pci[ 1 ]
) {
for (
- ctx->Map.pcs[ 2 ] = RtemsBarrierReqWait_Pre_Satisfy_Never;
- ctx->Map.pcs[ 2 ] < RtemsBarrierReqWait_Pre_Satisfy_NA;
- ++ctx->Map.pcs[ 2 ]
+ ctx->Map.pci[ 2 ] = RtemsBarrierReqWait_Pre_Satisfy_Never;
+ ctx->Map.pci[ 2 ] < RtemsBarrierReqWait_Pre_Satisfy_NA;
+ ++ctx->Map.pci[ 2 ]
) {
ctx->Map.entry = RtemsBarrierReqWait_PopEntry( ctx );
@@ -591,6 +622,7 @@ T_TEST_CASE_FIXTURE( RtemsBarrierReqWait, &RtemsBarrierReqWait_Fixture )
continue;
}
+ RtemsBarrierReqWait_SetPreConditionStates( ctx );
RtemsBarrierReqWait_TestVariant( ctx );
}
}