Merge branch 'task/fix_flaky_freertos_psram_test_v5.5' into 'release/v5.5'

fix(freertos): Fix flaky PSRAM tests for freertos (v5.5)

See merge request espressif/esp-idf!46925
This commit is contained in:
Jiang Jiang Jian
2026-03-31 10:50:06 +08:00
3 changed files with 9 additions and 6 deletions
@@ -31,8 +31,8 @@ void setUp(void)
void tearDown(void)
{
// Add a short delay of 10ms to allow the idle task to free an remaining memory
vTaskDelay(pdMS_TO_TICKS(10));
// Add a short delay of 10 ticks to allow the idle task to free remaining memory.
vTaskDelay(10);
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
check_leak(before_free_8bit, after_free_8bit, "8BIT");
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -103,7 +103,6 @@ TEST_CASE("IDF additions: Task creation with SPIRAM memory caps and self deletio
for (int i = 0; i < TEST_NUM_TASKS; i++) {
// Create a task with caps
TEST_ASSERT_EQUAL(pdPASS, xTaskCreateWithCaps(task_with_caps_self_delete, "task", 4096, NULL, UNITY_FREERTOS_PRIORITY, &task_handle[i], MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
TEST_ASSERT_NOT_EQUAL(NULL, task_handle);
// Get the task's memory
TEST_ASSERT_EQUAL(pdTRUE, xTaskGetStaticBuffers(task_handle[i], &puxStackBuffer, &pxTaskBuffer));
}
@@ -112,7 +111,11 @@ TEST_CASE("IDF additions: Task creation with SPIRAM memory caps and self deletio
// Notify the task to delete itself
xTaskNotifyGive(task_handle[i]);
}
// Let the scheduler run the self-delete tasks.
vTaskDelay(1);
}
// Allow the last batch to be freed by the cleanup task in vTaskDeleteWithCaps().
vTaskDelay(50);
}
#endif /* CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM */
@@ -354,7 +357,7 @@ TEST_CASE("IDF additions: IDF tick hooks during scheduler suspension", "[freerto
/* Cleanup */
vTaskSuspend(suspend_task_handle[x]);
vTaskDelay(pdMS_TO_TICKS(10));
vTaskDelay(10);
vTaskDelete(suspend_task_handle[x]);
}
}
@@ -67,7 +67,7 @@ TEST_CASE("Test TLSP deletion callbacks", "[freertos]")
TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(tlsp_task, "tlsp_tsk", configMINIMAL_STACK_SIZE * 2, (void *)&tlsps[i], UNITY_FREERTOS_PRIORITY - 1, &tasks[i], i));
}
// Significant delay to let tasks run and delete themselves
vTaskDelay(pdMS_TO_TICKS(100));
vTaskDelay(100);
// Check the values of the TLSPs to see if the del cb have ran
for (int i = 0; i < CONFIG_FREERTOS_NUMBER_OF_CORES; i++) {