Update unit test for TASK and ISR lock macros (#1319)

This is needed for PR - https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/1212.
pull/1322/head
chinglee-iot 1 month ago committed by GitHub
parent 365a47921f
commit 2dcc47ecba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -50,10 +50,10 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
void portSetupTCB_CB( void * tcb ); void portSetupTCB_CB( void * tcb );
void vFakePortGetISRLock( void ); void vFakePortGetISRLock( BaseType_t xCoreID );
void vFakePortReleaseISRLock( void ); void vFakePortReleaseISRLock( BaseType_t xCoreID );
void vFakePortGetTaskLock( void ); void vFakePortGetTaskLock( BaseType_t xCoreID );
void vFakePortReleaseTaskLock( void ); void vFakePortReleaseTaskLock( BaseType_t xCoreID );
void vFakePortAssertIfISR(); void vFakePortAssertIfISR();
BaseType_t vFakePortCheckIfInISR( void ); BaseType_t vFakePortCheckIfInISR( void );

@ -125,37 +125,37 @@ typedef unsigned long UBaseType_t;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#define portSAVE_CONTEXT() #define portSAVE_CONTEXT()
#define portYIELD() vFakePortYield() #define portYIELD() vFakePortYield()
#define portYIELD_WITHIN_API() vFakePortYieldWithinAPI() #define portYIELD_WITHIN_API() vFakePortYieldWithinAPI()
#define portYIELD_FROM_ISR() vFakePortYieldFromISR() #define portYIELD_FROM_ISR() vFakePortYieldFromISR()
/* Critical section handling. */ /* Critical section handling. */
#define portDISABLE_INTERRUPTS() vFakePortDisableInterrupts() #define portDISABLE_INTERRUPTS() vFakePortDisableInterrupts()
#define portENABLE_INTERRUPTS() vFakePortEnableInterrupts() #define portENABLE_INTERRUPTS() vFakePortEnableInterrupts()
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) \ #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) \
vFakePortClearInterruptMaskFromISR( x ) vFakePortClearInterruptMaskFromISR( x )
#define portSET_INTERRUPT_MASK_FROM_ISR() \ #define portSET_INTERRUPT_MASK_FROM_ISR() \
ulFakePortSetInterruptMaskFromISR() ulFakePortSetInterruptMaskFromISR()
#define portSET_INTERRUPT_MASK() ulFakePortSetInterruptMask() #define portSET_INTERRUPT_MASK() ulFakePortSetInterruptMask()
#define portCLEAR_INTERRUPT_MASK( x ) vFakePortClearInterruptMask( x ) #define portCLEAR_INTERRUPT_MASK( x ) vFakePortClearInterruptMask( x )
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() \ #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() \
vFakePortAssertIfInterruptPriorityInvalid() vFakePortAssertIfInterruptPriorityInvalid()
#define portENTER_CRITICAL() vFakePortEnterCriticalSection() #define portENTER_CRITICAL() vFakePortEnterCriticalSection()
#define portEXIT_CRITICAL() vFakePortExitCriticalSection() #define portEXIT_CRITICAL() vFakePortExitCriticalSection()
#define portGET_ISR_LOCK() vFakePortGetISRLock() #define portGET_ISR_LOCK( xCoreID ) vFakePortGetISRLock( xCoreID )
#define portRELEASE_ISR_LOCK() vFakePortReleaseISRLock() #define portRELEASE_ISR_LOCK( xCoreID ) vFakePortReleaseISRLock( xCoreID )
#define portGET_TASK_LOCK() vFakePortGetTaskLock() #define portGET_TASK_LOCK( xCoreID ) vFakePortGetTaskLock( xCoreID )
#define portRELEASE_TASK_LOCK() vFakePortReleaseTaskLock() #define portRELEASE_TASK_LOCK( xCoreID ) vFakePortReleaseTaskLock( xCoreID )
#define portCHECK_IF_IN_ISR() vFakePortCheckIfInISR() #define portCHECK_IF_IN_ISR() vFakePortCheckIfInISR()
#define portRESTORE_INTERRUPTS( x ) vFakePortRestoreInterrupts( x ) #define portRESTORE_INTERRUPTS( x ) vFakePortRestoreInterrupts( x )
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) \ #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) \
vPortCurrentTaskDying( ( pvTaskToDelete ), ( pxPendYield ) ) vPortCurrentTaskDying( ( pvTaskToDelete ), ( pxPendYield ) )
#define portSETUP_TCB( pxTCB ) portSetupTCB_CB( pxTCB ); #define portSETUP_TCB( pxTCB ) portSetupTCB_CB( pxTCB );
#define portASSERT_IF_IN_ISR() vFakePortAssertIfISR(); #define portASSERT_IF_IN_ISR() vFakePortAssertIfISR();
#define portGET_CORE_ID() vFakePortGetCoreID() #define portGET_CORE_ID() vFakePortGetCoreID()
#define portYIELD_CORE( x ) vFakePortYieldCore( x ) #define portYIELD_CORE( x ) vFakePortYieldCore( x )
#define portENTER_CRITICAL_FROM_ISR vFakePortEnterCriticalFromISR #define portENTER_CRITICAL_FROM_ISR vFakePortEnterCriticalFromISR
#define portEXIT_CRITICAL_FROM_ISR vFakePortExitCriticalFromISR #define portEXIT_CRITICAL_FROM_ISR vFakePortExitCriticalFromISR

@ -311,8 +311,8 @@ void test_prvSelectHighestPriorityTask_assert_scheduler_running_false( void )
xSchedulerRunning = pdFALSE; /* causes the assert */ xSchedulerRunning = pdFALSE; /* causes the assert */
uxSchedulerSuspended = pdFALSE; uxSchedulerSuspended = pdFALSE;
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 1 );
vFakePortGetISRLock_Expect(); vFakePortGetISRLock_Expect( 1 );
EXPECT_ASSERT_BREAK( vTaskSwitchContext( 1 ) ); EXPECT_ASSERT_BREAK( vTaskSwitchContext( 1 ) );
validate_and_clear_assertions(); validate_and_clear_assertions();
@ -344,8 +344,8 @@ void test_prvSelectHighestPriorityTask_assert_coreid_ne_runstate( void )
xSchedulerRunning = pdTRUE; xSchedulerRunning = pdTRUE;
uxSchedulerSuspended = pdFALSE; uxSchedulerSuspended = pdFALSE;
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 0 );
vFakePortGetISRLock_Expect(); vFakePortGetISRLock_Expect( 0 );
listIS_CONTAINED_WITHIN_ExpectAnyArgsAndReturn( pdFALSE ); listIS_CONTAINED_WITHIN_ExpectAnyArgsAndReturn( pdFALSE );
listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdFALSE ); listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdFALSE );
@ -467,8 +467,8 @@ void test_vTaskSwitchContext_assert_nexting_count_ne_zero( void )
pxCurrentTCBs[ 1 ] = &currentTCB; pxCurrentTCBs[ 1 ] = &currentTCB;
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 1 );
vFakePortGetISRLock_Expect(); vFakePortGetISRLock_Expect( 1 );
EXPECT_ASSERT_BREAK( vTaskSwitchContext( 1 ) ); EXPECT_ASSERT_BREAK( vTaskSwitchContext( 1 ) );
@ -576,9 +576,10 @@ void test_prvGetExpectedIdleTime_assert_nextUnblock_lt_xTickCount( void )
vFakePortAssertIfISR_Expect(); vFakePortAssertIfISR_Expect();
ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 );
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 0 );
vFakePortGetISRLock_Expect(); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortReleaseISRLock_Expect(); vFakePortGetISRLock_Expect( 0 );
vFakePortReleaseISRLock_Expect( 0 );
vFakePortClearInterruptMask_Expect( 0 ); vFakePortClearInterruptMask_Expect( 0 );
/* API Call */ /* API Call */

@ -3328,7 +3328,7 @@ void test_coverage_xTaskResumeAll_task_in_pending_ready_list( void )
vFakePortExitCriticalSection_StubWithCallback( NULL ); vFakePortExitCriticalSection_StubWithCallback( NULL );
/* Expectations. */ /* Expectations. */
vFakePortReleaseTaskLock_Expect(); vFakePortReleaseTaskLock_Expect( 0 );
vFakePortExitCriticalSection_Expect(); vFakePortExitCriticalSection_Expect();
/* API call. */ /* API call. */
@ -3398,7 +3398,7 @@ void test_coverage_xTaskResumeAll_task_in_pending_ready_list_uxpriority_lesser(
vFakePortExitCriticalSection_StubWithCallback( NULL ); vFakePortExitCriticalSection_StubWithCallback( NULL );
/* Expectations. */ /* Expectations. */
vFakePortReleaseTaskLock_Expect(); vFakePortReleaseTaskLock_Expect( 0 );
vFakePortExitCriticalSection_Expect(); vFakePortExitCriticalSection_Expect();
/* API call. */ /* API call. */

@ -802,13 +802,14 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_1( void )
vFakePortAssertIfISR_Expect(); vFakePortAssertIfISR_Expect();
ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 );
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 0 );
/* prvCheckForRunStateChange */ /* prvCheckForRunStateChange */
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortAssertIfISR_Expect(); vFakePortAssertIfISR_Expect();
/* End of prvCheckForRunStateChange */ /* End of prvCheckForRunStateChange */
vFakePortGetISRLock_Expect(); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortReleaseISRLock_Expect(); vFakePortGetISRLock_Expect( 0 );
vFakePortReleaseISRLock_Expect( 0 );
vFakePortClearInterruptMask_Expect( 0 ); vFakePortClearInterruptMask_Expect( 0 );
/* End of vTaskSuspendAll */ /* End of vTaskSuspendAll */
@ -826,7 +827,7 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_1( void )
vFakePortEnterCriticalSection_Expect(); vFakePortEnterCriticalSection_Expect();
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortReleaseTaskLock_Expect(); vFakePortReleaseTaskLock_Expect( 0 );
vFakePortExitCriticalSection_Expect(); vFakePortExitCriticalSection_Expect();
listCURRENT_LIST_LENGTH_ExpectAndThrow( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ), 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 ); vFakePortAssertIfISR_Stub( port_assert_if_isr_cb );
ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 );
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 0 );
/* prvCheckForRunStateChange */ /* prvCheckForRunStateChange */
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
/* End of prvCheckForRunStateChange */ /* End of prvCheckForRunStateChange */
vFakePortGetISRLock_Expect(); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortReleaseISRLock_Expect(); vFakePortGetISRLock_Expect( 0 );
vFakePortReleaseISRLock_Expect( 0 );
vFakePortClearInterruptMask_Expect( 0 ); vFakePortClearInterruptMask_Expect( 0 );
/* End of vTaskSuspendAll */ /* End of vTaskSuspendAll */
@ -926,7 +928,7 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_2( void )
vFakePortEnterCriticalSection_Expect(); vFakePortEnterCriticalSection_Expect();
vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 );
vFakePortReleaseTaskLock_Expect(); vFakePortReleaseTaskLock_Expect( 0 );
vFakePortExitCriticalSection_Expect(); vFakePortExitCriticalSection_Expect();
listCURRENT_LIST_LENGTH_ExpectAndThrow( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ), listCURRENT_LIST_LENGTH_ExpectAndThrow( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ),

@ -143,10 +143,10 @@ void test_coverage_prvCheckForRunStateChange_first_time_critical_section( void )
/* Expection. */ /* Expection. */
vFakePortEnableInterrupts_StubWithCallback( prvPortEnableInterruptsCb ); vFakePortEnableInterrupts_StubWithCallback( prvPortEnableInterruptsCb );
vFakePortReleaseISRLock_Expect(); vFakePortReleaseISRLock_Expect( 0 );
vFakePortReleaseTaskLock_Expect(); vFakePortReleaseTaskLock_Expect( 0 );
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 0 );
vFakePortGetISRLock_Expect(); vFakePortGetISRLock_Expect( 0 );
/* API Call. */ /* API Call. */
prvCheckForRunStateChange(); prvCheckForRunStateChange();
@ -192,10 +192,10 @@ void test_coverage_prvCheckForRunStateChange_first_time_suspend_scheduler( void
/* Expection. */ /* Expection. */
vFakePortEnableInterrupts_StubWithCallback( prvPortEnableInterruptsCb ); vFakePortEnableInterrupts_StubWithCallback( prvPortEnableInterruptsCb );
vFakePortReleaseTaskLock_Expect(); vFakePortReleaseTaskLock_Expect( 0 );
vFakePortGetTaskLock_Expect(); vFakePortGetTaskLock_Expect( 0 );
vFakePortGetISRLock_Expect(); vFakePortGetISRLock_Expect( 0 );
vFakePortReleaseISRLock_Expect(); vFakePortReleaseISRLock_Expect( 0 );
/* API Call. */ /* API Call. */
prvCheckForRunStateChange(); prvCheckForRunStateChange();
@ -234,6 +234,7 @@ void test_task_get_system_state( void )
/*Get System states */ /*Get System states */
int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS, NULL ); int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS, NULL );
TEST_ASSERT( ( no_of_tasks > 0 ) && ( no_of_tasks <= MAX_TASKS ) ); 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 */ /*Get System states */
int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS, &ulTotalRunTime ); int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS, &ulTotalRunTime );
TEST_ASSERT( ( no_of_tasks > 0 ) && ( no_of_tasks <= MAX_TASKS ) ); 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 */ /*Get System states */
int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS - 1, NULL ); int no_of_tasks = uxTaskGetSystemState( tsk_status_array, MAX_TASKS - 1, NULL );
TEST_ASSERT( ( no_of_tasks == 0 ) && ( no_of_tasks <= MAX_TASKS ) ); TEST_ASSERT( ( no_of_tasks == 0 ) && ( no_of_tasks <= MAX_TASKS ) );
} }

@ -241,7 +241,8 @@ unsigned int vFakePortGetCoreIDCallback( int cmock_num_calls )
return ( unsigned int ) xCurrentCoreId; return ( unsigned int ) xCurrentCoreId;
} }
void vFakePortGetISRLockCallback( int cmock_num_calls ) void vFakePortGetISRLockCallback( BaseType_t xCoreID,
int cmock_num_calls )
{ {
int i; int i;
@ -250,25 +251,27 @@ void vFakePortGetISRLockCallback( int cmock_num_calls )
/* Ensure that no other core is in the critical section. */ /* Ensure that no other core is in the critical section. */
for( i = 0; i < configNUMBER_OF_CORES; i++ ) 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( xIsrLockCount[ i ] == 0, "vFakePortGetISRLock xIsrLockCount[ i ] > 0" );
TEST_ASSERT_MESSAGE( xTaskLockCount[ i ] == 0, "vFakePortGetISRLock xTaskLockCount[ 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; ( void ) cmock_num_calls;
TEST_ASSERT_MESSAGE( xIsrLockCount[ xCurrentCoreId ] > 0, "xIsrLockCount[ xCurrentCoreId ] <= 0" ); TEST_ASSERT_MESSAGE( xIsrLockCount[ xCoreID ] > 0, "xIsrLockCount[ xCoreID ] <= 0" );
xIsrLockCount[ xCurrentCoreId ]--; xIsrLockCount[ xCoreID ]--;
} }
void vFakePortGetTaskLockCallback( int cmock_num_calls ) void vFakePortGetTaskLockCallback( BaseType_t xCoreID,
int cmock_num_calls )
{ {
int i; int i;
@ -277,36 +280,38 @@ void vFakePortGetTaskLockCallback( int cmock_num_calls )
/* Ensure that no other core is in the critical section. */ /* Ensure that no other core is in the critical section. */
for( i = 0; i < configNUMBER_OF_CORES; i++ ) 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( xIsrLockCount[ i ] == 0, "vFakePortGetTaskLock xIsrLockCount[ i ] > 0" );
TEST_ASSERT_MESSAGE( xTaskLockCount[ i ] == 0, "vFakePortGetTaskLock xTaskLockCount[ 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; ( void ) cmock_num_calls;
TEST_ASSERT_MESSAGE( xTaskLockCount[ xCurrentCoreId ] > 0, "xTaskLockCount[ xCurrentCoreId ] <= 0" ); TEST_ASSERT_MESSAGE( xTaskLockCount[ xCoreID ] > 0, "xTaskLockCount[ xCoreID ] <= 0" );
xTaskLockCount[ xCurrentCoreId ]--; xTaskLockCount[ xCoreID ]--;
/* When releasing the ISR lock, check if any core is waiting to yield. */ /* When releasing the ISR lock, check if any core is waiting to yield. */
if( xTaskLockCount[ xCurrentCoreId ] == 0 ) if( xTaskLockCount[ xCoreID ] == 0 )
{ {
vYieldCores(); vYieldCores();
} }
} }
void vFakePortReleaseTaskLockAsyncCallback( int cmock_num_calls ) void vFakePortReleaseTaskLockAsyncCallback( BaseType_t xCoreID,
int cmock_num_calls )
{ {
( void ) cmock_num_calls; ( void ) cmock_num_calls;
TEST_ASSERT_MESSAGE( xTaskLockCount[ xCurrentCoreId ] > 0, "xTaskLockCount[ xCurrentCoreId ] <= 0" ); TEST_ASSERT_MESSAGE( xTaskLockCount[ xCoreID ] > 0, "xTaskLockCount[ xCoreID ] <= 0" );
xTaskLockCount[ xCurrentCoreId ]--; xTaskLockCount[ xCoreID ]--;
} }
portBASE_TYPE vFakePortEnterCriticalFromISRCallback( int cmock_num_calls ) portBASE_TYPE vFakePortEnterCriticalFromISRCallback( int cmock_num_calls )

@ -349,22 +349,22 @@ unsigned int vFakePortGetCoreID( void )
return 0; return 0;
} }
void vFakePortReleaseTaskLock( void ) void vFakePortReleaseTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetTaskLock( void ) void vFakePortGetTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetISRLock( void ) void vFakePortGetISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortReleaseISRLock( void ) void vFakePortReleaseISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
@ -671,6 +671,7 @@ void test_xTaskCreateStatic_success( void )
ulStackDepth * sizeof( StackType_t ) ) ); ulStackDepth * sizeof( StackType_t ) ) );
StackType_t * pxTopOfStack = &( ptcb->pxStack[ ulStackDepth - ( uint32_t ) 1 ] ); StackType_t * pxTopOfStack = &( ptcb->pxStack[ ulStackDepth - ( uint32_t ) 1 ] );
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack )
& ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
@ -1869,6 +1870,7 @@ void test_vTaskDelay_success_gt_0_yield_called( void )
task_handle = create_task(); task_handle = create_task();
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TickType_t delay = 34; TickType_t delay = 34;
/* Expectations */ /* Expectations */
/* prvAddCurrentTaskToDelayedList */ /* prvAddCurrentTaskToDelayedList */
uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, 1 ); uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, 1 );
@ -1891,6 +1893,7 @@ void test_vTaskDelay_success_gt_0_yield_not_called( void )
task_handle = create_task(); task_handle = create_task();
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TickType_t delay = 34; TickType_t delay = 34;
/* Expectations */ /* Expectations */
/* prvAddCurrentTaskToDelayedList */ /* prvAddCurrentTaskToDelayedList */
uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdTRUE ); uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdTRUE );
@ -1937,6 +1940,7 @@ void test_vTaskDelay_success_gt_0_already_yielded( void )
pxCurrentTCB = task_handle; pxCurrentTCB = task_handle;
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TickType_t delay = 34; TickType_t delay = 34;
/* Expectations */ /* Expectations */
/* prvAddCurrentTaskToDelayedList */ /* prvAddCurrentTaskToDelayedList */
uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdTRUE ); uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdTRUE );
@ -1981,6 +1985,7 @@ void test_eTaskGetState_success_current_tcb( void )
task_handle = create_task(); task_handle = create_task();
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
eTaskState ret_task_state; eTaskState ret_task_state;
/* no Expectations */ /* no Expectations */
/* API Call */ /* API Call */
@ -2000,6 +2005,7 @@ void test_eTaskGetState_success_not_current_tcb_pending_ready( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
NULL ); NULL );
@ -2023,6 +2029,7 @@ void test_eTaskGetState_success_not_current_tcb_blocked_delayed( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
pxDelayedTaskList ); pxDelayedTaskList );
@ -2046,6 +2053,7 @@ void test_eTaskGetState_success_not_current_tcb_blocked_overflow( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
pxOverflowDelayedTaskList ); pxOverflowDelayedTaskList );
@ -2069,6 +2077,7 @@ void test_eTaskGetState_success_not_current_tcb_ready( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
&pxReadyTasksLists[ 0 ] ); &pxReadyTasksLists[ 0 ] );
@ -2092,6 +2101,7 @@ void test_eTaskGetState_success_not_current_tcb_suspended( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
&xSuspendedTaskList ); &xSuspendedTaskList );
@ -2117,6 +2127,7 @@ void test_eTaskGetState_success_not_current_tcb_deleted( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
&xTasksWaitingTermination ); &xTasksWaitingTermination );
@ -2140,6 +2151,7 @@ void test_eTaskGetState_success_not_current_tcb_deleted_not_found( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
NULL ); NULL );
@ -2169,6 +2181,7 @@ void test_eTaskGetState_success_not_current_tcb_wait_notif( void )
ptcb->ucNotifyState[ 0 ] = 1; /* taskWAITING_NOTIFICATION */ ptcb->ucNotifyState[ 0 ] = 1; /* taskWAITING_NOTIFICATION */
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
&xSuspendedTaskList ); &xSuspendedTaskList );
@ -2194,6 +2207,7 @@ void test_eTaskGetState_success_not_current_tcb_blocked( void )
ptcb = ( TCB_t * ) task_handle; ptcb = ( TCB_t * ) task_handle;
TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb ); TEST_ASSERT_NOT_EQUAL( pxCurrentTCB, ptcb );
eTaskState ret_task_state; eTaskState ret_task_state;
/* Expectations */ /* Expectations */
listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem, listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xStateListItem,
&xSuspendedTaskList ); &xSuspendedTaskList );
@ -3655,6 +3669,7 @@ void test_xTaskGetApplicationTaskTag_null_tcb_current( void )
vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); vTaskSetApplicationTaskTag( task_handle, pxHookFunction );
TaskHookFunction_t hook_function; TaskHookFunction_t hook_function;
hook_function = xTaskGetApplicationTaskTag( NULL ); hook_function = xTaskGetApplicationTaskTag( NULL );
TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function );
@ -3668,6 +3683,7 @@ void test_xTaskGetApplicationTaskTag_tcb( void )
vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); vTaskSetApplicationTaskTag( task_handle, pxHookFunction );
TaskHookFunction_t hook_function; TaskHookFunction_t hook_function;
hook_function = xTaskGetApplicationTaskTag( task_handle ); hook_function = xTaskGetApplicationTaskTag( task_handle );
TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function );
@ -3693,6 +3709,7 @@ void test_xTaskGetApplicationTaskTagFromISR_success( void )
vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); vTaskSetApplicationTaskTag( task_handle, pxHookFunction );
TaskHookFunction_t hook_function; TaskHookFunction_t hook_function;
hook_function = xTaskGetApplicationTaskTagFromISR( task_handle ); hook_function = xTaskGetApplicationTaskTagFromISR( task_handle );
TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function );
@ -3708,6 +3725,7 @@ void test_xTaskGetApplicationTaskTagFromISR_null_handle( void )
vTaskSetApplicationTaskTag( task_handle, pxHookFunction ); vTaskSetApplicationTaskTag( task_handle, pxHookFunction );
TaskHookFunction_t hook_function; TaskHookFunction_t hook_function;
hook_function = xTaskGetApplicationTaskTagFromISR( NULL ); hook_function = xTaskGetApplicationTaskTagFromISR( NULL );
TEST_ASSERT_EQUAL( &pxHookFunction, hook_function ); TEST_ASSERT_EQUAL( &pxHookFunction, hook_function );
@ -4177,6 +4195,7 @@ void test_xTaskCheckForTimeOut_timeout( void )
time_out.xOverflowCount = xNumOfOverflows; time_out.xOverflowCount = xNumOfOverflows;
time_out.xTimeOnEntering = 3; time_out.xTimeOnEntering = 3;
uint32_t expected = ( 1000 - ( xTickCount - time_out.xTimeOnEntering ) ); uint32_t expected = ( 1000 - ( xTickCount - time_out.xTimeOnEntering ) );
/* API Call */ /* API Call */
ret_check_timeout = xTaskCheckForTimeOut( &time_out, ret_check_timeout = xTaskCheckForTimeOut( &time_out,
&ticks_to_wait ); &ticks_to_wait );

@ -410,22 +410,22 @@ unsigned int vFakePortGetCoreID( void )
return 0; return 0;
} }
void vFakePortReleaseTaskLock( void ) void vFakePortReleaseTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetTaskLock( void ) void vFakePortGetTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetISRLock( void ) void vFakePortGetISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortReleaseISRLock( void ) void vFakePortReleaseISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }

@ -425,22 +425,22 @@ unsigned int vFakePortGetCoreID( void )
return 0; return 0;
} }
void vFakePortReleaseTaskLock( void ) void vFakePortReleaseTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetTaskLock( void ) void vFakePortGetTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetISRLock( void ) void vFakePortGetISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortReleaseISRLock( void ) void vFakePortReleaseISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }

@ -290,22 +290,22 @@ unsigned int vFakePortGetCoreID( void )
return 0; return 0;
} }
void vFakePortReleaseTaskLock( void ) void vFakePortReleaseTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetTaskLock( void ) void vFakePortGetTaskLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortGetISRLock( void ) void vFakePortGetISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }
void vFakePortReleaseISRLock( void ) void vFakePortReleaseISRLock( BaseType_t xCoreID )
{ {
HOOK_DIAG(); HOOK_DIAG();
} }

Loading…
Cancel
Save