diff options
Diffstat (limited to 'spec/score/tq/req/enqueue-priority.yml')
-rw-r--r-- | spec/score/tq/req/enqueue-priority.yml | 178 |
1 files changed, 72 insertions, 106 deletions
diff --git a/spec/score/tq/req/enqueue-priority.yml b/spec/score/tq/req/enqueue-priority.yml index 8e0d7fe6..d7c0463a 100644 --- a/spec/score/tq/req/enqueue-priority.yml +++ b/spec/score/tq/req/enqueue-priority.yml @@ -9,7 +9,7 @@ post-conditions: states: - name: InitialFirst test-code: | - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | A priority queue associated with the scheduler which contains exactly the @@ -17,8 +17,8 @@ post-conditions: thread queue. - name: InitialLast test-code: | + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_D ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | A priority queue associated with the scheduler which contains exactly the @@ -26,25 +26,25 @@ post-conditions: thread queue. - name: First test-code: | + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | The enqueueing thread shall be enqueued in the priority queue associated with the scheduler. - name: Second test-code: | - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | The enqueueing thread shall be enqueued in the priority queue associated with the scheduler. - name: FirstFirst test-code: | - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_D ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | The enqueueing thread shall be enqueued in the priority queue associated @@ -53,9 +53,9 @@ post-conditions: The position of the priority queue in the thread queue shall not change. - name: SecondFirst test-code: | - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_D ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | The enqueueing thread shall be enqueued in the priority queue associated @@ -64,9 +64,9 @@ post-conditions: The position of the priority queue in the thread queue shall not change. - name: FirstLast test-code: | + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_D ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | The enqueueing thread shall be enqueued in the priority queue associated @@ -75,9 +75,9 @@ post-conditions: The position of the priority queue in the thread queue shall not change. - name: SecondLast test-code: | - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_D ) ); T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); T_eq_ptr( GetUnblock( ctx, &i ), NULL ); text: | The enqueueing thread shall be enqueued in the priority queue associated @@ -90,11 +90,9 @@ post-conditions: i = 0; - /* Event receive */ - T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); - - /* Enqueue */ - T_eq_ptr( GetBlock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_B ) ); + /* Event receives */ + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_C ) ); + T_eq_ptr( GetUnblock( ctx, &i ), GetTCB( ctx, TQ_BLOCKER_A ) ); pre-conditions: - name: EligibleScheduler states: @@ -114,12 +112,13 @@ pre-conditions: states: - name: None test-code: | - /* This is the default */ + ctx->priority = PRIO_PSEUDO_ISR; text: | While the priority queue of the thread queue associated with an eligible scheduler of the enqueueing thread is empty. - name: LT test-code: | + ++ctx->tq_ctx->how_many; ctx->priority = PRIO_ULTRA_HIGH; text: | While the priority queue of the thread queue associated with an eligible @@ -128,6 +127,7 @@ pre-conditions: the enqueueing thread with respect to this scheduler. - name: EQ test-code: | + ++ctx->tq_ctx->how_many; ctx->priority = PRIO_VERY_HIGH; text: | While the priority queue of the thread queue associated with an eligible @@ -136,6 +136,7 @@ pre-conditions: enqueueing thread with respect to this scheduler. - name: GT test-code: | + ++ctx->tq_ctx->how_many; ctx->priority = PRIO_HIGH; text: | While the priority queue of the thread queue associated with an eligible @@ -148,19 +149,24 @@ pre-conditions: states: - name: None test-code: | - /* This is the default */ + ctx->other_before = false; + ctx->other_after = false; text: | While no priority queue of the thread queue exists which is not associated with an eligible scheduler of the enqueueing thread. - name: Only test-code: | + ++ctx->tq_ctx->how_many; ctx->other_before = true; + ctx->other_after = false; text: | While exactly one priority queue of the thread queue exists which is not associated with an eligible scheduler of the enqueueing thread. - name: Before test-code: | + ++ctx->tq_ctx->how_many; ctx->other_before = true; + ctx->other_after = false; text: | While a priority queue of the thread queue exists which is not associated with an eligible scheduler of the enqueueing thread, while @@ -168,6 +174,8 @@ pre-conditions: associated with eligible schedulers of the enqueueing thread. - name: After test-code: | + ++ctx->tq_ctx->how_many; + ctx->other_before = false; ctx->other_after = true; text: | While a priority queue of the thread queue exists which is not associated @@ -184,72 +192,58 @@ skip-reasons: These variants are invalid due to three independent reasons. Firstly, where the system was built with SMP support disabled, no other scheduler can exist. Secondly, a priority queue must be present to have another - priority positioned before or after the priority queue. Thirdly, if only - one priority queue shall be present, then on other priority queue can + priority queue positioned before or after the priority queue. Thirdly, if + only one priority queue shall be present, then on other priority queue can exist. test-action: | + TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE_PREPARE ); + if ( ctx->other_before ) { - TQSetScheduler( + TQSendAndWaitForExecutionStop( ctx->tq_ctx, - TQ_BLOCKER_C, - ctx->tq_ctx->other_scheduler_id, - PRIO_LOW - ); - TQSend( - ctx->tq_ctx, - TQ_BLOCKER_C, - TQ_EVENT_HELPER_OTHER_SYNC | TQ_EVENT_ENQUEUE | TQ_EVENT_DEQUEUE_ONE | TQ_EVENT_RUNNER_SYNC + TQ_BLOCKER_D, + TQ_EVENT_ENQUEUE | TQ_EVENT_SURRENDER | TQ_EVENT_RUNNER_SYNC_2 ); - TQSynchronizeRunner(); } if ( ctx->priority != PRIO_PSEUDO_ISR ) { - TQSetPriority( ctx->tq_ctx, TQ_BLOCKER_A , ctx->priority ); + TQSetPriority( ctx->tq_ctx, TQ_BLOCKER_B , ctx->priority ); TQSend( ctx->tq_ctx, - TQ_BLOCKER_A, - TQ_EVENT_ENQUEUE | TQ_EVENT_DEQUEUE_ONE + TQ_BLOCKER_B, + TQ_EVENT_ENQUEUE | TQ_EVENT_SURRENDER ); } if ( ctx->other_after ) { - TQSetScheduler( + TQSendAndWaitForExecutionStop( ctx->tq_ctx, - TQ_BLOCKER_C, - ctx->tq_ctx->other_scheduler_id, - PRIO_LOW - ); - TQSend( - ctx->tq_ctx, - TQ_BLOCKER_C, - TQ_EVENT_HELPER_OTHER_SYNC | TQ_EVENT_ENQUEUE | TQ_EVENT_DEQUEUE_ONE | TQ_EVENT_RUNNER_SYNC + TQ_BLOCKER_D, + TQ_EVENT_ENQUEUE | TQ_EVENT_SURRENDER | TQ_EVENT_RUNNER_SYNC_2 ); - TQSynchronizeRunner(); } if ( ctx->helping ) { if ( ctx->other_before || ctx->other_after ) { if ( rtems_scheduler_get_processor_maximum() > 2 ) { - AddHelper( - ctx->tq_ctx, - ctx->tq_ctx->third_scheduler_id, - TQ_EVENT_HELPER_THIRD_SYNC - ); + AddHelper( ctx->tq_ctx, ctx->tq_ctx->third_scheduler_id ); } } else { - AddHelper( - ctx->tq_ctx, - ctx->tq_ctx->other_scheduler_id, - TQ_EVENT_HELPER_OTHER_SYNC - ); + AddHelper( ctx->tq_ctx, ctx->tq_ctx->other_scheduler_id ); } } TQSchedulerRecordStart( ctx->tq_ctx ); - TQSend( ctx->tq_ctx, TQ_BLOCKER_B, TQ_EVENT_ENQUEUE | TQ_EVENT_DEQUEUE_ONE ); - TQDequeueAll( ctx->tq_ctx ); + TQSend( + ctx->tq_ctx, + TQ_BLOCKER_C, + TQ_EVENT_ENQUEUE | TQ_EVENT_SURRENDER | TQ_EVENT_RUNNER_SYNC + ); + TQSend( ctx->tq_ctx, TQ_BLOCKER_A, TQ_EVENT_ENQUEUE_DONE ); if ( ctx->other_before || ctx->other_after ) { + TQSynchronizeRunner2(); + } else { TQSynchronizeRunner(); } @@ -265,9 +259,7 @@ test-action: | } } test-brief: null -test-cleanup: | - TQCleanup( ctx->tq_ctx ); - TQReset( ctx->tq_ctx ); +test-cleanup: null test-context: - brief: | This this member is true, then the enqueueing thread shall have at least @@ -315,39 +307,27 @@ test-includes: [] test-local-includes: - tr-tq-enqueue-priority.h test-prepare: - ctx->priority = PRIORITY_PSEUDO_ISR; - ctx->other_before = false; - ctx->other_after = false; - TQPrepare( ctx->tq_ctx ); + ctx->tq_ctx->how_many = 1; test-setup: brief: null code: | - if ( rtems_scheduler_get_processor_maximum() > 3 ) { - rtems_status_code sc; - rtems_id scheduler_id; - - sc = rtems_scheduler_ident_by_processor( 3, &scheduler_id ); - T_rsc_success( sc ); + TQSetPriority( ctx->tq_ctx, TQ_BLOCKER_A, PRIO_ULTRA_HIGH ); + TQSetPriority( ctx->tq_ctx, TQ_BLOCKER_B, PRIO_LOW ); + TQSetPriority( ctx->tq_ctx, TQ_BLOCKER_C, PRIO_VERY_HIGH ); - sc = rtems_scheduler_remove_processor( scheduler_id, 3 ); - T_rsc_success( sc ); - } + #if defined( RTEMS_SMP ) + TQSetScheduler( + ctx->tq_ctx, + TQ_BLOCKER_D, + ctx->tq_ctx->other_scheduler_id, + PRIO_LOW + ); + #endif description: null test-stop: null test-support: | typedef ScoreTqReqEnqueuePriority_Context Context; - static const rtems_tcb *GetBlock( Context *ctx, size_t *index ) - { - const rtems_tcb *thread; - - do { - thread = TQGetNextBlock( ctx->tq_ctx, index )->thread; - } while ( thread == ctx->tq_ctx->worker_tcb[ TQ_HELPER_THIRD ] ); - - return thread; - } - static const rtems_tcb *GetUnblock( Context *ctx, size_t *index ) { const rtems_tcb *thread; @@ -364,42 +344,28 @@ test-support: | return ctx->tq_ctx->worker_tcb[ worker ]; } - static void AddHelper( - TQContext *tq_ctx, - rtems_id scheduler_id, - TQEvent sync - ) + static void AddHelper( TQContext *tq_ctx, rtems_id scheduler_id ) { - TQSend( tq_ctx, TQ_BLOCKER_B, TQ_EVENT_MUTEX_OBTAIN ); - TQSetScheduler( tq_ctx, TQ_BLOCKER_D, scheduler_id, PRIO_LOW ); - TQSend( + TQSend( tq_ctx, TQ_BLOCKER_C, TQ_EVENT_MUTEX_A_OBTAIN ); + TQSetScheduler( tq_ctx, TQ_BLOCKER_E, scheduler_id, PRIO_LOW ); + TQSendAndWaitForExecutionStop( tq_ctx, - TQ_BLOCKER_D, - sync | TQ_EVENT_MUTEX_OBTAIN | TQ_EVENT_MUTEX_RELEASE + TQ_BLOCKER_E, + TQ_EVENT_MUTEX_A_OBTAIN | TQ_EVENT_MUTEX_A_RELEASE ); - TQSynchronizeRunner(); } static void RemoveHelper( TQContext *tq_ctx ) { - TQSend( tq_ctx, TQ_BLOCKER_B, TQ_EVENT_MUTEX_RELEASE ); - TQMutexObtain( tq_ctx ); - TQMutexRelease( tq_ctx ); + TQSend( tq_ctx, TQ_BLOCKER_C, TQ_EVENT_MUTEX_A_RELEASE ); + TQMutexObtain( tq_ctx, TQ_MUTEX_A ); + TQMutexRelease( tq_ctx, TQ_MUTEX_A ); } test-target: testsuites/validation/tr-tq-enqueue-priority.c test-teardown: brief: null code: | - if ( rtems_scheduler_get_processor_maximum() > 3 ) { - rtems_status_code sc; - rtems_id scheduler_id; - - sc = rtems_scheduler_ident_by_processor( 2, &scheduler_id ); - T_rsc_success( sc ); - - sc = rtems_scheduler_add_processor( scheduler_id, 3 ); - T_rsc_success( sc ); - } + TQReset( ctx->tq_ctx ); description: null text: | When the calling task is enqueued on the thread queue. |