mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-16 17:57:44 -04:00
Add unit test for FreeRTOS SMP (#1047)
* Add unit test for FreeRTOS SMP to verify SMP scheduler logic in tasks.c which is enclosed by `configNUMBER_OF_CORES > 1`. --------- Co-authored-by: Joshua Zarr <joshzarr@amazon.com> Co-authored-by: Anubhav Rawal <rawalexe@amazon.com> Co-authored-by: Alfred Gedeon <alfred2g@hotmail.com> Co-authored-by: Adam Scislowicz <adamds@amazon.com> Co-authored-by: jannusi <121577776+jannusi@users.noreply.github.com> Co-authored-by: Krishna Vamsi Tallapaneni <124737189+vamsitas@users.noreply.github.com> Co-authored-by: Kody Stribrny <kstribrn@amazon.com> Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com>
This commit is contained in:
parent
1114e8f39b
commit
e7d39763db
64 changed files with 25145 additions and 71 deletions
|
@ -45,6 +45,18 @@ static QueueHandle_t xQueueHandleStatic;
|
|||
|
||||
/* ========================== CALLBACK FUNCTIONS =========================== */
|
||||
|
||||
/**
|
||||
* @brief Callback for vTaskYieldTaskWithinAPI used by tests for yield counts
|
||||
*
|
||||
* NumCalls is checked in the test assert.
|
||||
*/
|
||||
static void vTaskYieldWithinAPI_Callback( int NumCalls )
|
||||
{
|
||||
( void ) NumCalls;
|
||||
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
|
||||
/* ============================= Unity Fixtures ============================= */
|
||||
|
||||
void setUp( void )
|
||||
|
@ -82,6 +94,8 @@ static BaseType_t xQueueSend_locked_xTaskCheckForTimeOutCB( TimeOut_t * const px
|
|||
{
|
||||
BaseType_t xReturnValue = td_task_xTaskCheckForTimeOutStub( pxTimeOut, pxTicksToWait, cmock_num_calls );
|
||||
|
||||
vTaskYieldWithinAPI_Stub( vTaskYieldWithinAPI_Callback );
|
||||
|
||||
if( cmock_num_calls == NUM_CALLS_TO_INTERCEPT )
|
||||
{
|
||||
uint32_t checkVal = INVALID_UINT32;
|
||||
|
@ -138,6 +152,8 @@ static BaseType_t xQueueSend_xTaskResumeAllCallback( int cmock_num_calls )
|
|||
{
|
||||
BaseType_t xReturnValue = td_task_xTaskResumeAllStub( cmock_num_calls );
|
||||
|
||||
vTaskYieldWithinAPI_Stub( vTaskYieldWithinAPI_Callback );
|
||||
|
||||
/* If td_task_xTaskResumeAllStub returns pdTRUE, a higher priority task is pending
|
||||
* Send from an ISR to block */
|
||||
if( pdTRUE == xReturnValue )
|
||||
|
@ -171,6 +187,7 @@ void test_macro_xQueueSend_blocking_fail_locked_high_prio_pending( void )
|
|||
xTaskCheckForTimeOut_Stub( &xQueueSend_locked_xTaskCheckForTimeOutCB );
|
||||
xTaskResumeAll_Stub( &xQueueSend_xTaskResumeAllCallback );
|
||||
uxTaskGetNumberOfTasks_IgnoreAndReturn( 1 );
|
||||
vTaskYieldWithinAPI_Stub( vTaskYieldWithinAPI_Callback );
|
||||
|
||||
/* this task is lower priority than the pending task */
|
||||
td_task_setFakeTaskPriority( DEFAULT_PRIORITY + 1 );
|
||||
|
@ -256,6 +273,7 @@ void test_macro_xQueueSend_blocking_suspended_assert( void )
|
|||
uint32_t testVal = getNextMonotonicTestValue();
|
||||
|
||||
fakeAssertExpectFail();
|
||||
vTaskYieldWithinAPI_Stub( vTaskYieldWithinAPI_Callback );
|
||||
|
||||
td_task_setSchedulerState( taskSCHEDULER_SUSPENDED );
|
||||
|
||||
|
@ -282,6 +300,8 @@ void test_macro_xQueueSend_blocking_timeout( void )
|
|||
|
||||
uint32_t testVal = getNextMonotonicTestValue();
|
||||
|
||||
vTaskYieldWithinAPI_Stub( vTaskYieldWithinAPI_Callback );
|
||||
|
||||
/* Fill up the queue */
|
||||
TEST_ASSERT_EQUAL( pdTRUE, xQueueSend( xQueue, &testVal, 0 ) );
|
||||
|
||||
|
@ -314,6 +334,8 @@ void test_macro_xQueueSend_blocking_locked( void )
|
|||
|
||||
uint32_t testVal1 = getNextMonotonicTestValue();
|
||||
|
||||
vTaskYieldWithinAPI_Stub( vTaskYieldWithinAPI_Callback );
|
||||
|
||||
/* Fill the queue */
|
||||
TEST_ASSERT_EQUAL( pdTRUE, xQueueSend( xQueue, &testVal1, TICKS_TO_WAIT ) );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue