summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-17 18:35:11 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-29 16:54:21 +0200
commit357208f072b018231cbaeaac16b8be393d78ce1a (patch)
tree7aae90e0f31c988ebff29967a1571805c4f51b5c
parent4e3c5b6d973d93733d699df029328ae4bda78221 (diff)
validation: Semaphore timeout
-rw-r--r--spec/build/testsuites/validation/validation-no-clock-0.yml1
-rw-r--r--testsuites/validation/tc-sem-timeout.c22
-rw-r--r--testsuites/validation/tr-tq-timeout-priority-inherit.c774
-rw-r--r--testsuites/validation/tr-tq-timeout-priority-inherit.h110
-rw-r--r--testsuites/validation/tr-tq-timeout.c207
-rw-r--r--testsuites/validation/tr-tq-timeout.h6
6 files changed, 949 insertions, 171 deletions
diff --git a/spec/build/testsuites/validation/validation-no-clock-0.yml b/spec/build/testsuites/validation/validation-no-clock-0.yml
index d89380a973..1f31748fca 100644
--- a/spec/build/testsuites/validation/validation-no-clock-0.yml
+++ b/spec/build/testsuites/validation/validation-no-clock-0.yml
@@ -38,6 +38,7 @@ source:
- testsuites/validation/tr-tq-enqueue-fifo.c
- testsuites/validation/tr-tq-enqueue-priority.c
- testsuites/validation/tr-tq-timeout.c
+- testsuites/validation/tr-tq-timeout-priority-inherit.c
- testsuites/validation/ts-validation-no-clock-0.c
stlib: []
target: testsuites/validation/ts-validation-no-clock-0.exe
diff --git a/testsuites/validation/tc-sem-timeout.c b/testsuites/validation/tc-sem-timeout.c
index a48e9b1f96..3859ffa658 100644
--- a/testsuites/validation/tc-sem-timeout.c
+++ b/testsuites/validation/tc-sem-timeout.c
@@ -55,6 +55,7 @@
#include <rtems.h>
#include <string.h>
+#include "tr-tq-timeout-priority-inherit.h"
#include "tr-tq-timeout.h"
#include "tx-support.h"
#include "tx-thread-queue.h"
@@ -87,6 +88,7 @@ typedef enum {
typedef enum {
RtemsSemReqTimeout_Post_Action_Timeout,
+ RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit,
RtemsSemReqTimeout_Post_Action_NA
} RtemsSemReqTimeout_Post_Action;
@@ -94,7 +96,7 @@ typedef struct {
uint8_t Skip : 1;
uint8_t Pre_Class_NA : 1;
uint8_t Pre_Discipline_NA : 1;
- uint8_t Post_Action : 1;
+ uint8_t Post_Action : 2;
} RtemsSemReqTimeout_Entry;
/**
@@ -275,6 +277,15 @@ static void RtemsSemReqTimeout_Post_Action_Check(
break;
}
+ case RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit: {
+ /*
+ * The semaphore obtain timeout actions shall be done as specified by
+ * /score/tq/req/timeout-priority-inherit.
+ */
+ ScoreTqReqTimeoutPriorityInherit_Run( &ctx->tq_ctx );
+ break;
+ }
+
case RtemsSemReqTimeout_Post_Action_NA:
break;
}
@@ -345,16 +356,17 @@ static const RtemsSemReqTimeout_Entry
RtemsSemReqTimeout_Entries[] = {
{ 0, 0, 0, RtemsSemReqTimeout_Post_Action_Timeout },
{ 1, 0, 0, RtemsSemReqTimeout_Post_Action_NA },
-#if defined(RTEMS_SMP)
- { 0, 0, 0, RtemsSemReqTimeout_Post_Action_Timeout }
-#else
+ { 0, 0, 0, RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit },
+#if !defined(RTEMS_SMP)
{ 1, 0, 0, RtemsSemReqTimeout_Post_Action_NA }
+#else
+ { 0, 0, 0, RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit }
#endif
};
static const uint8_t
RtemsSemReqTimeout_Map[] = {
- 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 2
+ 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 1, 3
};
static size_t RtemsSemReqTimeout_Scope( void *arg, char *buf, size_t n )
diff --git a/testsuites/validation/tr-tq-timeout-priority-inherit.c b/testsuites/validation/tr-tq-timeout-priority-inherit.c
new file mode 100644
index 0000000000..bfc4a90965
--- /dev/null
+++ b/testsuites/validation/tr-tq-timeout-priority-inherit.c
@@ -0,0 +1,774 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseScoreTqReqTimeoutPriorityInherit
+ */
+
+/*
+ * 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/score/smpimpl.h>
+#include <rtems/score/threadimpl.h>
+
+#include "tr-tq-timeout-priority-inherit.h"
+#include "tx-support.h"
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestCaseScoreTqReqTimeoutPriorityInherit \
+ * spec:/score/tq/req/timeout-priority-inherit
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ *
+ * @{
+ */
+
+typedef struct {
+ uint8_t Skip : 1;
+ uint8_t Pre_EnqueueVariant_NA : 1;
+ uint8_t Pre_Scheduler_NA : 1;
+ uint8_t Pre_WaitState_NA : 1;
+ uint8_t Post_Status : 2;
+ uint8_t Post_Unblock : 2;
+} ScoreTqReqTimeoutPriorityInherit_Entry;
+
+/**
+ * @brief Test context for spec:/score/tq/req/timeout-priority-inherit test
+ * case.
+ */
+typedef struct {
+ /**
+ * @brief This member contains the call within ISR request.
+ */
+ CallWithinISRRequest request;;
+
+ /**
+ * @brief If this member is true, then the enqueued thread shall use a home
+ * scheduler other than the home scheduler of the owner.
+ */
+ bool other_scheduler;
+
+ /**
+ * @brief If this member is true, then the processor set of the schedulers
+ * shall be restored.
+ */
+ bool restore_scheduler;
+
+ /**
+ * @brief This member contains a copy of the corresponding
+ * ScoreTqReqTimeoutPriorityInherit_Run() parameter.
+ */
+ TQContext *tq_ctx;
+
+ struct {
+ /**
+ * @brief This member defines the pre-condition states for the next action.
+ */
+ size_t pcs[ 3 ];
+
+ /**
+ * @brief If this member is true, then the test action loop is executed.
+ */
+ bool in_action_loop;
+
+ /**
+ * @brief This member contains the next transition map index.
+ */
+ size_t index;
+
+ /**
+ * @brief This member contains the current transition map entry.
+ */
+ ScoreTqReqTimeoutPriorityInherit_Entry entry;
+
+ /**
+ * @brief If this member is true, then the current transition variant
+ * should be skipped.
+ */
+ bool skip;
+ } Map;
+} ScoreTqReqTimeoutPriorityInherit_Context;
+
+static ScoreTqReqTimeoutPriorityInherit_Context
+ ScoreTqReqTimeoutPriorityInherit_Instance;
+
+static const char * const ScoreTqReqTimeoutPriorityInherit_PreDesc_EnqueueVariant[] = {
+ "Blocking",
+ "Sticky",
+ "NA"
+};
+
+static const char * const ScoreTqReqTimeoutPriorityInherit_PreDesc_Scheduler[] = {
+ "Same",
+ "Other",
+ "NA"
+};
+
+static const char * const ScoreTqReqTimeoutPriorityInherit_PreDesc_WaitState[] = {
+ "Blocked",
+ "IntendToBlock",
+ "ReadyAgain",
+ "NA"
+};
+
+static const char * const * const ScoreTqReqTimeoutPriorityInherit_PreDesc[] = {
+ ScoreTqReqTimeoutPriorityInherit_PreDesc_EnqueueVariant,
+ ScoreTqReqTimeoutPriorityInherit_PreDesc_Scheduler,
+ ScoreTqReqTimeoutPriorityInherit_PreDesc_WaitState,
+ NULL
+};
+
+typedef ScoreTqReqTimeoutPriorityInherit_Context Context;
+
+static const rtems_tcb *GetUnblock( Context *ctx, size_t *index )
+{
+ return TQGetNextUnblock( ctx->tq_ctx, index )->thread;
+}
+
+static const rtems_tcb *GetTCB( Context *ctx, TQWorkerKind worker )
+{
+ return ctx->tq_ctx->worker_tcb[ worker ];
+}
+
+static void Tick( void *arg )
+{
+ Context *ctx;
+
+ ctx = arg;
+ TQSchedulerRecordStart( ctx->tq_ctx );
+ FinalClockTick();
+ TQSchedulerRecordStop( ctx->tq_ctx );
+}
+
+static void SchedulerBlock(
+ void *arg,
+ const T_scheduler_event *event,
+ T_scheduler_when when
+)
+{
+ Context *ctx;
+
+ ctx = arg;
+
+ if (
+ when == T_SCHEDULER_BEFORE &&
+ event->operation == T_SCHEDULER_BLOCK
+ ) {
+ T_scheduler_set_event_handler( NULL, NULL );
+ ctx->request.handler = Tick;
+ CallWithinISRSubmit( &ctx->request );
+ }
+}
+
+static void ThreadTimeout( void *arg )
+{
+ Context *ctx;
+
+ ctx = arg;
+ TQSchedulerRecordStart( ctx->tq_ctx );
+ _Thread_Timeout(
+ &ctx->tq_ctx->worker_tcb[ TQ_BLOCKER_A ]->Timer.Watchdog
+ );
+ TQSchedulerRecordStop( ctx->tq_ctx );
+}
+
+static void SchedulerUnblock(
+ void *arg,
+ const T_scheduler_event *event,
+ T_scheduler_when when
+)
+{
+ Context *ctx;
+
+ ctx = arg;
+
+ if (
+ when == T_SCHEDULER_BEFORE &&
+ event->operation == T_SCHEDULER_UNBLOCK
+ ) {
+ T_scheduler_set_event_handler( NULL, NULL );
+
+ if ( ctx->other_scheduler ) {
+#if defined(RTEMS_SMP)
+ _SMP_Unicast_action( 1, ThreadTimeout, ctx );
+#else
+ T_unreachable();
+#endif
+ } else {
+ ctx->request.handler = ThreadTimeout;
+ CallWithinISRSubmit( &ctx->request );
+ }
+ }
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Prepare(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx,
+ ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant state
+)
+{
+ switch ( state ) {
+ case ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Blocking: {
+ /*
+ * Where the thread queue enqueue operation is blocking.
+ */
+ if ( ctx->tq_ctx->enqueue_variant != TQ_ENQUEUE_BLOCKS ) {
+ ctx->Map.skip = true;
+ }
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Sticky: {
+ /*
+ * Where the thread queue enqueue operation is sticky.
+ */
+ if ( ctx->tq_ctx->enqueue_variant != TQ_ENQUEUE_STICKY ) {
+ ctx->Map.skip = true;
+ }
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_NA:
+ break;
+ }
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Prepare(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx,
+ ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler state
+)
+{
+ switch ( state ) {
+ case ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Same: {
+ /*
+ * While the home scheduler of the thread is equal to the home scheduler
+ * of the thread queue owner.
+ */
+ ctx->other_scheduler = false;
+
+ if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
+ TQSetScheduler(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ SCHEDULER_A_ID,
+ PRIO_LOW
+ );
+ RemoveProcessor( SCHEDULER_B_ID, 1 );
+ AddProcessor( SCHEDULER_A_ID, 1 );
+ ctx->restore_scheduler = true;
+ } else {
+ TQSetScheduler(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ SCHEDULER_A_ID,
+ PRIO_ULTRA_HIGH
+ );
+ }
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Other: {
+ /*
+ * While the home scheduler of the thread is not equal to the home
+ * scheduler of the thread queue owner.
+ */
+ ctx->other_scheduler = true;
+
+ TQSetScheduler(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ SCHEDULER_B_ID,
+ PRIO_NORMAL
+ );
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_NA:
+ break;
+ }
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_Prepare(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx,
+ ScoreTqReqTimeoutPriorityInherit_Pre_WaitState state
+)
+{
+ switch ( state ) {
+ case ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_Blocked: {
+ /*
+ * While the thread of the timeout operation is in the blocked wait
+ * state.
+ */
+ if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
+ T_unreachable();
+ } else {
+ TQEnqueuePrepare( ctx->tq_ctx );
+ TQClearDone( ctx->tq_ctx, TQ_BLOCKER_A );
+ TQSendAndWaitForExecutionStop(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ TQ_EVENT_ENQUEUE
+ );
+ Tick( ctx );
+ TQWaitForDone( ctx->tq_ctx, TQ_BLOCKER_A );
+ TQEnqueueDone( ctx->tq_ctx );
+ }
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_IntendToBlock: {
+ /*
+ * While the thread of the timeout operation is in the intend to block
+ * wait state.
+ */
+ TQEnqueuePrepare( ctx->tq_ctx );
+
+ if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
+ Per_CPU_Control *cpu;
+
+ TQSendAndWaitForIntendToBlock(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ TQ_EVENT_ENQUEUE
+ );
+ cpu = _Thread_Get_CPU( ctx->tq_ctx->worker_tcb[ TQ_BLOCKER_A ] );
+
+ /*
+ * We have to make sure that the worker thread inserted its thread
+ * timer. Checking the intend to block wait state is not enough to
+ * ensure this.
+ */
+ while ( cpu->thread_dispatch_disable_level != 0 ) {
+ /* Wait */
+ }
+
+ Tick( ctx );
+ WaitForExecutionStop( ctx->tq_ctx->worker_id[ TQ_BLOCKER_A ] );
+ } else {
+ T_scheduler_set_event_handler( SchedulerBlock, ctx );
+ TQSendAndWaitForExecutionStop(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ TQ_EVENT_ENQUEUE
+ );
+ }
+
+ TQEnqueueDone( ctx->tq_ctx );
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_ReadyAgain: {
+ /*
+ * While the thread of the timeout operation is in the ready again wait
+ * state.
+ */
+ TQEnqueuePrepare( ctx->tq_ctx );
+
+ if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
+ TQSendAndWaitForIntendToBlock(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ TQ_EVENT_ENQUEUE | TQ_EVENT_TIMEOUT | TQ_EVENT_SURRENDER |
+ TQ_EVENT_SCHEDULER_RECORD_STOP
+ );
+ TQSchedulerRecordStart( ctx->tq_ctx );
+ TQEnqueueDone( ctx->tq_ctx );
+ WaitForExecutionStop( ctx->tq_ctx->worker_id[ TQ_BLOCKER_A ] );
+ } else {
+ TQSendAndWaitForExecutionStop(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ TQ_EVENT_ENQUEUE
+ );
+ T_scheduler_set_event_handler( SchedulerUnblock, ctx );
+ TQEnqueueDone( ctx->tq_ctx );
+ TQSendAndWaitForExecutionStop(
+ ctx->tq_ctx,
+ TQ_BLOCKER_A,
+ TQ_EVENT_SURRENDER
+ );
+ }
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_NA:
+ break;
+ }
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Post_Status_Check(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx,
+ ScoreTqReqTimeoutPriorityInherit_Post_Status state
+)
+{
+ switch ( state ) {
+ case ScoreTqReqTimeoutPriorityInherit_Post_Status_Ok: {
+ /*
+ * The return status of the directive call shall be derived from
+ * STATUS_SUCCESSFUL.
+ */
+ T_eq_int(
+ ctx->tq_ctx->status[ TQ_BLOCKER_A ],
+ TQConvertStatus( ctx->tq_ctx, STATUS_SUCCESSFUL )
+ );
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Post_Status_Timeout: {
+ /*
+ * The return status of the directive call shall be derived from
+ * STATUS_TIMEOUT.
+ */
+ T_eq_int(
+ ctx->tq_ctx->status[ TQ_BLOCKER_A ],
+ TQConvertStatus( ctx->tq_ctx, STATUS_TIMEOUT )
+ );
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Post_Status_NA:
+ break;
+ }
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Post_Unblock_Check(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock state
+)
+{
+ size_t i;
+
+ i = 0;
+
+ switch ( state ) {
+ case ScoreTqReqTimeoutPriorityInherit_Post_Unblock_Yes: {
+ /*
+ * The thread of the timeout operation shall be unblocked by the timeout
+ * operation.
+ */
+ T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) );
+ T_eq_ptr( GetUnblock( ctx, &i ), NULL );
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Post_Unblock_No: {
+ /*
+ * The thread of the timeout operation shall not be unblocked by the
+ * timeout operation.
+ */
+ T_eq_ptr( GetUnblock( ctx, &i ), NULL );
+ break;
+ }
+
+ case ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA:
+ break;
+ }
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Setup(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ ctx->request.arg = ctx;
+ TQReset( ctx->tq_ctx );
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Setup_Wrap( void *arg )
+{
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ ScoreTqReqTimeoutPriorityInherit_Setup( ctx );
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Teardown(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ TQReset( ctx->tq_ctx );
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Teardown_Wrap( void *arg )
+{
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx;
+
+ ctx = arg;
+ ctx->Map.in_action_loop = false;
+ ScoreTqReqTimeoutPriorityInherit_Teardown( ctx );
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Prepare(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ ctx->restore_scheduler = false;
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Action(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ /*
+ * The action is performed by the ``WaitState`` pre-condition preparation.
+ */
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_Cleanup(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ if ( ctx->restore_scheduler ) {
+ RemoveProcessor( SCHEDULER_A_ID, 1 );
+ AddProcessor( SCHEDULER_B_ID, 1 );
+ }
+}
+
+static const ScoreTqReqTimeoutPriorityInherit_Entry
+ScoreTqReqTimeoutPriorityInherit_Entries[] = {
+ { 0, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_Timeout,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_No },
+ { 0, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_Ok,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_No },
+#if !defined(RTEMS_SMP)
+ { 1, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_NA,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA },
+#else
+ { 0, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_Timeout,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_No },
+#endif
+#if !defined(RTEMS_SMP)
+ { 1, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_NA,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA },
+#else
+ { 0, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_Ok,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_No },
+#endif
+ { 0, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_Timeout,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_Yes },
+#if !defined(RTEMS_SMP)
+ { 1, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_NA,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA },
+#else
+ { 0, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_Timeout,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_Yes },
+#endif
+ { 1, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_NA,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA },
+#if !defined(RTEMS_SMP)
+ { 1, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_NA,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA }
+#else
+ { 1, 0, 0, 0, ScoreTqReqTimeoutPriorityInherit_Post_Status_NA,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA }
+#endif
+};
+
+static const uint8_t
+ScoreTqReqTimeoutPriorityInherit_Map[] = {
+ 4, 0, 1, 5, 2, 3, 6, 0, 1, 7, 2, 3
+};
+
+static size_t ScoreTqReqTimeoutPriorityInherit_Scope(
+ void *arg,
+ char *buf,
+ size_t n
+)
+{
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->Map.in_action_loop ) {
+ return T_get_scope(
+ ScoreTqReqTimeoutPriorityInherit_PreDesc,
+ buf,
+ n,
+ ctx->Map.pcs
+ );
+ }
+
+ return 0;
+}
+
+static T_fixture ScoreTqReqTimeoutPriorityInherit_Fixture = {
+ .setup = ScoreTqReqTimeoutPriorityInherit_Setup_Wrap,
+ .stop = NULL,
+ .teardown = ScoreTqReqTimeoutPriorityInherit_Teardown_Wrap,
+ .scope = ScoreTqReqTimeoutPriorityInherit_Scope,
+ .initial_context = &ScoreTqReqTimeoutPriorityInherit_Instance
+};
+
+static const uint8_t ScoreTqReqTimeoutPriorityInherit_Weights[] = {
+ 6, 3, 1
+};
+
+static void ScoreTqReqTimeoutPriorityInherit_Skip(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx,
+ size_t index
+)
+{
+ switch ( index + 1 ) {
+ case 1:
+ ctx->Map.pcs[ 1 ] = ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_NA - 1;
+ /* Fall through */
+ case 2:
+ ctx->Map.pcs[ 2 ] = ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_NA - 1;
+ break;
+ }
+}
+
+static inline ScoreTqReqTimeoutPriorityInherit_Entry
+ScoreTqReqTimeoutPriorityInherit_PopEntry(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ size_t index;
+
+ if ( ctx->Map.skip ) {
+ size_t i;
+
+ ctx->Map.skip = false;
+ index = 0;
+
+ for ( i = 0; i < 3; ++i ) {
+ index += ScoreTqReqTimeoutPriorityInherit_Weights[ i ] * ctx->Map.pcs[ i ];
+ }
+ } else {
+ index = ctx->Map.index;
+ }
+
+ ctx->Map.index = index + 1;
+
+ return ScoreTqReqTimeoutPriorityInherit_Entries[
+ ScoreTqReqTimeoutPriorityInherit_Map[ index ]
+ ];
+}
+
+static void ScoreTqReqTimeoutPriorityInherit_TestVariant(
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx
+)
+{
+ ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Prepare(
+ ctx,
+ ctx->Map.pcs[ 0 ]
+ );
+
+ if ( ctx->Map.skip ) {
+ ScoreTqReqTimeoutPriorityInherit_Skip( ctx, 0 );
+ return;
+ }
+
+ ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Prepare(
+ ctx,
+ ctx->Map.pcs[ 1 ]
+ );
+ ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_Prepare(
+ ctx,
+ ctx->Map.pcs[ 2 ]
+ );
+ ScoreTqReqTimeoutPriorityInherit_Action( ctx );
+ ScoreTqReqTimeoutPriorityInherit_Post_Status_Check(
+ ctx,
+ ctx->Map.entry.Post_Status
+ );
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_Check(
+ ctx,
+ ctx->Map.entry.Post_Unblock
+ );
+}
+
+static T_fixture_node ScoreTqReqTimeoutPriorityInherit_Node;
+
+void ScoreTqReqTimeoutPriorityInherit_Run( TQContext *tq_ctx )
+{
+ ScoreTqReqTimeoutPriorityInherit_Context *ctx;
+
+ ctx = &ScoreTqReqTimeoutPriorityInherit_Instance;
+ ctx->tq_ctx = tq_ctx;
+
+ ctx = T_push_fixture(
+ &ScoreTqReqTimeoutPriorityInherit_Node,
+ &ScoreTqReqTimeoutPriorityInherit_Fixture
+ );
+ ctx->Map.in_action_loop = true;
+ ctx->Map.index = 0;
+ ctx->Map.skip = false;
+
+ for (
+ ctx->Map.pcs[ 0 ] = ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Blocking;
+ ctx->Map.pcs[ 0 ] < ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_NA;
+ ++ctx->Map.pcs[ 0 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 1 ] = ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Same;
+ ctx->Map.pcs[ 1 ] < ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_NA;
+ ++ctx->Map.pcs[ 1 ]
+ ) {
+ for (
+ ctx->Map.pcs[ 2 ] = ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_Blocked;
+ ctx->Map.pcs[ 2 ] < ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_NA;
+ ++ctx->Map.pcs[ 2 ]
+ ) {
+ ctx->Map.entry = ScoreTqReqTimeoutPriorityInherit_PopEntry( ctx );
+
+ if ( ctx->Map.entry.Skip ) {
+ continue;
+ }
+
+ ScoreTqReqTimeoutPriorityInherit_Prepare( ctx );
+ ScoreTqReqTimeoutPriorityInherit_TestVariant( ctx );
+ ScoreTqReqTimeoutPriorityInherit_Cleanup( ctx );
+ }
+ }
+ }
+
+ T_pop_fixture();
+}
+
+/** @} */
diff --git a/testsuites/validation/tr-tq-timeout-priority-inherit.h b/testsuites/validation/tr-tq-timeout-priority-inherit.h
new file mode 100644
index 0000000000..5e98c92cde
--- /dev/null
+++ b/testsuites/validation/tr-tq-timeout-priority-inherit.h
@@ -0,0 +1,110 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestCaseScoreTqReqTimeoutPriorityInherit
+ */
+
+/*
+ * 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
+ */
+
+#ifndef _TR_TQ_TIMEOUT_PRIORITY_INHERIT_H
+#define _TR_TQ_TIMEOUT_PRIORITY_INHERIT_H
+
+#include "tx-thread-queue.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup RTEMSTestCaseScoreTqReqTimeoutPriorityInherit
+ *
+ * @{
+ */
+
+typedef enum {
+ ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Blocking,
+ ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_Sticky,
+ ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant_NA
+} ScoreTqReqTimeoutPriorityInherit_Pre_EnqueueVariant;
+
+typedef enum {
+ ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Same,
+ ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_Other,
+ ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler_NA
+} ScoreTqReqTimeoutPriorityInherit_Pre_Scheduler;
+
+typedef enum {
+ ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_Blocked,
+ ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_IntendToBlock,
+ ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_ReadyAgain,
+ ScoreTqReqTimeoutPriorityInherit_Pre_WaitState_NA
+} ScoreTqReqTimeoutPriorityInherit_Pre_WaitState;
+
+typedef enum {
+ ScoreTqReqTimeoutPriorityInherit_Post_Status_Ok,
+ ScoreTqReqTimeoutPriorityInherit_Post_Status_Timeout,
+ ScoreTqReqTimeoutPriorityInherit_Post_Status_NA
+} ScoreTqReqTimeoutPriorityInherit_Post_Status;
+
+typedef enum {
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_Yes,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_No,
+ ScoreTqReqTimeoutPriorityInherit_Post_Unblock_NA
+} ScoreTqReqTimeoutPriorityInherit_Post_Unblock;
+
+/**
+ * @brief Runs the parameterized test case.
+ *
+ * @param[in,out] tq_ctx is the thread queue test context.
+ */
+void ScoreTqReqTimeoutPriorityInherit_Run( TQContext *tq_ctx );
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TR_TQ_TIMEOUT_PRIORITY_INHERIT_H */
diff --git a/testsuites/validation/tr-tq-timeout.c b/testsuites/validation/tr-tq-timeout.c
index f66f01581e..5575abdd57 100644
--- a/testsuites/validation/tr-tq-timeout.c
+++ b/testsuites/validation/tr-tq-timeout.c
@@ -69,7 +69,6 @@
typedef struct {
uint8_t Skip : 1;
- uint8_t Pre_EnqueueVariant_NA : 1;
uint8_t Pre_WaitState_NA : 1;
uint8_t Post_Status : 2;
uint8_t Post_Unblock : 2;
@@ -94,7 +93,7 @@ typedef struct {
/**
* @brief This member defines the pre-condition states for the next action.
*/
- size_t pcs[ 2 ];
+ size_t pcs[ 1 ];
/**
* @brief If this member is true, then the test action loop is executed.
@@ -122,12 +121,6 @@ typedef struct {
static ScoreTqReqTimeout_Context
ScoreTqReqTimeout_Instance;
-static const char * const ScoreTqReqTimeout_PreDesc_EnqueueVariant[] = {
- "Blocking",
- "Sticky",
- "NA"
-};
-
static const char * const ScoreTqReqTimeout_PreDesc_WaitState[] = {
"Blocked",
"IntendToBlock",
@@ -136,7 +129,6 @@ static const char * const ScoreTqReqTimeout_PreDesc_WaitState[] = {
};
static const char * const * const ScoreTqReqTimeout_PreDesc[] = {
- ScoreTqReqTimeout_PreDesc_EnqueueVariant,
ScoreTqReqTimeout_PreDesc_WaitState,
NULL
};
@@ -163,13 +155,20 @@ static void Tick( void *arg )
TQSchedulerRecordStop( ctx->tq_ctx );
}
-static void SchedulerBlock( void *arg, const T_scheduler_event *event )
+static void SchedulerBlock(
+ void *arg,
+ const T_scheduler_event *event,
+ T_scheduler_when when
+)
{
Context *ctx;
ctx = arg;
- if ( event->operation == T_SCHEDULER_BLOCK ) {
+ if (
+ when == T_SCHEDULER_BEFORE &&
+ event->operation == T_SCHEDULER_BLOCK
+ ) {
T_scheduler_set_event_handler( NULL, NULL );
ctx->request.handler = Tick;
CallWithinISRSubmit( &ctx->request );
@@ -188,50 +187,26 @@ static void ThreadTimeout( void *arg )
TQSchedulerRecordStop( ctx->tq_ctx );
}
-static void SchedulerUnblock( void *arg, const T_scheduler_event *event )
+static void SchedulerUnblock(
+ void *arg,
+ const T_scheduler_event *event,
+ T_scheduler_when when
+)
{
Context *ctx;
ctx = arg;
- if ( event->operation == T_SCHEDULER_UNBLOCK ) {
+ if (
+ when == T_SCHEDULER_BEFORE &&
+ event->operation == T_SCHEDULER_UNBLOCK
+ ) {
T_scheduler_set_event_handler( NULL, NULL );
ctx->request.handler = ThreadTimeout;
CallWithinISRSubmit( &ctx->request );
}
}
-static void ScoreTqReqTimeout_Pre_EnqueueVariant_Prepare(
- ScoreTqReqTimeout_Context *ctx,
- ScoreTqReqTimeout_Pre_EnqueueVariant state
-)
-{
- switch ( state ) {
- case ScoreTqReqTimeout_Pre_EnqueueVariant_Blocking: {
- /*
- * Where the thread queue enqueue operation is blocking.
- */
- if ( ctx->tq_ctx->enqueue_variant != TQ_ENQUEUE_BLOCKS ) {
- ctx->Map.skip = true;
- }
- break;
- }
-
- case ScoreTqReqTimeout_Pre_EnqueueVariant_Sticky: {
- /*
- * Where the thread queue enqueue operation is sticky.
- */
- if ( ctx->tq_ctx->enqueue_variant != TQ_ENQUEUE_STICKY ) {
- ctx->Map.skip = true;
- }
- break;
- }
-
- case ScoreTqReqTimeout_Pre_EnqueueVariant_NA:
- break;
- }
-}
-
static void ScoreTqReqTimeout_Pre_WaitState_Prepare(
ScoreTqReqTimeout_Context *ctx,
ScoreTqReqTimeout_Pre_WaitState state
@@ -243,15 +218,11 @@ static void ScoreTqReqTimeout_Pre_WaitState_Prepare(
* While the thread of the timeout operation is in the blocked wait
* state.
*/
- if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
- T_unreachable();
- } else {
- TQEnqueuePrepare( ctx->tq_ctx );
- TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
- Yield();
- Tick( ctx );
- TQEnqueueDone( ctx->tq_ctx );
- }
+ TQEnqueuePrepare( ctx->tq_ctx );
+ TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
+ Yield();
+ Tick( ctx );
+ TQEnqueueDone( ctx->tq_ctx );
break;
}
@@ -261,34 +232,9 @@ static void ScoreTqReqTimeout_Pre_WaitState_Prepare(
* wait state.
*/
TQEnqueuePrepare( ctx->tq_ctx );
-
- if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
- Per_CPU_Control *cpu;
-
- TQSendAndWaitForIntendToBlock(
- ctx->tq_ctx,
- TQ_BLOCKER_A,
- TQ_EVENT_ENQUEUE
- );
- cpu = _Thread_Get_CPU( ctx->tq_ctx->worker_tcb[ TQ_BLOCKER_A ] );
-
- /*
- * We have to make sure that the worker thread inserted its thread
- * timer. Checking the intend to block wait state is not enough to
- * ensure this.
- */
- while ( cpu->thread_dispatch_disable_level != 0 ) {
- /* Wait */
- }
-
- Tick( ctx );
- WaitForExecutionStop( ctx->tq_ctx->worker_id[ TQ_BLOCKER_A ] );
- } else {
- T_scheduler_set_event_handler( SchedulerBlock, ctx );
- TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
- Yield();
- }
-
+ T_scheduler_set_event_handler( SchedulerBlock, ctx );
+ TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
+ Yield();
TQEnqueueDone( ctx->tq_ctx );
break;
}
@@ -299,24 +245,11 @@ static void ScoreTqReqTimeout_Pre_WaitState_Prepare(
* state.
*/
TQEnqueuePrepare( ctx->tq_ctx );
-
- if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
- TQSendAndWaitForIntendToBlock(
- ctx->tq_ctx,
- TQ_BLOCKER_A,
- TQ_EVENT_ENQUEUE | TQ_EVENT_TIMEOUT | TQ_EVENT_SURRENDER |
- TQ_EVENT_SCHEDULER_RECORD_STOP
- );
- TQSchedulerRecordStart( ctx->tq_ctx );
- TQEnqueueDone( ctx->tq_ctx );
- WaitForExecutionStop( ctx->tq_ctx->worker_id[ TQ_BLOCKER_A ] );
- } else {
- TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
- Yield();
- T_scheduler_set_event_handler( SchedulerUnblock, ctx );
- TQEnqueueDone( ctx->tq_ctx );
- TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_SURRENDER );
- }
+ TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE );
+ Yield();
+ T_scheduler_set_event_handler( SchedulerUnblock, ctx );
+ TQEnqueueDone( ctx->tq_ctx );
+ TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_SURRENDER );
break;
}
@@ -372,8 +305,8 @@ static void ScoreTqReqTimeout_Post_Unblock_Check(
switch ( state ) {
case ScoreTqReqTimeout_Post_Unblock_Yes: {
/*
- * The thread of the timeout operation shall not be unblocked by the
- * timeout operation.
+ * The thread of the timeout operation shall be unblocked by the timeout
+ * operation.
*/
T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) );
T_eq_ptr( GetUnblock( ctx, &i ), NULL );
@@ -382,8 +315,8 @@ static void ScoreTqReqTimeout_Post_Unblock_Check(
case ScoreTqReqTimeout_Post_Unblock_No: {
/*
- * The thread of the timeout operation shall be unblocked by the timeout
- * operation.
+ * The thread of the timeout operation shall not be unblocked by the
+ * timeout operation.
*/
T_eq_ptr( GetUnblock( ctx, &i ), NULL );
break;
@@ -400,12 +333,7 @@ static void ScoreTqReqTimeout_Setup( ScoreTqReqTimeout_Context *ctx )
TQReset( ctx->tq_ctx );
if ( ctx->tq_ctx->enqueue_variant == TQ_ENQUEUE_STICKY ) {
- TQSetScheduler(
- ctx->tq_ctx,
- TQ_BLOCKER_A,
- ctx->tq_ctx->other_scheduler_id,
- PRIO_NORMAL
- );
+ TQSetScheduler( ctx->tq_ctx, TQ_BLOCKER_A, SCHEDULER_B_ID, PRIO_NORMAL );
} else {
TQSetPriority( ctx->tq_ctx, TQ_BLOCKER_A, PRIO_HIGH );
}
@@ -443,19 +371,16 @@ static void ScoreTqReqTimeout_Action( ScoreTqReqTimeout_Context *ctx )
static const ScoreTqReqTimeout_Entry
ScoreTqReqTimeout_Entries[] = {
- { 0, 0, 0, ScoreTqReqTimeout_Post_Status_Timeout,
- ScoreTqReqTimeout_Post_Unblock_No },
- { 0, 0, 0, ScoreTqReqTimeout_Post_Status_Ok,
- ScoreTqReqTimeout_Post_Unblock_No },
- { 0, 0, 0, ScoreTqReqTimeout_Post_Status_Timeout,
+ { 0, 0, ScoreTqReqTimeout_Post_Status_Timeout,
ScoreTqReqTimeout_Post_Unblock_Yes },
- { 1, 0, 0, ScoreTqReqTimeout_Post_Status_NA,
- ScoreTqReqTimeout_Post_Unblock_NA }
+ { 0, 0, ScoreTqReqTimeout_Post_Status_Timeout,
+ ScoreTqReqTimeout_Post_Unblock_No },
+ { 0, 0, ScoreTqReqTimeout_Post_Status_Ok, ScoreTqReqTimeout_Post_Unblock_No }
};
static const uint8_t
ScoreTqReqTimeout_Map[] = {
- 2, 0, 1, 3, 0, 1
+ 0, 1, 2
};
static size_t ScoreTqReqTimeout_Scope( void *arg, char *buf, size_t n )
@@ -492,36 +417,9 @@ static inline ScoreTqReqTimeout_Entry ScoreTqReqTimeout_PopEntry(
];
}
-static void ScoreTqReqTimeout_Skip(
- ScoreTqReqTimeout_Context *ctx,
- size_t index
-)
-{
- size_t increment;
-
- ctx->Map.skip = false;
- increment = 1;
-
- switch ( index + 1 ) {
- case 1:
- increment *= ScoreTqReqTimeout_Pre_WaitState_NA - ctx->Map.pcs[ 1 ];
- ctx->Map.pcs[ 1 ] = ScoreTqReqTimeout_Pre_WaitState_NA - 1;
- break;
- }
-
- ctx->Map.index += increment - 1;
-}
-
static void ScoreTqReqTimeout_TestVariant( ScoreTqReqTimeout_Context *ctx )
{
- ScoreTqReqTimeout_Pre_EnqueueVariant_Prepare( ctx, ctx->Map.pcs[ 0 ] );
-
- if ( ctx->Map.skip ) {
- ScoreTqReqTimeout_Skip( ctx, 0 );
- return;
- }
-
- ScoreTqReqTimeout_Pre_WaitState_Prepare( ctx, ctx->Map.pcs[ 1 ] );
+ ScoreTqReqTimeout_Pre_WaitState_Prepare( ctx, ctx->Map.pcs[ 0 ] );
ScoreTqReqTimeout_Action( ctx );
ScoreTqReqTimeout_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
ScoreTqReqTimeout_Post_Unblock_Check( ctx, ctx->Map.entry.Post_Unblock );
@@ -541,23 +439,12 @@ void ScoreTqReqTimeout_Run( TQContext *tq_ctx )
ctx->Map.index = 0;
for (
- ctx->Map.pcs[ 0 ] = ScoreTqReqTimeout_Pre_EnqueueVariant_Blocking;
- ctx->Map.pcs[ 0 ] < ScoreTqReqTimeout_Pre_EnqueueVariant_NA;
+ ctx->Map.pcs[ 0 ] = ScoreTqReqTimeout_Pre_WaitState_Blocked;
+ ctx->Map.pcs[ 0 ] < ScoreTqReqTimeout_Pre_WaitState_NA;
++ctx->Map.pcs[ 0 ]
) {
- for (
- ctx->Map.pcs[ 1 ] = ScoreTqReqTimeout_Pre_WaitState_Blocked;
- ctx->Map.pcs[ 1 ] < ScoreTqReqTimeout_Pre_WaitState_NA;
- ++ctx->Map.pcs[ 1 ]
- ) {
- ctx->Map.entry = ScoreTqReqTimeout_PopEntry( ctx );
-
- if ( ctx->Map.entry.Skip ) {
- continue;
- }
-
- ScoreTqReqTimeout_TestVariant( ctx );
- }
+ ctx->Map.entry = ScoreTqReqTimeout_PopEntry( ctx );
+ ScoreTqReqTimeout_TestVariant( ctx );
}
T_pop_fixture();
diff --git a/testsuites/validation/tr-tq-timeout.h b/testsuites/validation/tr-tq-timeout.h
index 9d111be64b..487c32743d 100644
--- a/testsuites/validation/tr-tq-timeout.h
+++ b/testsuites/validation/tr-tq-timeout.h
@@ -64,12 +64,6 @@ extern "C" {
*/
typedef enum {
- ScoreTqReqTimeout_Pre_EnqueueVariant_Blocking,
- ScoreTqReqTimeout_Pre_EnqueueVariant_Sticky,
- ScoreTqReqTimeout_Pre_EnqueueVariant_NA
-} ScoreTqReqTimeout_Pre_EnqueueVariant;
-
-typedef enum {
ScoreTqReqTimeout_Pre_WaitState_Blocked,
ScoreTqReqTimeout_Pre_WaitState_IntendToBlock,
ScoreTqReqTimeout_Pre_WaitState_ReadyAgain,