From e521d37f6f07e85235bac40a5c36c08ba5b6ddd4 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Fri, 16 May 2025 18:00:26 +0700 Subject: [PATCH] feat(cxx): run c++ tests for esp32c61 and esp32p4 --- components/cxx/test_apps/.build-test-rules.yml | 2 +- components/cxx/test_apps/exception/README.md | 4 ++-- .../test_apps/exception/main/test_exception.cpp | 12 +++++------- .../test_apps/exception/pytest_cxx_exception.py | 2 +- .../cxx/test_apps/exception_no_except/README.md | 4 ++-- .../pytest_cxx_exception_no_except.py | 4 ++-- components/cxx/test_apps/general/README.md | 4 ++-- .../test_apps/general/main/test_cxx_general.cpp | 14 ++++++-------- .../cxx/test_apps/general/pytest_cxx_general.py | 6 +++--- components/cxx/test_apps/rtti/README.md | 4 ++-- components/cxx/test_apps/rtti/main/test_rtti.cpp | 12 +++++------- components/cxx/test_apps/rtti/pytest_cxx_rtti.py | 2 +- 12 files changed, 32 insertions(+), 38 deletions(-) diff --git a/components/cxx/test_apps/.build-test-rules.yml b/components/cxx/test_apps/.build-test-rules.yml index 3b8ff55552..787715d396 100644 --- a/components/cxx/test_apps/.build-test-rules.yml +++ b/components/cxx/test_apps/.build-test-rules.yml @@ -2,6 +2,6 @@ components/cxx/test_apps: enable: - - if: IDF_TARGET in ["esp32", "esp32c3"] + - if: IDF_TARGET in ["esp32", "esp32c3", "esp32c61", "esp32p4"] temporary: true reason: the other targets are not tested yet diff --git a/components/cxx/test_apps/exception/README.md b/components/cxx/test_apps/exception/README.md index 1fb88efd15..c68d6f39e8 100644 --- a/components/cxx/test_apps/exception/README.md +++ b/components/cxx/test_apps/exception/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C3 | -| ----------------- | ----- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C61 | ESP32-P4 | +| ----------------- | ----- | -------- | --------- | -------- | diff --git a/components/cxx/test_apps/exception/main/test_exception.cpp b/components/cxx/test_apps/exception/main/test_exception.cpp index d0ef7166c7..d33a4fcca8 100644 --- a/components/cxx/test_apps/exception/main/test_exception.cpp +++ b/components/cxx/test_apps/exception/main/test_exception.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -13,12 +13,10 @@ - 88 bytes are allocated by pthread_setspecific() to init internal lock - some more memory... */ -#if CONFIG_IDF_TARGET_ESP32 -#define LEAKS (300) -#elif CONFIG_IDF_TARGET_ESP32S2 -#define LEAKS (800) -#elif CONFIG_IDF_TARGET_ESP32C3 -#define LEAKS (700) +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C61 || CONFIG_IDF_TARGET_ESP32P4 +#define LEAKS (128) /* real: 72 */ +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 +#define LEAKS (448) /* real: 396 */ #else #error "unknown target in CXX tests, can't set leaks threshold" #endif diff --git a/components/cxx/test_apps/exception/pytest_cxx_exception.py b/components/cxx/test_apps/exception/pytest_cxx_exception.py index e89f3c561a..209db3f3d0 100644 --- a/components/cxx/test_apps/exception/pytest_cxx_exception.py +++ b/components/cxx/test_apps/exception/pytest_cxx_exception.py @@ -6,6 +6,6 @@ from pytest_embedded_idf.utils import idf_parametrize @pytest.mark.generic -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_exception(dut: Dut) -> None: dut.run_all_single_board_cases() diff --git a/components/cxx/test_apps/exception_no_except/README.md b/components/cxx/test_apps/exception_no_except/README.md index 1fb88efd15..c68d6f39e8 100644 --- a/components/cxx/test_apps/exception_no_except/README.md +++ b/components/cxx/test_apps/exception_no_except/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C3 | -| ----------------- | ----- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C61 | ESP32-P4 | +| ----------------- | ----- | -------- | --------- | -------- | diff --git a/components/cxx/test_apps/exception_no_except/pytest_cxx_exception_no_except.py b/components/cxx/test_apps/exception_no_except/pytest_cxx_exception_no_except.py index ba8849827b..f80b4ab766 100644 --- a/components/cxx/test_apps/exception_no_except/pytest_cxx_exception_no_except.py +++ b/components/cxx/test_apps/exception_no_except/pytest_cxx_exception_no_except.py @@ -6,7 +6,7 @@ from pytest_embedded_idf.utils import idf_parametrize @pytest.mark.generic -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_noexcept_out_of_range(dut: Dut) -> None: dut.expect_exact('Press ENTER to see the list of tests') dut.write('1') @@ -15,7 +15,7 @@ def test_cxx_noexcept_out_of_range(dut: Dut) -> None: @pytest.mark.generic -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_noexcept_bad_alloc(dut: Dut) -> None: dut.expect_exact('Press ENTER to see the list of tests') dut.write('2') diff --git a/components/cxx/test_apps/general/README.md b/components/cxx/test_apps/general/README.md index 1fb88efd15..c68d6f39e8 100644 --- a/components/cxx/test_apps/general/README.md +++ b/components/cxx/test_apps/general/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C3 | -| ----------------- | ----- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C61 | ESP32-P4 | +| ----------------- | ----- | -------- | --------- | -------- | diff --git a/components/cxx/test_apps/general/main/test_cxx_general.cpp b/components/cxx/test_apps/general/main/test_cxx_general.cpp index 9d906bfe40..84ffc8447e 100644 --- a/components/cxx/test_apps/general/main/test_cxx_general.cpp +++ b/components/cxx/test_apps/general/main/test_cxx_general.cpp @@ -108,18 +108,16 @@ TEST_CASE("static initialization guards work as expected", "[misc]") TEST_ASSERT_NOT_NULL(s_slow_init_sem); int task_count = 0; // four tasks competing for static initialization of one object - task_count += start_slow_init_task<1>(0, PRO_CPU_NUM); -#if CONFIG_FREERTOS_NUMBER_OF_CORES == 2 - task_count += start_slow_init_task<1>(1, APP_CPU_NUM); -#endif + for (int i = 0; i < CONFIG_FREERTOS_NUMBER_OF_CORES; i++) { + task_count += start_slow_init_task<1>(i, i); + } task_count += start_slow_init_task<1>(2, PRO_CPU_NUM); task_count += start_slow_init_task<1>(3, tskNO_AFFINITY); // four tasks competing for static initialization of another object - task_count += start_slow_init_task<2>(0, PRO_CPU_NUM); -#if CONFIG_FREERTOS_NUMBER_OF_CORES == 2 - task_count += start_slow_init_task<2>(1, APP_CPU_NUM); -#endif + for (int i = 0; i < CONFIG_FREERTOS_NUMBER_OF_CORES; i++) { + task_count += start_slow_init_task<2>(i, i); + } task_count += start_slow_init_task<2>(2, PRO_CPU_NUM); task_count += start_slow_init_task<2>(3, tskNO_AFFINITY); diff --git a/components/cxx/test_apps/general/pytest_cxx_general.py b/components/cxx/test_apps/general/pytest_cxx_general.py index f480ed673c..e49b4ea7f9 100644 --- a/components/cxx/test_apps/general/pytest_cxx_general.py +++ b/components/cxx/test_apps/general/pytest_cxx_general.py @@ -9,21 +9,21 @@ configurations = ['noexcept', 'exceptions_rtti'] @pytest.mark.generic @pytest.mark.parametrize('config', configurations, indirect=True) -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_static_init_non_pod(dut: Dut) -> None: dut.run_all_single_board_cases(name=['can use static initializers for non-POD types']) @pytest.mark.generic @pytest.mark.parametrize('config', configurations, indirect=True) -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_misc(dut: Dut) -> None: dut.run_all_single_board_cases(group='misc') @pytest.mark.generic @pytest.mark.parametrize('config', configurations, indirect=True) -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_stack_smash(dut: Dut) -> None: dut.expect_exact('Press ENTER to see the list of tests') dut.write('"stack smashing protection CXX"') diff --git a/components/cxx/test_apps/rtti/README.md b/components/cxx/test_apps/rtti/README.md index 1fb88efd15..c68d6f39e8 100644 --- a/components/cxx/test_apps/rtti/README.md +++ b/components/cxx/test_apps/rtti/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C3 | -| ----------------- | ----- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C61 | ESP32-P4 | +| ----------------- | ----- | -------- | --------- | -------- | diff --git a/components/cxx/test_apps/rtti/main/test_rtti.cpp b/components/cxx/test_apps/rtti/main/test_rtti.cpp index 71d0c3b949..8428049e1e 100644 --- a/components/cxx/test_apps/rtti/main/test_rtti.cpp +++ b/components/cxx/test_apps/rtti/main/test_rtti.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -14,12 +14,10 @@ - 88 bytes are allocated by pthread_setspecific() to init internal lock - some more memory... */ -#if CONFIG_IDF_TARGET_ESP32 -#define LEAKS (300) -#elif CONFIG_IDF_TARGET_ESP32S2 -#define LEAKS (800) -#elif CONFIG_IDF_TARGET_ESP32C3 -#define LEAKS (700) +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C61 || CONFIG_IDF_TARGET_ESP32P4 +#define LEAKS (128) /* real: 72 */ +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 +#define LEAKS (448) /* real: 396 */ #else #error "unknown target in CXX tests, can't set leaks threshold" #endif diff --git a/components/cxx/test_apps/rtti/pytest_cxx_rtti.py b/components/cxx/test_apps/rtti/pytest_cxx_rtti.py index 40ec38cbd0..c1328f8759 100644 --- a/components/cxx/test_apps/rtti/pytest_cxx_rtti.py +++ b/components/cxx/test_apps/rtti/pytest_cxx_rtti.py @@ -6,6 +6,6 @@ from pytest_embedded_idf.utils import idf_parametrize @pytest.mark.generic -@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) +@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target']) def test_cxx_rtti(dut: Dut) -> None: dut.run_all_single_board_cases()