From 3c5fbc769b5a42a9d6a89df9f12d6f19640fb9ca Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Tue, 6 Feb 2024 20:30:21 +0800 Subject: [PATCH] Update unit test to address vTaskDelete and vTaskSuspend change for SMP (#1178) * Update the unit test to address the problem task self void state change --- .../smp/config_assert/config_assert_utest.c | 12 ------------ ...multiple_priorities_no_timeslice_mock_utest.c | 16 ---------------- 2 files changed, 28 deletions(-) diff --git a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c index 58a524b1c..1b70c461c 100644 --- a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c +++ b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c @@ -395,10 +395,6 @@ void test_vTaskDelete_assert_scheduler_suspended_eq_1( void ) listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL ); vListInsertEnd_ExpectAnyArgs(); vPortCurrentTaskDying_ExpectAnyArgs(); - vFakePortExitCriticalSection_Expect(); - - /* Critical section for check task is running. */ - vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 1 ); EXPECT_ASSERT_BREAK( vTaskDelete( xTaskToDelete ) ); @@ -446,15 +442,7 @@ 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 ) ); diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c index 3fb5783ce..f6f59d73a 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c @@ -239,10 +239,6 @@ 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 ] ); @@ -281,10 +277,6 @@ 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 ] ); @@ -322,10 +314,6 @@ 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 ] ); @@ -545,10 +533,6 @@ void test_coverage_vTaskDelete_task_not_running( void ) vFakePortExitCriticalSection_Expect(); - /* Critical section for check task is running. */ - vFakePortEnterCriticalSection_Expect(); - vFakePortExitCriticalSection_Expect(); - /* API Call */ vTaskDelete( xTaskToDelete );