From f23f425d9640f0812827b3598ef884b2e95696f9 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 11 Jul 2024 10:22:41 +0800 Subject: [PATCH] test(pthread): fixed memory leak in QEMU tests --- .../pthread_unity_tests/main/test_pthread_cond_var.c | 5 +++++ .../test_apps/pthread_unity_tests/main/test_pthread_rwlock.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cond_var.c b/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cond_var.c index d281e7203c..73b34efd7a 100644 --- a/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cond_var.c +++ b/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cond_var.c @@ -5,6 +5,8 @@ */ #include #include "unity.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" typedef struct { pthread_cond_t *cond; @@ -117,4 +119,7 @@ TEST_CASE("pthread cond wait", "[pthread]") TEST_ASSERT_EQUAL_INT(ESP_OK, pthread_cond_destroy(&cond)); TEST_ASSERT_EQUAL_INT(ESP_OK, pthread_mutex_destroy(&mutex)); + + // Wait a few ticks to allow freertos idle task to free up memory + vTaskDelay(10); } diff --git a/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_rwlock.c b/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_rwlock.c index b42f7c7af9..0f9349da30 100644 --- a/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_rwlock.c +++ b/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_rwlock.c @@ -179,6 +179,9 @@ TEST_CASE("wrlock reader waits", "[pthread][rwlock]") TEST_ASSERT_EQUAL_INT(pthread_rwlock_destroy(&rwlock), 0); vQueueDelete(wait_queue); + + // Wait a few ticks to allow freertos idle task to free up memory + vTaskDelay(10); } TEST_CASE("wrlock multiple readers wait", "[pthread][rwlock]")