Update for vTaskSuspend SMP unit test (#1160)

pull/1157/head^2
chinglee-iot 1 year ago committed by GitHub
parent 527ee9a799
commit d603c9b1ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -410,19 +410,27 @@ void test_vTaskDelete_assert_scheduler_suspended_eq_1( void )
}
/**
* @brief This test ensures that the code asserts when a task is suspended while
* the scheduler is suspended
* @brief vTaskSuspend - scheduler suspended assertion.
*
* This test ensures that the code asserts when a task is suspended while
* the scheduler is suspended
*
* <b>Coverage</b>
* @code{c}
* vTaskDelete( xTaskToDelete );
*
* configASSERT( uxSchedulerSuspended == 0 );
*
* if( xSchedulerRunning != pdFALSE )
* {
* if( pxTCB->xTaskRunState == ( BaseType_t ) portGET_CORE_ID() )
* {
* configASSERT( uxSchedulerSuspended == 0 );
* vTaskYieldWithinAPI();
* }
* else
* {
* prvYieldCore( pxTCB->xTaskRunState );
* }
* }
* @endcode
*
* configNUMBER_OF_CORES > 1
* INCLUDE_vTaskSuspend
* configASSERT( uxSchedulerSuspended == 0 ) is triggered.
*/
void test_vTaskSuspend_assert_schedulersuspended_ne_zero( void )
{
@ -438,7 +446,15 @@ void test_vTaskSuspend_assert_schedulersuspended_ne_zero( void )
uxListRemove_ExpectAnyArgsAndReturn( pdTRUE );
listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL );
vListInsertEnd_ExpectAnyArgs();
vFakePortExitCriticalSection_Expect();
/* Reset the next expected unblock time if scheduler is running. */
vFakePortEnterCriticalSection_Expect();
listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdTRUE );
vFakePortExitCriticalSection_Expect();
/* Check task run state in critical section. */
vFakePortEnterCriticalSection_Expect();
vFakePortGetCoreID_ExpectAndReturn( 1 );
EXPECT_ASSERT_BREAK( vTaskSuspend( xTaskToSuspend ) );

@ -239,6 +239,10 @@ void test_coverage_vTaskSuspend_scheduler_running_false( void )
vListInsertEnd_ExpectAnyArgs();
vFakePortExitCriticalSection_Expect();
/* Enter critical section to check task run state. */
vFakePortEnterCriticalSection_Expect();
vFakePortExitCriticalSection_Expect();
/* API call. */
vTaskSuspend( &xTaskTCBs[ 0 ] );
@ -277,6 +281,10 @@ void test_coverage_vTaskSuspend_running_state_below_range( void )
vListInsertEnd_ExpectAnyArgs();
vFakePortExitCriticalSection_Expect();
/* Enter critical section to check task run state. */
vFakePortEnterCriticalSection_Expect();
vFakePortExitCriticalSection_Expect();
/* API call. */
vTaskSuspend( &xTaskTCBs[ 0 ] );
@ -314,6 +322,10 @@ void test_coverage_vTaskSuspend_running_state_above_range( void )
vListInsertEnd_ExpectAnyArgs();
vFakePortExitCriticalSection_Expect();
/* Enter critical section to check task run state. */
vFakePortEnterCriticalSection_Expect();
vFakePortExitCriticalSection_Expect();
/* API call. */
vTaskSuspend( &xTaskTCBs[ 0 ] );

Loading…
Cancel
Save