mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
Merge branch 'fix/freertos_suspen_resume_test_memory_leak' into 'master'
test(freertos): Fix race condition in suspend-resume tests Closes IDFCI-4849, IDFCI-6992, IDFCI-7148, IDFCI-7167, IDFCI-7192, IDFCI-7267, IDFCI-7269, IDFCI-7281, and IDFCI-7533 See merge request espressif/esp-idf!44395
This commit is contained in:
@@ -227,6 +227,12 @@ TEST_CASE("Test vTaskSuspendAll() and xTaskResumeAll() multicore", "[freertos]")
|
||||
for (int j = 0; j < 2; j++) {
|
||||
xSemaphoreTake(done_sem, portMAX_DELAY);
|
||||
}
|
||||
|
||||
// Suspend the test tasks in case they haven't suspended themselves yet
|
||||
vTaskSuspend(taskA_hdl);
|
||||
vTaskSuspend(taskB_hdl);
|
||||
vTaskDelay(10);
|
||||
|
||||
// Cleanup the tasks
|
||||
vTaskDelete(taskA_hdl);
|
||||
vTaskDelete(taskB_hdl);
|
||||
@@ -339,6 +345,8 @@ static void test_unblk_a1_task(void *arg)
|
||||
|
||||
// Cleanup A2 and interrupt
|
||||
deregister_intr_cb();
|
||||
vTaskSuspend(a2_task_hdl);
|
||||
vTaskDelay(10);
|
||||
vTaskDelete(a2_task_hdl);
|
||||
|
||||
// Indicate done and wait to be deleted
|
||||
@@ -391,6 +399,11 @@ TEST_CASE("Test vTaskSuspendAll allows scheduling on other cores", "[freertos]")
|
||||
for (int j = 0; j < 2; j++) {
|
||||
xSemaphoreTake(test_unblk_done_sem, portMAX_DELAY);
|
||||
}
|
||||
// Suspend the test tasks in case they haven't suspended themselves yet
|
||||
vTaskSuspend(a1_task_hdl);
|
||||
vTaskSuspend(b1_task_hdl);
|
||||
vTaskDelay(10);
|
||||
|
||||
// Cleanup tasks
|
||||
vTaskDelete(a1_task_hdl);
|
||||
vTaskDelete(b1_task_hdl);
|
||||
@@ -515,6 +528,10 @@ TEST_CASE("Test vTaskSuspendAll doesn't block unpinned tasks from being schedule
|
||||
for (int i = 0; i < 2; i++) {
|
||||
xSemaphoreTake(test_unpinned_sem, portMAX_DELAY);
|
||||
}
|
||||
// Suspend the test tasks in case they haven't suspended themselves yet
|
||||
vTaskSuspend(pinned_task_hdl);
|
||||
vTaskSuspend(unpinned_task_hdl);
|
||||
vTaskDelay(10);
|
||||
|
||||
// Cleanup
|
||||
vTaskDelete(pinned_task_hdl);
|
||||
@@ -643,8 +660,9 @@ TEST_CASE("Test xTaskResumeAll resumes pended tasks", "[freertos]")
|
||||
TEST_ASSERT_EQUAL(pdTRUE, xTaskCreatePinnedToCore(test_pended_running_task, "susp", 2048, (void *)xTaskGetCurrentTaskHandle(), UNITY_FREERTOS_PRIORITY + 1, &susp_tsk_hdl, i));
|
||||
// Wait for to be notified to test completion
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
// Add a short delay to allow the test_pended_running_task to go to suspend state
|
||||
vTaskDelay(1);
|
||||
// Suspend the test task in case it hasn't suspended itself yet
|
||||
vTaskSuspend(susp_tsk_hdl);
|
||||
vTaskDelay(10);
|
||||
vTaskDelete(susp_tsk_hdl);
|
||||
}
|
||||
// Add a short delay to allow the idle task to free any remaining task memory
|
||||
@@ -759,8 +777,12 @@ TEST_CASE("Test xTaskSuspendAll on all cores pends all tasks and xTaskResumeAll
|
||||
|
||||
// Cleanup
|
||||
for (int i = 0; i < TEST_PENDED_NUM_BLOCKED_TASKS; i++) {
|
||||
vTaskSuspend(blkd_tasks[i]);
|
||||
vTaskDelay(10);
|
||||
vTaskDelete(blkd_tasks[i]);
|
||||
}
|
||||
vTaskSuspend(susp_task);
|
||||
vTaskDelay(10);
|
||||
vTaskDelete(susp_task);
|
||||
vSemaphoreDelete(done_sem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user