summaryrefslogtreecommitdiffstats
path: root/testsuites/validation/tc-sem-timeout.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/validation/tc-sem-timeout.c')
-rw-r--r--testsuites/validation/tc-sem-timeout.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/testsuites/validation/tc-sem-timeout.c b/testsuites/validation/tc-sem-timeout.c
index 254a6be5db..a150d067d2 100644
--- a/testsuites/validation/tc-sem-timeout.c
+++ b/testsuites/validation/tc-sem-timeout.c
@@ -3,11 +3,11 @@
/**
* @file
*
- * @ingroup RTEMSTestCaseRtemsSemReqTimeout
+ * @ingroup RtemsSemReqTimeout
*/
/*
- * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2021 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -55,7 +55,6 @@
#include <rtems.h>
#include <string.h>
-#include "tr-tq-timeout-mrsp.h"
#include "tr-tq-timeout-priority-inherit.h"
#include "tr-tq-timeout.h"
#include "tx-support.h"
@@ -64,9 +63,9 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestCaseRtemsSemReqTimeout spec:/rtems/sem/req/timeout
+ * @defgroup RtemsSemReqTimeout spec:/rtems/sem/req/timeout
*
- * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0
+ * @ingroup TestsuitesValidationNoClock0
*
* @{
*/
@@ -108,7 +107,7 @@ typedef struct {
/**
* @brief This member contains the thread queue test context.
*/
- TQContext tq_ctx;;
+ TQContext tq_ctx;
/**
* @brief This member specifies if the attribute set of the semaphore.
@@ -169,6 +168,10 @@ static const char * const * const RtemsSemReqTimeout_PreDesc[] = {
NULL
};
+#if defined(RTEMS_SMP)
+#include "tr-tq-timeout-mrsp.h"
+#endif
+
static void RtemsSemReqTimeout_Pre_Class_Prepare(
RtemsSemReqTimeout_Context *ctx,
RtemsSemReqTimeout_Pre_Class state
@@ -226,7 +229,11 @@ static void RtemsSemReqTimeout_Pre_Class_Prepare(
*/
ctx->attribute_set |= RTEMS_BINARY_SEMAPHORE |
RTEMS_MULTIPROCESSOR_RESOURCE_SHARING;
+ #if defined(RTEMS_SMP)
ctx->tq_ctx.enqueue_variant = TQ_ENQUEUE_STICKY;
+ #else
+ ctx->tq_ctx.enqueue_variant = TQ_ENQUEUE_BLOCKS;
+ #endif
break;
}
@@ -273,7 +280,7 @@ static void RtemsSemReqTimeout_Post_Action_Check(
case RtemsSemReqTimeout_Post_Action_Timeout: {
/*
* The semaphore obtain timeout actions shall be done as specified by
- * /score/tq/req/timeout.
+ * spec:/score/tq/req/timeout.
*/
ctx->tq_ctx.wait = TQ_WAIT_TIMED;
ScoreTqReqTimeout_Run( &ctx->tq_ctx );
@@ -283,17 +290,21 @@ static void RtemsSemReqTimeout_Post_Action_Check(
case RtemsSemReqTimeout_Post_Action_TimeoutMrsP: {
/*
* The semaphore obtain timeout actions shall be done as specified by
- * /score/tq/req/timeout-mrsp.
+ * spec:/score/tq/req/timeout-mrsp.
*/
+ #if defined(RTEMS_SMP)
ctx->tq_ctx.wait = TQ_WAIT_TIMED;
ScoreTqReqTimeoutMrsp_Run( &ctx->tq_ctx );
+ #else
+ T_unreachable();
+ #endif
break;
}
case RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit: {
/*
* The semaphore obtain timeout actions shall be done as specified by
- * /score/tq/req/timeout-priority-inherit.
+ * spec:/score/tq/req/timeout-priority-inherit.
*/
ctx->tq_ctx.wait = TQ_WAIT_FOREVER;
ScoreTqReqTimeoutPriorityInherit_Run( &ctx->tq_ctx );
@@ -361,8 +372,12 @@ static void RtemsSemReqTimeout_Action( RtemsSemReqTimeout_Context *ctx )
static void RtemsSemReqTimeout_Cleanup( RtemsSemReqTimeout_Context *ctx )
{
- if ( ctx->tq_ctx.thread_queue_id != 0 ) { rtems_status_code sc;
- sc = rtems_semaphore_delete( ctx->tq_ctx.thread_queue_id ); T_rsc_success( sc ); }
+ if ( ctx->tq_ctx.thread_queue_id != 0 ) {
+ rtems_status_code sc;
+
+ sc = rtems_semaphore_delete( ctx->tq_ctx.thread_queue_id );
+ T_rsc_success( sc );
+ }
}
static const RtemsSemReqTimeout_Entry
@@ -370,10 +385,10 @@ RtemsSemReqTimeout_Entries[] = {
{ 0, 0, 0, RtemsSemReqTimeout_Post_Action_Timeout },
{ 1, 0, 0, RtemsSemReqTimeout_Post_Action_NA },
{ 0, 0, 0, RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit },
-#if !defined(RTEMS_SMP)
- { 1, 0, 0, RtemsSemReqTimeout_Post_Action_NA }
-#else
+#if defined(RTEMS_SMP)
{ 0, 0, 0, RtemsSemReqTimeout_Post_Action_TimeoutMrsP }
+#else
+ { 0, 0, 0, RtemsSemReqTimeout_Post_Action_Timeout }
#endif
};