2025-02-24 10:18:03 +08:00
|
|
|
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
2022-03-22 16:20:51 +08:00
|
|
|
# SPDX-License-Identifier: CC0-1.0
|
|
|
|
import pytest
|
|
|
|
from pytest_embedded import Dut
|
2025-02-24 10:18:03 +08:00
|
|
|
from pytest_embedded_idf.utils import idf_parametrize
|
2022-03-22 16:20:51 +08:00
|
|
|
|
2025-02-24 10:18:03 +08:00
|
|
|
configurations = ['noexcept', 'exceptions_rtti']
|
2022-03-22 16:20:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.parametrize('config', configurations, indirect=True)
|
2025-05-16 18:00:26 +07:00
|
|
|
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target'])
|
2022-03-22 16:20:51 +08:00
|
|
|
def test_cxx_static_init_non_pod(dut: Dut) -> None:
|
2024-05-06 11:12:04 +08:00
|
|
|
dut.run_all_single_board_cases(name=['can use static initializers for non-POD types'])
|
2022-03-22 16:20:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.parametrize('config', configurations, indirect=True)
|
2025-05-16 18:00:26 +07:00
|
|
|
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target'])
|
2022-03-22 16:20:51 +08:00
|
|
|
def test_cxx_misc(dut: Dut) -> None:
|
2024-05-06 11:12:04 +08:00
|
|
|
dut.run_all_single_board_cases(group='misc')
|
2022-03-22 16:20:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.parametrize('config', configurations, indirect=True)
|
2025-05-16 18:00:26 +07:00
|
|
|
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32c61', 'esp32p4'], indirect=['target'])
|
2022-03-22 16:20:51 +08:00
|
|
|
def test_cxx_stack_smash(dut: Dut) -> None:
|
|
|
|
dut.expect_exact('Press ENTER to see the list of tests')
|
2025-02-24 10:18:03 +08:00
|
|
|
dut.write('"stack smashing protection CXX"')
|
2022-03-22 16:20:51 +08:00
|
|
|
dut.expect_exact('Stack smashing protect failure!')
|
|
|
|
dut.expect_exact('Rebooting...')
|