From 7627a12045059c1503573c6dfb147b18551991ac Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Tue, 13 Dec 2022 21:42:05 +0100 Subject: [PATCH] pthread: enable qemu tests --- .../pthread_unity_tests/main/test_app_main.c | 4 ++++ .../pthread_unity_tests/main/test_pthread_cxx.cpp | 3 ++- .../pytest_pthread_unity_tests.py | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/components/pthread/test_apps/pthread_unity_tests/main/test_app_main.c b/components/pthread/test_apps/pthread_unity_tests/main/test_app_main.c index 80036e7b9d..5ef64d0c35 100644 --- a/components/pthread/test_apps/pthread_unity_tests/main/test_app_main.c +++ b/components/pthread/test_apps/pthread_unity_tests/main/test_app_main.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" #include "unity.h" #include "unity_test_runner.h" #include "esp_heap_caps.h" @@ -32,6 +34,8 @@ void setUp(void) void tearDown(void) { + // Add a short delay of 100ms to allow the idle task to free an remaining memory + vTaskDelay(pdMS_TO_TICKS(100)); 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"); diff --git a/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cxx.cpp b/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cxx.cpp index 27dabd5e00..58e33f87ed 100644 --- a/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cxx.cpp +++ b/components/pthread/test_apps/pthread_unity_tests/main/test_pthread_cxx.cpp @@ -72,7 +72,8 @@ static void thread_main() } } -TEST_CASE("pthread C++", "[pthread]") +// IDF-6423 - assert and crash when running this testcase on QEMU +TEST_CASE("pthread C++", "[pthread][qemu-ignore]") { global_sp_mtx.reset(new int(1)); global_sp_recur_mtx.reset(new int(-1000)); diff --git a/components/pthread/test_apps/pthread_unity_tests/pytest_pthread_unity_tests.py b/components/pthread/test_apps/pthread_unity_tests/pytest_pthread_unity_tests.py index 9ca0589dea..41fba36272 100644 --- a/components/pthread/test_apps/pthread_unity_tests/pytest_pthread_unity_tests.py +++ b/components/pthread/test_apps/pthread_unity_tests/pytest_pthread_unity_tests.py @@ -1,6 +1,8 @@ # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 +from time import sleep + import pytest from pytest_embedded import Dut @@ -62,3 +64,13 @@ def test_pthread_single_core_tls(dut: Dut) -> None: dut.expect_exact('Press ENTER to see the list of tests') dut.write('[thread-specific]') dut.expect_unity_test_output(timeout=300) + + +@pytest.mark.qemu +@pytest.mark.esp32 +def test_pthread_qemu(dut: Dut) -> None: + dut.expect_exact('Press ENTER to see the list of tests') + # dut may not be ready to accept input, so adding the delay until handled in pytest embedded (RDT-328) + sleep(1) + dut.write('![qemu-ignore]') + dut.expect_unity_test_output(timeout=300)