forked from Imagelibrary/rtems
validation: Test Event Manager
The test source code is generated from specification items by the "./spec2modules.py" script contained in the git://git.rtems.org/rtems-central.git Git repository. Please read the "How-To" section in the "Software Requirements Engineering" chapter of the RTEMS Software Engineering manual to get more information about the process. Update #3716.
This commit is contained in:
@@ -12,6 +12,7 @@ ldflags: []
|
||||
links: []
|
||||
source:
|
||||
- testsuites/validation/tc-barrier-performance.c
|
||||
- testsuites/validation/tc-event-performance.c
|
||||
- testsuites/validation/ts-performance-no-clock-0.c
|
||||
stlib: []
|
||||
target: testsuites/validation/ts-performance-no-clock-0.exe
|
||||
|
||||
@@ -12,6 +12,7 @@ ldflags: []
|
||||
links: []
|
||||
source:
|
||||
- testsuites/validation/tc-acfg-appl-needs-clock-driver.c
|
||||
- testsuites/validation/tc-event-send-receive.c
|
||||
- testsuites/validation/tc-intr-clear.c
|
||||
- testsuites/validation/tc-intr-entry-install.c
|
||||
- testsuites/validation/tc-intr-entry-remove.c
|
||||
@@ -31,6 +32,7 @@ source:
|
||||
- testsuites/validation/tc-signal-send.c
|
||||
- testsuites/validation/tc-task-construct-errors.c
|
||||
- testsuites/validation/tc-task-create-errors.c
|
||||
- testsuites/validation/tr-event-send-receive.c
|
||||
- testsuites/validation/ts-validation-0.c
|
||||
stlib: []
|
||||
target: testsuites/validation/ts-validation-0.exe
|
||||
|
||||
@@ -26,7 +26,9 @@ source:
|
||||
- testsuites/validation/tc-clock-nanosleep.c
|
||||
- testsuites/validation/tc-clock-set.c
|
||||
- testsuites/validation/tc-cpuuse.c
|
||||
- testsuites/validation/tc-events.c
|
||||
- testsuites/validation/tc-score-fatal.c
|
||||
- testsuites/validation/tr-event-constant.c
|
||||
- testsuites/validation/tr-mtx-seize-try.c
|
||||
- testsuites/validation/tr-mtx-seize-wait.c
|
||||
- testsuites/validation/tr-mtx-surrender.c
|
||||
|
||||
550
testsuites/validation/tc-event-performance.c
Normal file
550
testsuites/validation/tc-event-performance.c
Normal file
@@ -0,0 +1,550 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSTestCaseRtemsEventValPerf
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 RTEMSTestCaseRtemsEventValPerf spec:/rtems/event/val/perf
|
||||
*
|
||||
* @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
|
||||
*
|
||||
* @brief This test case provides a context to run @ref RTEMSAPIClassicEvent
|
||||
* performance tests.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Test context for spec:/rtems/event/val/perf test case.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @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;
|
||||
} RtemsEventValPerf_Context;
|
||||
|
||||
static RtemsEventValPerf_Context
|
||||
RtemsEventValPerf_Instance;
|
||||
|
||||
typedef RtemsEventValPerf_Context Context;
|
||||
|
||||
typedef enum {
|
||||
EVENT_END = RTEMS_EVENT_0,
|
||||
EVENT_OTHER = RTEMS_EVENT_1
|
||||
} Event;
|
||||
|
||||
static void Send( const Context *ctx, rtems_event_set events )
|
||||
{
|
||||
SendEvents( ctx->worker_id, events );
|
||||
}
|
||||
|
||||
static void Satisfy( void *arg )
|
||||
{
|
||||
Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
ctx->begin = T_tick();
|
||||
ctx->status = rtems_event_send( ctx->worker_id, EVENT_END | EVENT_OTHER );
|
||||
}
|
||||
|
||||
static void Worker( rtems_task_argument arg )
|
||||
{
|
||||
Context *ctx;
|
||||
|
||||
ctx = (Context *) arg;
|
||||
|
||||
while ( true ) {
|
||||
rtems_event_set events;
|
||||
rtems_status_code sc;
|
||||
T_ticks ticks;
|
||||
|
||||
sc = rtems_event_receive(
|
||||
EVENT_END | EVENT_OTHER,
|
||||
RTEMS_EVENT_ALL | RTEMS_WAIT,
|
||||
RTEMS_NO_TIMEOUT,
|
||||
&events
|
||||
);
|
||||
ticks = T_tick();
|
||||
T_quiet_rsc_success( sc );
|
||||
|
||||
if ( ( events & EVENT_END ) != 0 ) {
|
||||
ctx->end = ticks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void RtemsEventValPerf_Setup_Context( RtemsEventValPerf_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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a mutex and a worker task.
|
||||
*/
|
||||
static void RtemsEventValPerf_Setup( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
SetSelfPriority( PRIO_NORMAL );
|
||||
ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
|
||||
StartTask( ctx->worker_id, Worker, ctx );
|
||||
}
|
||||
|
||||
static void RtemsEventValPerf_Setup_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventValPerf_Setup_Context( ctx );
|
||||
RtemsEventValPerf_Setup( ctx );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete the worker task and the mutex.
|
||||
*/
|
||||
static void RtemsEventValPerf_Teardown( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
DeleteTask( ctx->worker_id );
|
||||
RestoreRunnerPriority();
|
||||
}
|
||||
|
||||
static void RtemsEventValPerf_Teardown_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventValPerf_Teardown( ctx );
|
||||
}
|
||||
|
||||
static T_fixture RtemsEventValPerf_Fixture = {
|
||||
.setup = RtemsEventValPerf_Setup_Wrap,
|
||||
.stop = NULL,
|
||||
.teardown = RtemsEventValPerf_Teardown_Wrap,
|
||||
.scope = NULL,
|
||||
.initial_context = &RtemsEventValPerf_Instance
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Send two events from with interrupt context. Satisfy the event
|
||||
* condition.
|
||||
*/
|
||||
static void RtemsEventReqPerfIsrPreempt_Body( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
CallWithinISR( Satisfy, ctx );
|
||||
}
|
||||
|
||||
static void RtemsEventReqPerfIsrPreempt_Body_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventReqPerfIsrPreempt_Body( ctx );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the measured runtime. Discard samples interrupted by a clock
|
||||
* tick.
|
||||
*/
|
||||
static bool RtemsEventReqPerfIsrPreempt_Teardown(
|
||||
RtemsEventValPerf_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 RtemsEventReqPerfIsrPreempt_Teardown_Wrap(
|
||||
void *arg,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
return RtemsEventReqPerfIsrPreempt_Teardown( ctx, delta, tic, toc, retry );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lower the worker priority.
|
||||
*/
|
||||
static void RtemsEventReqPerfOther_Setup( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
SetPriority( ctx->worker_id, PRIO_LOW );
|
||||
}
|
||||
|
||||
static void RtemsEventReqPerfOther_Setup_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventReqPerfOther_Setup( ctx );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send two events. Satisfy the event condition.
|
||||
*/
|
||||
static void RtemsEventReqPerfOther_Body( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
ctx->status = rtems_event_send( ctx->worker_id, EVENT_END | EVENT_OTHER );
|
||||
}
|
||||
|
||||
static void RtemsEventReqPerfOther_Body_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventReqPerfOther_Body( ctx );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Restore the worker priority. Discard samples interrupted by a clock
|
||||
* tick.
|
||||
*/
|
||||
static bool RtemsEventReqPerfOther_Teardown(
|
||||
RtemsEventValPerf_Context *ctx,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
T_quiet_rsc_success( ctx->status );
|
||||
|
||||
SetPriority( ctx->worker_id, PRIO_HIGH );
|
||||
|
||||
return tic == toc;
|
||||
}
|
||||
|
||||
static bool RtemsEventReqPerfOther_Teardown_Wrap(
|
||||
void *arg,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
return RtemsEventReqPerfOther_Teardown( ctx, delta, tic, toc, retry );
|
||||
}
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
/**
|
||||
* @brief Move worker to scheduler B.
|
||||
*/
|
||||
static void RtemsEventReqPerfOtherCpu_Prepare( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send two events. Satisfy the event condition.
|
||||
*/
|
||||
static void RtemsEventReqPerfOtherCpu_Body( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
ctx->begin = T_tick();
|
||||
ctx->status = rtems_event_send( ctx->worker_id, EVENT_END | EVENT_OTHER );
|
||||
}
|
||||
|
||||
static void RtemsEventReqPerfOtherCpu_Body_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventReqPerfOtherCpu_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 RtemsEventReqPerfOtherCpu_Teardown(
|
||||
RtemsEventValPerf_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 RtemsEventReqPerfOtherCpu_Teardown_Wrap(
|
||||
void *arg,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
return RtemsEventReqPerfOtherCpu_Teardown( ctx, delta, tic, toc, retry );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move worker to scheduler A.
|
||||
*/
|
||||
static void RtemsEventReqPerfOtherCpu_Cleanup( RtemsEventValPerf_Context *ctx )
|
||||
{
|
||||
SetScheduler( ctx->worker_id, SCHEDULER_A_ID, PRIO_HIGH );
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Send an event. Do not satisfy the event condition.
|
||||
*/
|
||||
static void RtemsEventReqPerfOtherNotSatisfied_Body(
|
||||
RtemsEventValPerf_Context *ctx
|
||||
)
|
||||
{
|
||||
ctx->status = rtems_event_send( ctx->worker_id, EVENT_OTHER );
|
||||
}
|
||||
|
||||
static void RtemsEventReqPerfOtherNotSatisfied_Body_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventReqPerfOtherNotSatisfied_Body( ctx );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Let the worker wait for the next set of events. Discard samples
|
||||
* interrupted by a clock tick.
|
||||
*/
|
||||
static bool RtemsEventReqPerfOtherNotSatisfied_Teardown(
|
||||
RtemsEventValPerf_Context *ctx,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
T_quiet_rsc_success( ctx->status );
|
||||
|
||||
Send( ctx, EVENT_END );
|
||||
|
||||
return tic == toc;
|
||||
}
|
||||
|
||||
static bool RtemsEventReqPerfOtherNotSatisfied_Teardown_Wrap(
|
||||
void *arg,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
return RtemsEventReqPerfOtherNotSatisfied_Teardown(
|
||||
ctx,
|
||||
delta,
|
||||
tic,
|
||||
toc,
|
||||
retry
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send two events. Satisfy the event condition.
|
||||
*/
|
||||
static void RtemsEventReqPerfOtherPreempt_Body(
|
||||
RtemsEventValPerf_Context *ctx
|
||||
)
|
||||
{
|
||||
ctx->begin = T_tick();
|
||||
ctx->status = rtems_event_send( ctx->worker_id, EVENT_END | EVENT_OTHER );
|
||||
}
|
||||
|
||||
static void RtemsEventReqPerfOtherPreempt_Body_Wrap( void *arg )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
RtemsEventReqPerfOtherPreempt_Body( ctx );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the measured runtime. Discard samples interrupted by a clock
|
||||
* tick.
|
||||
*/
|
||||
static bool RtemsEventReqPerfOtherPreempt_Teardown(
|
||||
RtemsEventValPerf_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 RtemsEventReqPerfOtherPreempt_Teardown_Wrap(
|
||||
void *arg,
|
||||
T_ticks *delta,
|
||||
uint32_t tic,
|
||||
uint32_t toc,
|
||||
unsigned int retry
|
||||
)
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = arg;
|
||||
return RtemsEventReqPerfOtherPreempt_Teardown( ctx, delta, tic, toc, retry );
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void T_case_body_RtemsEventValPerf( void )
|
||||
*/
|
||||
T_TEST_CASE_FIXTURE( RtemsEventValPerf, &RtemsEventValPerf_Fixture )
|
||||
{
|
||||
RtemsEventValPerf_Context *ctx;
|
||||
|
||||
ctx = T_fixture_context();
|
||||
|
||||
ctx->request.name = "RtemsEventReqPerfIsrPreempt";
|
||||
ctx->request.setup = NULL;
|
||||
ctx->request.body = RtemsEventReqPerfIsrPreempt_Body_Wrap;
|
||||
ctx->request.teardown = RtemsEventReqPerfIsrPreempt_Teardown_Wrap;
|
||||
T_measure_runtime( ctx->context, &ctx->request );
|
||||
|
||||
ctx->request.name = "RtemsEventReqPerfOther";
|
||||
ctx->request.setup = RtemsEventReqPerfOther_Setup_Wrap;
|
||||
ctx->request.body = RtemsEventReqPerfOther_Body_Wrap;
|
||||
ctx->request.teardown = RtemsEventReqPerfOther_Teardown_Wrap;
|
||||
T_measure_runtime( ctx->context, &ctx->request );
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
RtemsEventReqPerfOtherCpu_Prepare( ctx );
|
||||
ctx->request.name = "RtemsEventReqPerfOtherCpu";
|
||||
ctx->request.setup = NULL;
|
||||
ctx->request.body = RtemsEventReqPerfOtherCpu_Body_Wrap;
|
||||
ctx->request.teardown = RtemsEventReqPerfOtherCpu_Teardown_Wrap;
|
||||
T_measure_runtime( ctx->context, &ctx->request );
|
||||
RtemsEventReqPerfOtherCpu_Cleanup( ctx );
|
||||
#endif
|
||||
|
||||
ctx->request.name = "RtemsEventReqPerfOtherNotSatisfied";
|
||||
ctx->request.setup = NULL;
|
||||
ctx->request.body = RtemsEventReqPerfOtherNotSatisfied_Body_Wrap;
|
||||
ctx->request.teardown = RtemsEventReqPerfOtherNotSatisfied_Teardown_Wrap;
|
||||
T_measure_runtime( ctx->context, &ctx->request );
|
||||
|
||||
ctx->request.name = "RtemsEventReqPerfOtherPreempt";
|
||||
ctx->request.setup = NULL;
|
||||
ctx->request.body = RtemsEventReqPerfOtherPreempt_Body_Wrap;
|
||||
ctx->request.teardown = RtemsEventReqPerfOtherPreempt_Teardown_Wrap;
|
||||
T_measure_runtime( ctx->context, &ctx->request );
|
||||
}
|
||||
|
||||
/** @} */
|
||||
203
testsuites/validation/tc-event-send-receive.c
Normal file
203
testsuites/validation/tc-event-send-receive.c
Normal file
@@ -0,0 +1,203 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSTestCaseRtemsEventValSendReceive
|
||||
* @ingroup RTEMSTestCaseRtemsEventValSystemSendReceive
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 <rtems/rtems/eventimpl.h>
|
||||
#include <rtems/rtems/tasksdata.h>
|
||||
#include <rtems/score/statesimpl.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
|
||||
#include "tr-event-send-receive.h"
|
||||
|
||||
#include <rtems/test.h>
|
||||
|
||||
/**
|
||||
* @defgroup RTEMSTestCaseRtemsEventValSendReceive \
|
||||
* spec:/rtems/event/val/send-receive
|
||||
*
|
||||
* @ingroup RTEMSTestSuiteTestsuitesValidation0
|
||||
*
|
||||
* @brief Tests the rtems_event_send() and rtems_event_receive() directives.
|
||||
*
|
||||
* This test case performs the following actions:
|
||||
*
|
||||
* - Run the event send and receive tests for the application event set defined
|
||||
* by /rtems/event/req/send-receive.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
static rtems_status_code EventSend(
|
||||
rtems_id id,
|
||||
rtems_event_set event_in
|
||||
)
|
||||
{
|
||||
return rtems_event_send( id, event_in );
|
||||
}
|
||||
|
||||
static rtems_status_code EventReceive(
|
||||
rtems_id event_in,
|
||||
rtems_option option_set,
|
||||
rtems_interval ticks,
|
||||
rtems_event_set *event_out
|
||||
)
|
||||
{
|
||||
return rtems_event_receive( event_in, option_set, ticks, event_out );
|
||||
}
|
||||
|
||||
static rtems_event_set GetPendingEvents( Thread_Control *thread )
|
||||
{
|
||||
RTEMS_API_Control *api;
|
||||
|
||||
api = thread->API_Extensions[ THREAD_API_RTEMS ];
|
||||
return api->Event.pending_events;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Run the event send and receive tests for the application event set
|
||||
* defined by /rtems/event/req/send-receive.
|
||||
*/
|
||||
static void RtemsEventValSendReceive_Action_0( void )
|
||||
{
|
||||
RtemsEventReqSendReceive_Run(
|
||||
EventSend,
|
||||
EventReceive,
|
||||
GetPendingEvents,
|
||||
THREAD_WAIT_CLASS_EVENT,
|
||||
STATES_WAITING_FOR_EVENT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void T_case_body_RtemsEventValSendReceive( void )
|
||||
*/
|
||||
T_TEST_CASE( RtemsEventValSendReceive )
|
||||
{
|
||||
RtemsEventValSendReceive_Action_0();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup RTEMSTestCaseRtemsEventValSystemSendReceive \
|
||||
* spec:/rtems/event/val/system-send-receive
|
||||
*
|
||||
* @ingroup RTEMSTestSuiteTestsuitesValidation0
|
||||
*
|
||||
* @brief Tests the rtems_event_system_send() and rtems_event_system_receive()
|
||||
* directives.
|
||||
*
|
||||
* This test case performs the following actions:
|
||||
*
|
||||
* - Run the event send and receive tests for the system event set defined by
|
||||
* /rtems/event/req/send-receive.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
static rtems_status_code EventSystemSend(
|
||||
rtems_id id,
|
||||
rtems_event_set event_in
|
||||
)
|
||||
{
|
||||
return rtems_event_system_send( id, event_in );
|
||||
}
|
||||
|
||||
static rtems_status_code EventSystemReceive(
|
||||
rtems_id event_in,
|
||||
rtems_option option_set,
|
||||
rtems_interval ticks,
|
||||
rtems_event_set *event_out
|
||||
)
|
||||
{
|
||||
return rtems_event_system_receive(
|
||||
event_in,
|
||||
option_set,
|
||||
ticks,
|
||||
event_out
|
||||
);
|
||||
}
|
||||
|
||||
static rtems_event_set GetPendingSystemEvents( Thread_Control *thread )
|
||||
{
|
||||
RTEMS_API_Control *api;
|
||||
|
||||
api = thread->API_Extensions[ THREAD_API_RTEMS ];
|
||||
return api->System_event.pending_events;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Run the event send and receive tests for the system event set defined
|
||||
* by /rtems/event/req/send-receive.
|
||||
*/
|
||||
static void RtemsEventValSystemSendReceive_Action_0( void )
|
||||
{
|
||||
RtemsEventReqSendReceive_Run(
|
||||
EventSystemSend,
|
||||
EventSystemReceive,
|
||||
GetPendingSystemEvents,
|
||||
THREAD_WAIT_CLASS_SYSTEM_EVENT,
|
||||
STATES_WAITING_FOR_SYSTEM_EVENT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void T_case_body_RtemsEventValSystemSendReceive( void )
|
||||
*/
|
||||
T_TEST_CASE( RtemsEventValSystemSendReceive )
|
||||
{
|
||||
RtemsEventValSystemSendReceive_Action_0();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
197
testsuites/validation/tc-events.c
Normal file
197
testsuites/validation/tc-events.c
Normal file
@@ -0,0 +1,197 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSTestCaseRtemsEventValEvents
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 <rtems.h>
|
||||
|
||||
#include "tr-event-constant.h"
|
||||
|
||||
#include <rtems/test.h>
|
||||
|
||||
/**
|
||||
* @defgroup RTEMSTestCaseRtemsEventValEvents spec:/rtems/event/val/events
|
||||
*
|
||||
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
|
||||
*
|
||||
* @brief Tests the Event Manager API.
|
||||
*
|
||||
* This test case performs the following actions:
|
||||
*
|
||||
* - Run the event constant and number test for all 32 event constants.
|
||||
*
|
||||
* - Check that RTEMS_PENDING_EVENTS is a constant expression which evaluates
|
||||
* to a value of zero.
|
||||
*
|
||||
* - Calculate the value of a bitwise or of all 32 event constants.
|
||||
*
|
||||
* - Check that the value is equal to RTEMS_ALL_EVENTS.
|
||||
*
|
||||
* - Validate the Event Manager directive options.
|
||||
*
|
||||
* - Check that RTEMS_EVENT_ALL is equal to zero.
|
||||
*
|
||||
* - Check that RTEMS_EVENT_ANY is a power of two.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
static const rtems_event_set events[] = {
|
||||
RTEMS_EVENT_0,
|
||||
RTEMS_EVENT_1,
|
||||
RTEMS_EVENT_2,
|
||||
RTEMS_EVENT_3,
|
||||
RTEMS_EVENT_4,
|
||||
RTEMS_EVENT_5,
|
||||
RTEMS_EVENT_6,
|
||||
RTEMS_EVENT_7,
|
||||
RTEMS_EVENT_8,
|
||||
RTEMS_EVENT_9,
|
||||
RTEMS_EVENT_10,
|
||||
RTEMS_EVENT_11,
|
||||
RTEMS_EVENT_12,
|
||||
RTEMS_EVENT_13,
|
||||
RTEMS_EVENT_14,
|
||||
RTEMS_EVENT_15,
|
||||
RTEMS_EVENT_16,
|
||||
RTEMS_EVENT_17,
|
||||
RTEMS_EVENT_18,
|
||||
RTEMS_EVENT_19,
|
||||
RTEMS_EVENT_20,
|
||||
RTEMS_EVENT_21,
|
||||
RTEMS_EVENT_22,
|
||||
RTEMS_EVENT_23,
|
||||
RTEMS_EVENT_24,
|
||||
RTEMS_EVENT_25,
|
||||
RTEMS_EVENT_26,
|
||||
RTEMS_EVENT_27,
|
||||
RTEMS_EVENT_28,
|
||||
RTEMS_EVENT_29,
|
||||
RTEMS_EVENT_30,
|
||||
RTEMS_EVENT_31
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Run the event constant and number test for all 32 event constants.
|
||||
*/
|
||||
static void RtemsEventValEvents_Action_0( void )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for ( i = 0; i < 32; ++i ) {
|
||||
RtemsEventValEventConstant_Run( events[ i ], i );
|
||||
T_step( i ); /* Accounts for 32 test plan steps */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check that RTEMS_PENDING_EVENTS is a constant expression which
|
||||
* evaluates to a value of zero.
|
||||
*/
|
||||
static void RtemsEventValEvents_Action_1( void )
|
||||
{
|
||||
RTEMS_STATIC_ASSERT( RTEMS_PENDING_EVENTS == 0, PENDING_EVENTS );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Calculate the value of a bitwise or of all 32 event constants.
|
||||
*/
|
||||
static void RtemsEventValEvents_Action_2( void )
|
||||
{
|
||||
rtems_event_set all;
|
||||
int i;
|
||||
|
||||
all = 0;
|
||||
|
||||
for ( i = 0; i < 32; ++i ) {
|
||||
all |= events[ i ];
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the value is equal to RTEMS_ALL_EVENTS.
|
||||
*/
|
||||
T_step_eq_u32( 32, all, RTEMS_ALL_EVENTS );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Validate the Event Manager directive options.
|
||||
*/
|
||||
static void RtemsEventValEvents_Action_3( void )
|
||||
{
|
||||
/* No action */
|
||||
|
||||
/*
|
||||
* Check that RTEMS_EVENT_ALL is equal to zero.
|
||||
*/
|
||||
T_step_eq_u32( 33, RTEMS_EVENT_ALL, 0 );
|
||||
|
||||
/*
|
||||
* Check that RTEMS_EVENT_ANY is a power of two.
|
||||
*/
|
||||
T_step_ne_u32( 34, RTEMS_EVENT_ANY, 0 );
|
||||
T_step_eq_u32( 35, RTEMS_EVENT_ANY & ( RTEMS_EVENT_ANY - 1 ), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void T_case_body_RtemsEventValEvents( void )
|
||||
*/
|
||||
T_TEST_CASE( RtemsEventValEvents )
|
||||
{
|
||||
T_plan( 36 );
|
||||
|
||||
RtemsEventValEvents_Action_0();
|
||||
RtemsEventValEvents_Action_1();
|
||||
RtemsEventValEvents_Action_2();
|
||||
RtemsEventValEvents_Action_3();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
721
testsuites/validation/tr-event-constant.c
Normal file
721
testsuites/validation/tr-event-constant.c
Normal file
@@ -0,0 +1,721 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSTestCaseRtemsEventValEventConstant
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 <rtems.h>
|
||||
|
||||
#include "tr-event-constant.h"
|
||||
|
||||
#include <rtems/test.h>
|
||||
|
||||
/**
|
||||
* @defgroup RTEMSTestCaseRtemsEventValEventConstant \
|
||||
* spec:/rtems/event/val/event-constant
|
||||
*
|
||||
* @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
|
||||
*
|
||||
* @brief Tests an event constant and number of the Event Manager using the
|
||||
* Classic and system event sets of the executing task.
|
||||
*
|
||||
* This test case performs the following actions:
|
||||
*
|
||||
* - Validate the event constant.
|
||||
*
|
||||
* - Check that the event constant is equal to the event number bit in the
|
||||
* event set.
|
||||
*
|
||||
* - Check that the event number bit of the event constant is not set in
|
||||
* RTEMS_PENDING_EVENTS.
|
||||
*
|
||||
* - Get all pending events of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that there were no pending events.
|
||||
*
|
||||
* - Get all pending events of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that there were no pending events.
|
||||
*
|
||||
* - Receive all pending events of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was unsatisfied.
|
||||
*
|
||||
* - Check that there were no events received.
|
||||
*
|
||||
* - Receive all pending events of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was unsatisfied.
|
||||
*
|
||||
* - Check that there were no events received.
|
||||
*
|
||||
* - Send the event to the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Get all pending events of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that the pending event is equal to the event sent by a previous
|
||||
* action.
|
||||
*
|
||||
* - Get all pending events of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that there were no pending events.
|
||||
*
|
||||
* - Receive any event of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that the received event is equal to the event sent by a previous
|
||||
* action.
|
||||
*
|
||||
* - Receive any event of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was unsatisfied.
|
||||
*
|
||||
* - Check that the no events were received.
|
||||
*
|
||||
* - Send the event to the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Get all pending events of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that there were no pending events.
|
||||
*
|
||||
* - Get all pending events of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that the pending event is equal to the event sent by a previous
|
||||
* action.
|
||||
*
|
||||
* - Receive any event of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was unsatisfied.
|
||||
*
|
||||
* - Check that the no events were received.
|
||||
*
|
||||
* - Receive any event of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that the received event is equal to the event sent by a previous
|
||||
* action.
|
||||
*
|
||||
* - Get all pending events of the Classic event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that there were no pending events.
|
||||
*
|
||||
* - Get all pending events of the system event set of the executing task.
|
||||
*
|
||||
* - Check that the directive call was successful.
|
||||
*
|
||||
* - Check that there were no pending events.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Test context for spec:/rtems/event/val/event-constant test case.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief This member contains a copy of the corresponding
|
||||
* RtemsEventValEventConstant_Run() parameter.
|
||||
*/
|
||||
rtems_event_set event;
|
||||
|
||||
/**
|
||||
* @brief This member contains a copy of the corresponding
|
||||
* RtemsEventValEventConstant_Run() parameter.
|
||||
*/
|
||||
int number;
|
||||
} RtemsEventValEventConstant_Context;
|
||||
|
||||
static RtemsEventValEventConstant_Context
|
||||
RtemsEventValEventConstant_Instance;
|
||||
|
||||
static T_fixture RtemsEventValEventConstant_Fixture = {
|
||||
.setup = NULL,
|
||||
.stop = NULL,
|
||||
.teardown = NULL,
|
||||
.scope = NULL,
|
||||
.initial_context = &RtemsEventValEventConstant_Instance
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Validate the event constant.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_0(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
/* No action */
|
||||
|
||||
/*
|
||||
* Check that the event constant is equal to the event number bit in the
|
||||
* event set.
|
||||
*/
|
||||
T_step_eq_u32(
|
||||
0,
|
||||
ctx->event,
|
||||
( (rtems_event_set) 1 ) << ctx->number
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the event number bit of the event constant is not set in
|
||||
* RTEMS_PENDING_EVENTS.
|
||||
*/
|
||||
T_step_eq_u32( 1, ctx->event & RTEMS_PENDING_EVENTS, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the Classic event set of the executing
|
||||
* task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_1(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 2, sc );
|
||||
|
||||
/*
|
||||
* Check that there were no pending events.
|
||||
*/
|
||||
T_step_eq_u32( 3, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the system event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_2(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 4, sc );
|
||||
|
||||
/*
|
||||
* Check that there were no pending events.
|
||||
*/
|
||||
T_step_eq_u32( 5, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive all pending events of the Classic event set of the executing
|
||||
* task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_3(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_ALL_EVENTS,
|
||||
RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was unsatisfied.
|
||||
*/
|
||||
T_step_rsc( 6, sc, RTEMS_UNSATISFIED );
|
||||
|
||||
/*
|
||||
* Check that there were no events received.
|
||||
*/
|
||||
T_step_eq_u32( 7, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive all pending events of the system event set of the executing
|
||||
* task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_4(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_ALL_EVENTS,
|
||||
RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was unsatisfied.
|
||||
*/
|
||||
T_step_rsc( 8, sc, RTEMS_UNSATISFIED );
|
||||
|
||||
/*
|
||||
* Check that there were no events received.
|
||||
*/
|
||||
T_step_eq_u32( 9, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send the event to the Classic event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_5(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
|
||||
sc = rtems_event_send( RTEMS_SELF, ctx->event );
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 10, sc );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the Classic event set of the executing
|
||||
* task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_6(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 11, sc );
|
||||
|
||||
/*
|
||||
* Check that the pending event is equal to the event sent by a previous
|
||||
* action.
|
||||
*/
|
||||
T_step_eq_u32( 12, out, ctx->event );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the system event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_7(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 13, sc );
|
||||
|
||||
/*
|
||||
* Check that there were no pending events.
|
||||
*/
|
||||
T_step_eq_u32( 14, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive any event of the Classic event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_8(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = 0;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_ALL_EVENTS,
|
||||
RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 15, sc );
|
||||
|
||||
/*
|
||||
* Check that the received event is equal to the event sent by a previous
|
||||
* action.
|
||||
*/
|
||||
T_step_eq_u32( 16, out, ctx->event );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive any event of the system event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_9(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_ALL_EVENTS,
|
||||
RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was unsatisfied.
|
||||
*/
|
||||
T_step_rsc( 17, sc, RTEMS_UNSATISFIED );
|
||||
|
||||
/*
|
||||
* Check that the no events were received.
|
||||
*/
|
||||
T_step_eq_u32( 18, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send the event to the Classic event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_10(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
|
||||
sc = rtems_event_system_send( RTEMS_SELF, ctx->event );
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 19, sc );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the Classic event set of the executing
|
||||
* task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_11(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 20, sc );
|
||||
|
||||
/*
|
||||
* Check that there were no pending events.
|
||||
*/
|
||||
T_step_eq_u32( 21, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the system event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_12(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 22, sc );
|
||||
|
||||
/*
|
||||
* Check that the pending event is equal to the event sent by a previous
|
||||
* action.
|
||||
*/
|
||||
T_step_eq_u32( 23, out, ctx->event );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive any event of the Classic event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_13(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_ALL_EVENTS,
|
||||
RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was unsatisfied.
|
||||
*/
|
||||
T_step_rsc( 24, sc, RTEMS_UNSATISFIED );
|
||||
|
||||
/*
|
||||
* Check that the no events were received.
|
||||
*/
|
||||
T_step_eq_u32( 25, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive any event of the system event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_14(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = 0;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_ALL_EVENTS,
|
||||
RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 26, sc );
|
||||
|
||||
/*
|
||||
* Check that the received event is equal to the event sent by a previous
|
||||
* action.
|
||||
*/
|
||||
T_step_eq_u32( 27, out, ctx->event );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the Classic event set of the executing
|
||||
* task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_15(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 28, sc );
|
||||
|
||||
/*
|
||||
* Check that there were no pending events.
|
||||
*/
|
||||
T_step_eq_u32( 29, out, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get all pending events of the system event set of the executing task.
|
||||
*/
|
||||
static void RtemsEventValEventConstant_Action_16(
|
||||
RtemsEventValEventConstant_Context *ctx
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
out = RTEMS_ALL_EVENTS;
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
|
||||
/*
|
||||
* Check that the directive call was successful.
|
||||
*/
|
||||
T_step_rsc_success( 30, sc );
|
||||
|
||||
/*
|
||||
* Check that there were no pending events.
|
||||
*/
|
||||
T_step_eq_u32( 31, out, 0 );
|
||||
}
|
||||
|
||||
static T_fixture_node RtemsEventValEventConstant_Node;
|
||||
|
||||
void RtemsEventValEventConstant_Run( rtems_event_set event, int number )
|
||||
{
|
||||
RtemsEventValEventConstant_Context *ctx;
|
||||
|
||||
ctx = &RtemsEventValEventConstant_Instance;
|
||||
ctx->event = event;
|
||||
ctx->number = number;
|
||||
|
||||
ctx = T_push_fixture(
|
||||
&RtemsEventValEventConstant_Node,
|
||||
&RtemsEventValEventConstant_Fixture
|
||||
);
|
||||
|
||||
T_plan( 32 );
|
||||
|
||||
RtemsEventValEventConstant_Action_0( ctx );
|
||||
RtemsEventValEventConstant_Action_1( ctx );
|
||||
RtemsEventValEventConstant_Action_2( ctx );
|
||||
RtemsEventValEventConstant_Action_3( ctx );
|
||||
RtemsEventValEventConstant_Action_4( ctx );
|
||||
RtemsEventValEventConstant_Action_5( ctx );
|
||||
RtemsEventValEventConstant_Action_6( ctx );
|
||||
RtemsEventValEventConstant_Action_7( ctx );
|
||||
RtemsEventValEventConstant_Action_8( ctx );
|
||||
RtemsEventValEventConstant_Action_9( ctx );
|
||||
RtemsEventValEventConstant_Action_10( ctx );
|
||||
RtemsEventValEventConstant_Action_11( ctx );
|
||||
RtemsEventValEventConstant_Action_12( ctx );
|
||||
RtemsEventValEventConstant_Action_13( ctx );
|
||||
RtemsEventValEventConstant_Action_14( ctx );
|
||||
RtemsEventValEventConstant_Action_15( ctx );
|
||||
RtemsEventValEventConstant_Action_16( ctx );
|
||||
|
||||
T_pop_fixture();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
81
testsuites/validation/tr-event-constant.h
Normal file
81
testsuites/validation/tr-event-constant.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSTestCaseRtemsEventValEventConstant
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _TR_EVENT_CONSTANT_H
|
||||
#define _TR_EVENT_CONSTANT_H
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup RTEMSTestCaseRtemsEventValEventConstant
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Runs the parameterized test case.
|
||||
*
|
||||
* @param event is the event constant.
|
||||
*
|
||||
* @param number is the event number.
|
||||
*/
|
||||
void RtemsEventValEventConstant_Run( rtems_event_set event, int number );
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TR_EVENT_CONSTANT_H */
|
||||
1316
testsuites/validation/tr-event-send-receive.c
Normal file
1316
testsuites/validation/tr-event-send-receive.c
Normal file
File diff suppressed because it is too large
Load Diff
152
testsuites/validation/tr-event-send-receive.h
Normal file
152
testsuites/validation/tr-event-send-receive.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSTestCaseRtemsEventReqSendReceive
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _TR_EVENT_SEND_RECEIVE_H
|
||||
#define _TR_EVENT_SEND_RECEIVE_H
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup RTEMSTestCaseRtemsEventReqSendReceive
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Pre_Id_InvId,
|
||||
RtemsEventReqSendReceive_Pre_Id_Task,
|
||||
RtemsEventReqSendReceive_Pre_Id_NA
|
||||
} RtemsEventReqSendReceive_Pre_Id;
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Pre_Send_Zero,
|
||||
RtemsEventReqSendReceive_Pre_Send_Unrelated,
|
||||
RtemsEventReqSendReceive_Pre_Send_Any,
|
||||
RtemsEventReqSendReceive_Pre_Send_All,
|
||||
RtemsEventReqSendReceive_Pre_Send_MixedAny,
|
||||
RtemsEventReqSendReceive_Pre_Send_MixedAll,
|
||||
RtemsEventReqSendReceive_Pre_Send_NA
|
||||
} RtemsEventReqSendReceive_Pre_Send;
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_InvAddr,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_NotWaiting,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Poll,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Timeout,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Lower,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Equal,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Higher,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Other,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_Intend,
|
||||
RtemsEventReqSendReceive_Pre_ReceiverState_NA
|
||||
} RtemsEventReqSendReceive_Pre_ReceiverState;
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Pre_Satisfy_All,
|
||||
RtemsEventReqSendReceive_Pre_Satisfy_Any,
|
||||
RtemsEventReqSendReceive_Pre_Satisfy_NA
|
||||
} RtemsEventReqSendReceive_Pre_Satisfy;
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Post_SendStatus_Ok,
|
||||
RtemsEventReqSendReceive_Post_SendStatus_InvId,
|
||||
RtemsEventReqSendReceive_Post_SendStatus_NA
|
||||
} RtemsEventReqSendReceive_Post_SendStatus;
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_None,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_Pending,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_Timeout,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_Satisfied,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_Unsatisfied,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_Blocked,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_InvAddr,
|
||||
RtemsEventReqSendReceive_Post_ReceiveStatus_NA
|
||||
} RtemsEventReqSendReceive_Post_ReceiveStatus;
|
||||
|
||||
typedef enum {
|
||||
RtemsEventReqSendReceive_Post_SenderPreemption_No,
|
||||
RtemsEventReqSendReceive_Post_SenderPreemption_Yes,
|
||||
RtemsEventReqSendReceive_Post_SenderPreemption_NA
|
||||
} RtemsEventReqSendReceive_Post_SenderPreemption;
|
||||
|
||||
/**
|
||||
* @brief Runs the parameterized test case.
|
||||
*
|
||||
* @param send is the event send handler.
|
||||
*
|
||||
* @param receive is the event receive handler.
|
||||
*
|
||||
* @param get_pending_events is the get pending events handler.
|
||||
*
|
||||
* @param wait_class is the thread wait class.
|
||||
*
|
||||
* @param waiting_for_event is the thread waiting for event state.
|
||||
*/
|
||||
void RtemsEventReqSendReceive_Run(
|
||||
rtems_status_code ( *send )( rtems_id, rtems_event_set ),
|
||||
rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
|
||||
rtems_event_set ( *get_pending_events )( Thread_Control * ),
|
||||
unsigned int wait_class,
|
||||
int waiting_for_event
|
||||
);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TR_EVENT_SEND_RECEIVE_H */
|
||||
Reference in New Issue
Block a user