summaryrefslogtreecommitdiffstats
path: root/testsuites/validation
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-23 14:52:21 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-23 14:58:21 +0100
commitf279017882f0d976c069b9a2bc26fee2489d6ed2 (patch)
tree2e8b79411bb69cf402f527b026280a7873e5b860 /testsuites/validation
parentwaf: Fix Python 3.12 escape sequences (diff)
downloadrtems-f279017882f0d976c069b9a2bc26fee2489d6ed2.tar.bz2
validation: Improve MrsP validation
For uniprocessor configurations, the selection of RTEMS_MULTIPROCESSOR_RESOURCE_SHARING results in a priority ceiling mutex. Build the MrsP validation tests only if RTEMS_SMP is enabled. Update #3716.
Diffstat (limited to 'testsuites/validation')
-rw-r--r--testsuites/validation/tc-sem-obtain.c25
-rw-r--r--testsuites/validation/tc-sem-timeout.c19
-rw-r--r--testsuites/validation/tr-mtx-seize-wait.c9
-rw-r--r--testsuites/validation/tr-mtx-surrender.c9
4 files changed, 46 insertions, 16 deletions
diff --git a/testsuites/validation/tc-sem-obtain.c b/testsuites/validation/tc-sem-obtain.c
index 3370a57604..10c4475d8c 100644
--- a/testsuites/validation/tc-sem-obtain.c
+++ b/testsuites/validation/tc-sem-obtain.c
@@ -499,11 +499,15 @@ static void RtemsSemReqObtain_Post_Action_Check(
* spec:/score/mtx/req/seize-try where an enqueue is sticky, a recursive
* seize returns an error status, and a priority ceiling is used.
*/
+ #if defined(RTEMS_SMP)
ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY;
ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP;
ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK;
ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH;
ScoreMtxReqSeizeTry_Run( &ctx->tq_mtx_ctx );
+ #else
+ T_unreachable();
+ #endif
break;
}
@@ -513,11 +517,15 @@ static void RtemsSemReqObtain_Post_Action_Check(
* spec:/score/mtx/req/seize-wait where an enqueue is sticky, a recursive
* seize returns an error status, and a priority ceiling is used.
*/
+ #if defined(RTEMS_SMP)
ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY;
ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP;
ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK;
ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH;
ScoreMtxReqSeizeWait_Run( &ctx->tq_mtx_ctx );
+ #else
+ T_unreachable();
+ #endif
break;
}
@@ -580,6 +588,7 @@ static void RtemsSemReqObtain_Action( RtemsSemReqObtain_Context *ctx )
);
T_rsc_success( sc );
+ #if defined(RTEMS_SMP)
if ( ( ctx->attribute_set & RTEMS_MULTIPROCESSOR_RESOURCE_SHARING ) != 0 ) {
rtems_task_priority prio;
@@ -591,6 +600,7 @@ static void RtemsSemReqObtain_Action( RtemsSemReqObtain_Context *ctx )
);
T_rsc_success( sc );
}
+ #endif
}
static void RtemsSemReqObtain_Cleanup( RtemsSemReqObtain_Context *ctx )
@@ -606,33 +616,28 @@ RtemsSemReqObtain_Entries[] = {
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_SemSeizeWait },
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_SemSeizeTry },
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeWait },
-#if defined(RTEMS_SMP)
- { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InvId },
-#else
- { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA },
-#endif
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeTry },
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeWait },
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InheritMtxSeizeWait },
#if defined(RTEMS_SMP)
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeWait },
#else
- { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA },
+ { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeWait },
#endif
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeTry },
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InheritMtxSeizeTry },
#if defined(RTEMS_SMP)
{ 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeTry }
#else
- { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA }
+ { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeTry }
#endif
};
static const uint8_t
RtemsSemReqObtain_Map[] = {
- 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 6, 4,
- 4, 0, 0, 0, 6, 4, 4, 0, 0, 0, 1, 1, 1, 1, 1, 1, 10, 7, 7, 0, 0, 0, 1, 1, 1,
- 1, 1, 1, 11, 8, 8, 0, 0, 0, 1, 1, 1, 1, 1, 1, 12, 9, 9, 5, 5, 5
+ 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 5, 4,
+ 4, 0, 0, 0, 5, 4, 4, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 6, 6, 0, 0, 0, 1, 1, 1, 1,
+ 1, 1, 10, 7, 7, 0, 0, 0, 1, 1, 1, 1, 1, 1, 11, 8, 8, 0, 0, 0
};
static size_t RtemsSemReqObtain_Scope( void *arg, char *buf, size_t n )
diff --git a/testsuites/validation/tc-sem-timeout.c b/testsuites/validation/tc-sem-timeout.c
index cdef96181e..a150d067d2 100644
--- a/testsuites/validation/tc-sem-timeout.c
+++ b/testsuites/validation/tc-sem-timeout.c
@@ -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"
@@ -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;
}
@@ -285,8 +292,12 @@ static void RtemsSemReqTimeout_Post_Action_Check(
* The semaphore obtain timeout actions shall be done as specified by
* 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;
}
@@ -374,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
};
diff --git a/testsuites/validation/tr-mtx-seize-wait.c b/testsuites/validation/tr-mtx-seize-wait.c
index 829b5334b0..71385d440f 100644
--- a/testsuites/validation/tr-mtx-seize-wait.c
+++ b/testsuites/validation/tr-mtx-seize-wait.c
@@ -56,7 +56,6 @@
#include "tr-tq-enqueue-ceiling.h"
#include "tr-tq-enqueue-deadlock.h"
#include "tr-tq-enqueue-fifo.h"
-#include "tr-tq-enqueue-mrsp.h"
#include "tr-tq-enqueue-priority-inherit.h"
#include "tr-tq-enqueue-priority.h"
@@ -218,6 +217,10 @@ static const char * const * const ScoreMtxReqSeizeWait_PreDesc[] = {
NULL
};
+#if defined(RTEMS_SMP)
+#include "tr-tq-enqueue-mrsp.h"
+#endif
+
typedef ScoreMtxReqSeizeWait_Context Context;
static Status_Control Status( const Context *ctx, Status_Control status )
@@ -728,7 +731,11 @@ static void ScoreMtxReqSeizeWait_Post_Enqueued_Check(
* The calling thread shall be enqueued in priority order according to
* the MrsP locking protocol.
*/
+ #if defined(RTEMS_SMP)
ScoreTqReqEnqueueMrsp_Run( &ctx->tq_ctx->base );
+ #else
+ T_unreachable();
+ #endif
break;
}
diff --git a/testsuites/validation/tr-mtx-surrender.c b/testsuites/validation/tr-mtx-surrender.c
index e02b7282bd..657a80f924 100644
--- a/testsuites/validation/tr-mtx-surrender.c
+++ b/testsuites/validation/tr-mtx-surrender.c
@@ -53,7 +53,6 @@
#endif
#include "tr-mtx-surrender.h"
-#include "tr-tq-surrender-mrsp.h"
#include "tr-tq-surrender-priority-inherit.h"
#include "tr-tq-surrender.h"
@@ -252,6 +251,10 @@ static const char * const * const ScoreMtxReqSurrender_PreDesc[] = {
NULL
};
+#if defined(RTEMS_SMP)
+#include "tr-tq-surrender-mrsp.h"
+#endif
+
typedef ScoreMtxReqSurrender_Context Context;
static Status_Control Status( const Context *ctx, Status_Control status )
@@ -810,8 +813,12 @@ static void ScoreMtxReqSurrender_Post_Surrender_Check(
* The thread queue of the mutex shall be surrendered in priority order
* with MrsP.
*/
+ #if defined(RTEMS_SMP)
T_eq_u32( ctx->counter, 1 );
ScoreTqReqSurrenderMrsp_Run( &ctx->tq_ctx->base );
+ #else
+ T_unreachable();
+ #endif
break;
}