diff --git a/FreeRTOS/Test/CMock/config/fake_port.h b/FreeRTOS/Test/CMock/config/fake_port.h index d86d181ffd..bd1da33df6 100644 --- a/FreeRTOS/Test/CMock/config/fake_port.h +++ b/FreeRTOS/Test/CMock/config/fake_port.h @@ -50,10 +50,10 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ); void portSetupTCB_CB( void * tcb ); -void vFakePortGetISRLock( void ); -void vFakePortReleaseISRLock( void ); -void vFakePortGetTaskLock( void ); -void vFakePortReleaseTaskLock( void ); +void vFakePortGetISRLock( BaseType_t xCoreID ); +void vFakePortReleaseISRLock( BaseType_t xCoreID ); +void vFakePortGetTaskLock( BaseType_t xCoreID ); +void vFakePortReleaseTaskLock( BaseType_t xCoreID ); void vFakePortAssertIfISR(); BaseType_t vFakePortCheckIfInISR( void ); diff --git a/FreeRTOS/Test/CMock/config/portmacro.h b/FreeRTOS/Test/CMock/config/portmacro.h index 8c2e4abdb1..e8e4308eb1 100644 --- a/FreeRTOS/Test/CMock/config/portmacro.h +++ b/FreeRTOS/Test/CMock/config/portmacro.h @@ -125,37 +125,37 @@ typedef unsigned long UBaseType_t; /*-----------------------------------------------------------*/ #define portSAVE_CONTEXT() -#define portYIELD() vFakePortYield() -#define portYIELD_WITHIN_API() vFakePortYieldWithinAPI() -#define portYIELD_FROM_ISR() vFakePortYieldFromISR() +#define portYIELD() vFakePortYield() +#define portYIELD_WITHIN_API() vFakePortYieldWithinAPI() +#define portYIELD_FROM_ISR() vFakePortYieldFromISR() /* Critical section handling. */ -#define portDISABLE_INTERRUPTS() vFakePortDisableInterrupts() -#define portENABLE_INTERRUPTS() vFakePortEnableInterrupts() +#define portDISABLE_INTERRUPTS() vFakePortDisableInterrupts() +#define portENABLE_INTERRUPTS() vFakePortEnableInterrupts() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) \ vFakePortClearInterruptMaskFromISR( x ) #define portSET_INTERRUPT_MASK_FROM_ISR() \ ulFakePortSetInterruptMaskFromISR() -#define portSET_INTERRUPT_MASK() ulFakePortSetInterruptMask() -#define portCLEAR_INTERRUPT_MASK( x ) vFakePortClearInterruptMask( x ) +#define portSET_INTERRUPT_MASK() ulFakePortSetInterruptMask() +#define portCLEAR_INTERRUPT_MASK( x ) vFakePortClearInterruptMask( x ) #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() \ vFakePortAssertIfInterruptPriorityInvalid() -#define portENTER_CRITICAL() vFakePortEnterCriticalSection() -#define portEXIT_CRITICAL() vFakePortExitCriticalSection() -#define portGET_ISR_LOCK() vFakePortGetISRLock() -#define portRELEASE_ISR_LOCK() vFakePortReleaseISRLock() -#define portGET_TASK_LOCK() vFakePortGetTaskLock() -#define portRELEASE_TASK_LOCK() vFakePortReleaseTaskLock() - -#define portCHECK_IF_IN_ISR() vFakePortCheckIfInISR() -#define portRESTORE_INTERRUPTS( x ) vFakePortRestoreInterrupts( x ) +#define portENTER_CRITICAL() vFakePortEnterCriticalSection() +#define portEXIT_CRITICAL() vFakePortExitCriticalSection() +#define portGET_ISR_LOCK( xCoreID ) vFakePortGetISRLock( xCoreID ) +#define portRELEASE_ISR_LOCK( xCoreID ) vFakePortReleaseISRLock( xCoreID ) +#define portGET_TASK_LOCK( xCoreID ) vFakePortGetTaskLock( xCoreID ) +#define portRELEASE_TASK_LOCK( xCoreID ) vFakePortReleaseTaskLock( xCoreID ) + +#define portCHECK_IF_IN_ISR() vFakePortCheckIfInISR() +#define portRESTORE_INTERRUPTS( x ) vFakePortRestoreInterrupts( x ) #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) \ vPortCurrentTaskDying( ( pvTaskToDelete ), ( pxPendYield ) ) -#define portSETUP_TCB( pxTCB ) portSetupTCB_CB( pxTCB ); -#define portASSERT_IF_IN_ISR() vFakePortAssertIfISR(); +#define portSETUP_TCB( pxTCB ) portSetupTCB_CB( pxTCB ); +#define portASSERT_IF_IN_ISR() vFakePortAssertIfISR(); -#define portGET_CORE_ID() vFakePortGetCoreID() -#define portYIELD_CORE( x ) vFakePortYieldCore( x ) +#define portGET_CORE_ID() vFakePortGetCoreID() +#define portYIELD_CORE( x ) vFakePortYieldCore( x ) #define portENTER_CRITICAL_FROM_ISR vFakePortEnterCriticalFromISR #define portEXIT_CRITICAL_FROM_ISR vFakePortExitCriticalFromISR 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 60729131b8..893c7f0297 100644 --- a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c +++ b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c @@ -311,8 +311,8 @@ void test_prvSelectHighestPriorityTask_assert_scheduler_running_false( void ) xSchedulerRunning = pdFALSE; /* causes the assert */ uxSchedulerSuspended = pdFALSE; - vFakePortGetTaskLock_Expect(); - vFakePortGetISRLock_Expect(); + vFakePortGetTaskLock_Expect( 1 ); + vFakePortGetISRLock_Expect( 1 ); EXPECT_ASSERT_BREAK( vTaskSwitchContext( 1 ) ); validate_and_clear_assertions(); @@ -344,8 +344,8 @@ void test_prvSelectHighestPriorityTask_assert_coreid_ne_runstate( void ) xSchedulerRunning = pdTRUE; uxSchedulerSuspended = pdFALSE; - vFakePortGetTaskLock_Expect(); - vFakePortGetISRLock_Expect(); + vFakePortGetTaskLock_Expect( 0 ); + vFakePortGetISRLock_Expect( 0 ); listIS_CONTAINED_WITHIN_ExpectAnyArgsAndReturn( pdFALSE ); listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdFALSE ); @@ -467,8 +467,8 @@ void test_vTaskSwitchContext_assert_nexting_count_ne_zero( void ) pxCurrentTCBs[ 1 ] = ¤tTCB; - vFakePortGetTaskLock_Expect(); - vFakePortGetISRLock_Expect(); + vFakePortGetTaskLock_Expect( 1 ); + vFakePortGetISRLock_Expect( 1 ); EXPECT_ASSERT_BREAK( vTaskSwitchContext( 1 ) ); @@ -576,9 +576,10 @@ void test_prvGetExpectedIdleTime_assert_nextUnblock_lt_xTickCount( void ) vFakePortAssertIfISR_Expect(); ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 ); - vFakePortGetTaskLock_Expect(); - vFakePortGetISRLock_Expect(); - vFakePortReleaseISRLock_Expect(); + vFakePortGetTaskLock_Expect( 0 ); + vFakePortGetCoreID_ExpectAndReturn( 0 ); + vFakePortGetISRLock_Expect( 0 ); + vFakePortReleaseISRLock_Expect( 0 ); vFakePortClearInterruptMask_Expect( 0 ); /* API Call */ diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c index 9849046287..2863a381a8 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c @@ -3328,7 +3328,7 @@ void test_coverage_xTaskResumeAll_task_in_pending_ready_list( void ) vFakePortExitCriticalSection_StubWithCallback( NULL ); /* Expectations. */ - vFakePortReleaseTaskLock_Expect(); + vFakePortReleaseTaskLock_Expect( 0 ); vFakePortExitCriticalSection_Expect(); /* API call. */ @@ -3398,7 +3398,7 @@ void test_coverage_xTaskResumeAll_task_in_pending_ready_list_uxpriority_lesser( vFakePortExitCriticalSection_StubWithCallback( NULL ); /* Expectations. */ - vFakePortReleaseTaskLock_Expect(); + vFakePortReleaseTaskLock_Expect( 0 ); vFakePortExitCriticalSection_Expect(); /* API call. */ 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 bd432aad69..c85c39add2 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 @@ -802,13 +802,14 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_1( void ) vFakePortAssertIfISR_Expect(); ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 ); - vFakePortGetTaskLock_Expect(); + vFakePortGetTaskLock_Expect( 0 ); /* prvCheckForRunStateChange */ vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortAssertIfISR_Expect(); /* End of prvCheckForRunStateChange */ - vFakePortGetISRLock_Expect(); - vFakePortReleaseISRLock_Expect(); + vFakePortGetCoreID_ExpectAndReturn( 0 ); + vFakePortGetISRLock_Expect( 0 ); + vFakePortReleaseISRLock_Expect( 0 ); vFakePortClearInterruptMask_Expect( 0 ); /* End of vTaskSuspendAll */ @@ -826,7 +827,7 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_1( void ) vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 0 ); - vFakePortReleaseTaskLock_Expect(); + vFakePortReleaseTaskLock_Expect( 0 ); vFakePortExitCriticalSection_Expect(); listCURRENT_LIST_LENGTH_ExpectAndThrow( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ), @@ -908,12 +909,13 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_2( void ) vFakePortAssertIfISR_Stub( port_assert_if_isr_cb ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 ); - vFakePortGetTaskLock_Expect(); + vFakePortGetTaskLock_Expect( 0 ); /* prvCheckForRunStateChange */ vFakePortGetCoreID_ExpectAndReturn( 0 ); /* End of prvCheckForRunStateChange */ - vFakePortGetISRLock_Expect(); - vFakePortReleaseISRLock_Expect(); + vFakePortGetCoreID_ExpectAndReturn( 0 ); + vFakePortGetISRLock_Expect( 0 ); + vFakePortReleaseISRLock_Expect( 0 ); vFakePortClearInterruptMask_Expect( 0 ); /* End of vTaskSuspendAll */ @@ -926,7 +928,7 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_2( void ) vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 0 ); - vFakePortReleaseTaskLock_Expect(); + vFakePortReleaseTaskLock_Expect( 0 ); vFakePortExitCriticalSection_Expect(); listCURRENT_LIST_LENGTH_ExpectAndThrow( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ), diff --git a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/covg_single_priority_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/covg_single_priority_no_timeslice_utest.c index c571e408cd..164b1ccc22 100644 --- a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/covg_single_priority_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/covg_single_priority_no_timeslice_utest.c @@ -143,10 +143,10 @@ void test_coverage_prvCheckForRunStateChange_first_time_critical_section( void ) /* Expection. */ vFakePortEnableInterrupts_StubWithCallback( prvPortEnableInterruptsCb ); - vFakePortReleaseISRLock_Expect(); - vFakePortReleaseTaskLock_Expect(); - vFakePortGetTaskLock_Expect(); - vFakePortGetISRLock_Expect(); + vFakePortReleaseISRLock_Expect( 0 ); + vFakePortReleaseTaskLock_Expect( 0 ); + vFakePortGetTaskLock_Expect( 0 ); + vFakePortGetISRLock_Expect( 0 ); /* API Call. */ prvCheckForRunStateChange(); @@ -192,10 +192,10 @@ void test_coverage_prvCheckForRunStateChange_first_time_suspend_scheduler( void /* Expection. */ vFakePortEnableInterrupts_StubWithCallback( prvPortEnableInterruptsCb ); - vFakePortReleaseTaskLock_Expect(); - vFakePortGetTaskLock_Expect(); - vFakePortGetISRLock_Expect(); - vFakePortReleaseISRLock_Expect(); + vFakePortReleaseTaskLock_Expect( 0 ); + vFakePortGetTaskLock_Expect( 0 ); + vFakePortGetISRLock_Expect( 0 ); + vFakePortReleaseISRLock_Expect( 0 ); /* API Call. */ prvCheckForRunStateChange(); @@ -234,6 +234,7 @@ void test_task_get_system_state( void ) /*Get System states */ int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS, NULL ); + TEST_ASSERT( ( no_of_tasks > 0 ) && ( no_of_tasks <= MAX_TASKS ) ); } @@ -257,6 +258,7 @@ void test_task_get_system_state_custom_time( void ) /*Get System states */ int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS, &ulTotalRunTime ); + TEST_ASSERT( ( no_of_tasks > 0 ) && ( no_of_tasks <= MAX_TASKS ) ); } @@ -279,6 +281,7 @@ void test_task_get_system_state_unavilable_task_space( void ) /*Get System states */ int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS - 1, NULL ); + TEST_ASSERT( ( no_of_tasks == 0 ) && ( no_of_tasks <= MAX_TASKS ) ); } diff --git a/FreeRTOS/Test/CMock/smp/smp_utest_common.c b/FreeRTOS/Test/CMock/smp/smp_utest_common.c index 33b1433e51..ecd90da5ea 100644 --- a/FreeRTOS/Test/CMock/smp/smp_utest_common.c +++ b/FreeRTOS/Test/CMock/smp/smp_utest_common.c @@ -241,7 +241,8 @@ unsigned int vFakePortGetCoreIDCallback( int cmock_num_calls ) return ( unsigned int ) xCurrentCoreId; } -void vFakePortGetISRLockCallback( int cmock_num_calls ) +void vFakePortGetISRLockCallback( BaseType_t xCoreID, + int cmock_num_calls ) { int i; @@ -250,25 +251,27 @@ void vFakePortGetISRLockCallback( int cmock_num_calls ) /* Ensure that no other core is in the critical section. */ for( i = 0; i < configNUMBER_OF_CORES; i++ ) { - if( i != xCurrentCoreId ) + if( i != xCoreID ) { TEST_ASSERT_MESSAGE( xIsrLockCount[ i ] == 0, "vFakePortGetISRLock xIsrLockCount[ i ] > 0" ); TEST_ASSERT_MESSAGE( xTaskLockCount[ i ] == 0, "vFakePortGetISRLock xTaskLockCount[ i ] > 0" ); } } - xIsrLockCount[ xCurrentCoreId ]++; + xIsrLockCount[ xCoreID ]++; } -void vFakePortReleaseISRLockCallback( int cmock_num_calls ) +void vFakePortReleaseISRLockCallback( BaseType_t xCoreID, + int cmock_num_calls ) { ( void ) cmock_num_calls; - TEST_ASSERT_MESSAGE( xIsrLockCount[ xCurrentCoreId ] > 0, "xIsrLockCount[ xCurrentCoreId ] <= 0" ); - xIsrLockCount[ xCurrentCoreId ]--; + TEST_ASSERT_MESSAGE( xIsrLockCount[ xCoreID ] > 0, "xIsrLockCount[ xCoreID ] <= 0" ); + xIsrLockCount[ xCoreID ]--; } -void vFakePortGetTaskLockCallback( int cmock_num_calls ) +void vFakePortGetTaskLockCallback( BaseType_t xCoreID, + int cmock_num_calls ) { int i; @@ -277,36 +280,38 @@ void vFakePortGetTaskLockCallback( int cmock_num_calls ) /* Ensure that no other core is in the critical section. */ for( i = 0; i < configNUMBER_OF_CORES; i++ ) { - if( i != xCurrentCoreId ) + if( i != xCoreID ) { TEST_ASSERT_MESSAGE( xIsrLockCount[ i ] == 0, "vFakePortGetTaskLock xIsrLockCount[ i ] > 0" ); TEST_ASSERT_MESSAGE( xTaskLockCount[ i ] == 0, "vFakePortGetTaskLock xTaskLockCount[ i ] > 0" ); } } - xTaskLockCount[ xCurrentCoreId ]++; + xTaskLockCount[ xCoreID ]++; } -void vFakePortReleaseTaskLockCallback( int cmock_num_calls ) +void vFakePortReleaseTaskLockCallback( BaseType_t xCoreID, + int cmock_num_calls ) { ( void ) cmock_num_calls; - TEST_ASSERT_MESSAGE( xTaskLockCount[ xCurrentCoreId ] > 0, "xTaskLockCount[ xCurrentCoreId ] <= 0" ); - xTaskLockCount[ xCurrentCoreId ]--; + TEST_ASSERT_MESSAGE( xTaskLockCount[ xCoreID ] > 0, "xTaskLockCount[ xCoreID ] <= 0" ); + xTaskLockCount[ xCoreID ]--; /* When releasing the ISR lock, check if any core is waiting to yield. */ - if( xTaskLockCount[ xCurrentCoreId ] == 0 ) + if( xTaskLockCount[ xCoreID ] == 0 ) { vYieldCores(); } } -void vFakePortReleaseTaskLockAsyncCallback( int cmock_num_calls ) +void vFakePortReleaseTaskLockAsyncCallback( BaseType_t xCoreID, + int cmock_num_calls ) { ( void ) cmock_num_calls; - TEST_ASSERT_MESSAGE( xTaskLockCount[ xCurrentCoreId ] > 0, "xTaskLockCount[ xCurrentCoreId ] <= 0" ); - xTaskLockCount[ xCurrentCoreId ]--; + TEST_ASSERT_MESSAGE( xTaskLockCount[ xCoreID ] > 0, "xTaskLockCount[ xCoreID ] <= 0" ); + xTaskLockCount[ xCoreID ]--; } portBASE_TYPE vFakePortEnterCriticalFromISRCallback( int cmock_num_calls ) diff --git a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c index 247fba5b86..529224ad3d 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c @@ -349,22 +349,22 @@ unsigned int vFakePortGetCoreID( void ) return 0; } -void vFakePortReleaseTaskLock( void ) +void vFakePortReleaseTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetTaskLock( void ) +void vFakePortGetTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetISRLock( void ) +void vFakePortGetISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortReleaseISRLock( void ) +void vFakePortReleaseISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } @@ -671,6 +671,7 @@ void test_xTaskCreateStatic_success( void ) ulStackDepth * sizeof( StackType_t ) ) ); StackType_t * pxTopOfStack = &( ptcb->pxStack[ ulStackDepth - ( uint32_t ) 1 ] ); + pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); @@ -1869,6 +1870,7 @@ void test_vTaskDelay_success_gt_0_yield_called( void ) task_handle = create_task(); ptcb = ( TCB_t * ) task_handle; TickType_t delay = 34; + /* Expectations */ /* prvAddCurrentTaskToDelayedList */ uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, 1 ); @@ -1891,6 +1893,7 @@ void test_vTaskDelay_success_gt_0_yield_not_called( void ) task_handle = create_task(); ptcb = ( TCB_t * ) task_handle; TickType_t delay = 34; + /* Expectations */ /* prvAddCurrentTaskToDelayedList */ uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdTRUE ); @@ -1937,6 +1940,7 @@ void test_vTaskDelay_success_gt_0_already_yielded( void ) pxCurrentTCB = task_handle; ptcb = ( TCB_t * ) task_handle; TickType_t delay = 34; + /* Expectations */ /* prvAddCurrentTaskToDelayedList */ uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdTRUE ); @@ -1981,6 +1985,7 @@ void test_eTaskGetState_success_current_tcb( void ) task_handle = create_task(); ptcb = ( TCB_t * ) task_handle; eTaskState ret_task_state; + /* no Expectations */ /* API Call */ @@ -2000,6 +2005,7 @@ void test_eTaskGetState_success_not_current_tcb_pending_ready( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, NULL ); @@ -2023,6 +2029,7 @@ void test_eTaskGetState_success_not_current_tcb_blocked_delayed( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, pxDelayedTaskList ); @@ -2046,6 +2053,7 @@ void test_eTaskGetState_success_not_current_tcb_blocked_overflow( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, pxOverflowDelayedTaskList ); @@ -2069,6 +2077,7 @@ void test_eTaskGetState_success_not_current_tcb_ready( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, &pxReadyTasksLists[ 0 ] ); @@ -2092,6 +2101,7 @@ void test_eTaskGetState_success_not_current_tcb_suspended( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, &xSuspendedTaskList ); @@ -2117,6 +2127,7 @@ void test_eTaskGetState_success_not_current_tcb_deleted( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, &xTasksWaitingTermination ); @@ -2140,6 +2151,7 @@ void test_eTaskGetState_success_not_current_tcb_deleted_not_found( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, NULL ); @@ -2169,6 +2181,7 @@ void test_eTaskGetState_success_not_current_tcb_wait_notif( void ) ptcb->ucNotifyState[ 0 ] = 1; /* taskWAITING_NOTIFICATION */ TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, &xSuspendedTaskList ); @@ -2194,6 +2207,7 @@ void test_eTaskGetState_success_not_current_tcb_blocked( void ) ptcb = ( TCB_t * ) task_handle; TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); eTaskState ret_task_state; + /* Expectations */ listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, &xSuspendedTaskList ); @@ -3655,6 +3669,7 @@ void test_xTaskGetApplicationTaskTag_null_tcb_current( void ) vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); TaskHookFunction_t hook_function; + hook_function = xTaskGetApplicationTaskTag( NULL ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); @@ -3668,6 +3683,7 @@ void test_xTaskGetApplicationTaskTag_tcb( void ) vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); TaskHookFunction_t hook_function; + hook_function = xTaskGetApplicationTaskTag( task_handle ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); @@ -3693,6 +3709,7 @@ void test_xTaskGetApplicationTaskTagFromISR_success( void ) vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); TaskHookFunction_t hook_function; + hook_function = xTaskGetApplicationTaskTagFromISR( task_handle ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); @@ -3708,6 +3725,7 @@ void test_xTaskGetApplicationTaskTagFromISR_null_handle( void ) vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); TaskHookFunction_t hook_function; + hook_function = xTaskGetApplicationTaskTagFromISR( NULL ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); @@ -4177,6 +4195,7 @@ void test_xTaskCheckForTimeOut_timeout( void ) time_out.xOverflowCount = xNumOfOverflows; time_out.xTimeOnEntering = 3; uint32_t expected = ( 1000 - ( xTickCount - time_out.xTimeOnEntering ) ); + /* API Call */ ret_check_timeout = xTaskCheckForTimeOut( &time_out, &ticks_to_wait ); diff --git a/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c index 1771ccb32f..e2544da2e0 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c @@ -410,22 +410,22 @@ unsigned int vFakePortGetCoreID( void ) return 0; } -void vFakePortReleaseTaskLock( void ) +void vFakePortReleaseTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetTaskLock( void ) +void vFakePortGetTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetISRLock( void ) +void vFakePortGetISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortReleaseISRLock( void ) +void vFakePortReleaseISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } diff --git a/FreeRTOS/Test/CMock/tasks/tasks_assert_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_assert_utest.c index aabc5461d3..218640f938 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_assert_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_assert_utest.c @@ -425,22 +425,22 @@ unsigned int vFakePortGetCoreID( void ) return 0; } -void vFakePortReleaseTaskLock( void ) +void vFakePortReleaseTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetTaskLock( void ) +void vFakePortGetTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetISRLock( void ) +void vFakePortGetISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortReleaseISRLock( void ) +void vFakePortReleaseISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } diff --git a/FreeRTOS/Test/CMock/tasks/tasks_freertos/tasks_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_freertos/tasks_utest.c index 820c4e0ad3..af0ae8aac3 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_freertos/tasks_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_freertos/tasks_utest.c @@ -290,22 +290,22 @@ unsigned int vFakePortGetCoreID( void ) return 0; } -void vFakePortReleaseTaskLock( void ) +void vFakePortReleaseTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetTaskLock( void ) +void vFakePortGetTaskLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortGetISRLock( void ) +void vFakePortGetISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); } -void vFakePortReleaseISRLock( void ) +void vFakePortReleaseISRLock( BaseType_t xCoreID ) { HOOK_DIAG(); }