validation: Move flush filter stop validation

This gets rid of a cyclic dependency in the specification graph.

Update #3716.
This commit is contained in:
Sebastian Huber
2022-08-31 11:29:56 +02:00
parent 1dca588f63
commit c4472cef3e
4 changed files with 408 additions and 106 deletions
+22 -48
View File
@@ -70,9 +70,8 @@
*/ */
typedef enum { typedef enum {
NewlibReqFutexWake_Pre_Count_Negative, NewlibReqFutexWake_Pre_Count_NegativeOrZero,
NewlibReqFutexWake_Pre_Count_Partial, NewlibReqFutexWake_Pre_Count_Positive,
NewlibReqFutexWake_Pre_Count_All,
NewlibReqFutexWake_Pre_Count_NA NewlibReqFutexWake_Pre_Count_NA
} NewlibReqFutexWake_Pre_Count; } NewlibReqFutexWake_Pre_Count;
@@ -83,8 +82,7 @@ typedef enum {
typedef enum { typedef enum {
NewlibReqFutexWake_Post_Flush_No, NewlibReqFutexWake_Post_Flush_No,
NewlibReqFutexWake_Post_Flush_Partial, NewlibReqFutexWake_Post_Flush_Yes,
NewlibReqFutexWake_Post_Flush_All,
NewlibReqFutexWake_Post_Flush_NA NewlibReqFutexWake_Post_Flush_NA
} NewlibReqFutexWake_Post_Flush; } NewlibReqFutexWake_Post_Flush;
@@ -147,9 +145,8 @@ static NewlibReqFutexWake_Context
NewlibReqFutexWake_Instance; NewlibReqFutexWake_Instance;
static const char * const NewlibReqFutexWake_PreDesc_Count[] = { static const char * const NewlibReqFutexWake_PreDesc_Count[] = {
"Negative", "NegativeOrZero",
"Partial", "Positive",
"All",
"NA" "NA"
}; };
@@ -189,18 +186,18 @@ static uint32_t Flush( TQContext *tq_ctx, uint32_t thread_count, bool all )
{ {
Context *ctx; Context *ctx;
int count; int count;
int how_many;
(void) thread_count;
ctx = ToContext( tq_ctx ); ctx = ToContext( tq_ctx );
how_many = (int) ctx->tq_ctx.how_many;
count = _Futex_Wake( &ctx->futex, 1 ); if ( all ) {
T_eq_int( count, how_many > 0 ? 1 : 0 ); count = _Futex_Wake( &ctx->futex, INT_MAX );
} else {
count = _Futex_Wake( &ctx->futex, 1 );
}
count = _Futex_Wake( &ctx->futex, INT_MAX ); return (uint32_t) count;
T_eq_int( count, how_many > 1 ? how_many - 1 : 0 );
return thread_count;
} }
static void NewlibReqFutexWake_Pre_Count_Prepare( static void NewlibReqFutexWake_Pre_Count_Prepare(
@@ -209,29 +206,17 @@ static void NewlibReqFutexWake_Pre_Count_Prepare(
) )
{ {
switch ( state ) { switch ( state ) {
case NewlibReqFutexWake_Pre_Count_Negative: { case NewlibReqFutexWake_Pre_Count_NegativeOrZero: {
/* /*
* While the ``count`` parameter is less than zero. * While the ``count`` parameter is less or equal to than zero.
*/ */
/* This state is prepared by Enqueue() */ /* This state is prepared by Enqueue() */
break; break;
} }
case NewlibReqFutexWake_Pre_Count_Partial: { case NewlibReqFutexWake_Pre_Count_Positive: {
/* /*
* While the ``count`` parameter is greater than or equal to zero, while * While the ``count`` parameter is greater than zero.
* the ``count`` parameter is less than the count of threads enqueued on
* the thread queue of the futex object.
*/
/* This state is prepared by Flush() */
break;
}
case NewlibReqFutexWake_Pre_Count_All: {
/*
* While the ``count`` parameter is greater than or equal to zero, while
* the ``count`` parameter is greater than or equal to the count of
* threads enqueued on the thread queue of the futex object.
*/ */
/* This state is prepared by Flush() */ /* This state is prepared by Flush() */
break; break;
@@ -277,21 +262,12 @@ static void NewlibReqFutexWake_Post_Flush_Check(
break; break;
} }
case NewlibReqFutexWake_Post_Flush_Partial: { case NewlibReqFutexWake_Post_Flush_Yes: {
/* /*
* The first count threads specified by the ``count`` parameter shall be * The first count threads specified by the ``count`` parameter shall be
* extracted from the thread queue of the futex object in FIFO order. * extracted from the thread queue of the futex object in FIFO order.
*/ */
/* This state is checked by Flush() */ ScoreTqReqFlushFifo_Run( &ctx->tq_ctx, true );
break;
}
case NewlibReqFutexWake_Post_Flush_All: {
/*
* All threads shall be extracted from the thread queue of the futex
* object in FIFO order.
*/
ScoreTqReqFlushFifo_Run( &ctx->tq_ctx );
break; break;
} }
@@ -357,14 +333,12 @@ NewlibReqFutexWake_Entries[] = {
{ 0, 0, NewlibReqFutexWake_Post_Result_Count, { 0, 0, NewlibReqFutexWake_Post_Result_Count,
NewlibReqFutexWake_Post_Flush_No }, NewlibReqFutexWake_Post_Flush_No },
{ 0, 0, NewlibReqFutexWake_Post_Result_Count, { 0, 0, NewlibReqFutexWake_Post_Result_Count,
NewlibReqFutexWake_Post_Flush_Partial }, NewlibReqFutexWake_Post_Flush_Yes }
{ 0, 0, NewlibReqFutexWake_Post_Result_Count,
NewlibReqFutexWake_Post_Flush_All }
}; };
static const uint8_t static const uint8_t
NewlibReqFutexWake_Map[] = { NewlibReqFutexWake_Map[] = {
0, 1, 2 0, 1
}; };
static size_t NewlibReqFutexWake_Scope( void *arg, char *buf, size_t n ) static size_t NewlibReqFutexWake_Scope( void *arg, char *buf, size_t n )
@@ -421,7 +395,7 @@ T_TEST_CASE_FIXTURE( NewlibReqFutexWake, &NewlibReqFutexWake_Fixture )
ctx->Map.index = 0; ctx->Map.index = 0;
for ( for (
ctx->Map.pcs[ 0 ] = NewlibReqFutexWake_Pre_Count_Negative; ctx->Map.pcs[ 0 ] = NewlibReqFutexWake_Pre_Count_NegativeOrZero;
ctx->Map.pcs[ 0 ] < NewlibReqFutexWake_Pre_Count_NA; ctx->Map.pcs[ 0 ] < NewlibReqFutexWake_Pre_Count_NA;
++ctx->Map.pcs[ 0 ] ++ctx->Map.pcs[ 0 ]
) { ) {
+1 -1
View File
@@ -407,7 +407,7 @@ static void RtemsSemReqFlush_Post_Action_Check(
* The calling task shall flush the semaphore as specified by * The calling task shall flush the semaphore as specified by
* /score/tq/req/flush-fifo. * /score/tq/req/flush-fifo.
*/ */
ScoreTqReqFlushFifo_Run( &ctx->tq_ctx ); ScoreTqReqFlushFifo_Run( &ctx->tq_ctx, false );
break; break;
} }
File diff suppressed because it is too large Load Diff
+27 -6
View File
@@ -64,14 +64,33 @@ extern "C" {
*/ */
typedef enum { typedef enum {
ScoreTqReqFlushFifo_Pre_Queue_Empty, ScoreTqReqFlushFifo_Pre_MayStop_Yes,
ScoreTqReqFlushFifo_Pre_Queue_NonEmpty, ScoreTqReqFlushFifo_Pre_MayStop_No,
ScoreTqReqFlushFifo_Pre_Queue_NA ScoreTqReqFlushFifo_Pre_MayStop_NA
} ScoreTqReqFlushFifo_Pre_Queue; } ScoreTqReqFlushFifo_Pre_MayStop;
typedef enum {
ScoreTqReqFlushFifo_Pre_QueueEmpty_Yes,
ScoreTqReqFlushFifo_Pre_QueueEmpty_No,
ScoreTqReqFlushFifo_Pre_QueueEmpty_NA
} ScoreTqReqFlushFifo_Pre_QueueEmpty;
typedef enum {
ScoreTqReqFlushFifo_Pre_Stop_Yes,
ScoreTqReqFlushFifo_Pre_Stop_No,
ScoreTqReqFlushFifo_Pre_Stop_NA
} ScoreTqReqFlushFifo_Pre_Stop;
typedef enum {
ScoreTqReqFlushFifo_Pre_WaitState_Blocked,
ScoreTqReqFlushFifo_Pre_WaitState_IntendToBlock,
ScoreTqReqFlushFifo_Pre_WaitState_NA
} ScoreTqReqFlushFifo_Pre_WaitState;
typedef enum { typedef enum {
ScoreTqReqFlushFifo_Post_Operation_Nop, ScoreTqReqFlushFifo_Post_Operation_Nop,
ScoreTqReqFlushFifo_Post_Operation_TryExtract, ScoreTqReqFlushFifo_Post_Operation_ExtractAll,
ScoreTqReqFlushFifo_Post_Operation_ExtractPartial,
ScoreTqReqFlushFifo_Post_Operation_NA ScoreTqReqFlushFifo_Post_Operation_NA
} ScoreTqReqFlushFifo_Post_Operation; } ScoreTqReqFlushFifo_Post_Operation;
@@ -79,8 +98,10 @@ typedef enum {
* @brief Runs the parameterized test case. * @brief Runs the parameterized test case.
* *
* @param[in,out] tq_ctx is the thread queue test context. * @param[in,out] tq_ctx is the thread queue test context.
*
* @param may_stop is true, if a partial flush is supported.
*/ */
void ScoreTqReqFlushFifo_Run( TQContext *tq_ctx ); void ScoreTqReqFlushFifo_Run( TQContext *tq_ctx, bool may_stop );
/** @} */ /** @} */