Skip to content

Commit

Permalink
fix(freertos/tasks): Updated the xTaskGetIdleTaskHandle Test (FreeRTO…
Browse files Browse the repository at this point in the history
…S#1314)

This commit updates the xTaskGetIdleTaskHandle unit test as per the idle
task naming logic.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
  • Loading branch information
sudeep-mohanty and aggarg authored Dec 19, 2024
1 parent dfb7b28 commit f430a10
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion FreeRTOS/Test/CMock/tasks/tasks_1_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -3607,12 +3607,22 @@ void test_xTaskGetIdleTaskHandle_success( void )
{
TaskHandle_t ret_idle_handle;
int ret;
BaseType_t xIdleNameLen;
BaseType_t xCopyLen;

start_scheduler();

/* The length of the idle task name is limited to the minimum of the length
* of configIDLE_TASK_NAME and configMAX_TASK_NAME_LEN - 2, keeping space
* for the core ID suffix and the null-terminator. */
xIdleNameLen = sizeof( configIDLE_TASK_NAME ) - 1;
xCopyLen = ( xIdleNameLen < configMAX_TASK_NAME_LEN - 2 ) ? xIdleNameLen : configMAX_TASK_NAME_LEN - 2;

/* Api Call */
ret_idle_handle = xTaskGetIdleTaskHandle();
ptcb = ret_idle_handle;
ret = strncmp( ptcb->pcTaskName, configIDLE_TASK_NAME, configMAX_TASK_NAME_LEN - 1 );
/* Verify the base name of the idle task. */
ret = strncmp( ptcb->pcTaskName, configIDLE_TASK_NAME, xCopyLen );
TEST_ASSERT_EQUAL( 0, ret );
}

Expand Down

0 comments on commit f430a10

Please sign in to comment.