2024-05-06 11:12:04 +08:00
|
|
|
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
2022-09-19 11:46:55 +02:00
|
|
|
# SPDX-License-Identifier: CC0-1.0
|
|
|
|
import pytest
|
|
|
|
from pytest_embedded import Dut
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.supported_targets
|
2024-08-26 19:06:03 +08:00
|
|
|
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD') # TODO [ESP32C61] IDF-9858 IDF-10989
|
2023-06-20 16:03:28 +02:00
|
|
|
@pytest.mark.nightly_run
|
2022-09-20 11:17:15 +02:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config',
|
|
|
|
[
|
|
|
|
'no_poisoning',
|
|
|
|
'light_poisoning',
|
2023-10-30 09:16:32 +01:00
|
|
|
'comprehensive_poisoning',
|
2022-09-20 11:17:15 +02:00
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_heap_poisoning(dut: Dut) -> None:
|
2023-02-01 12:12:57 +08:00
|
|
|
dut.run_all_single_board_cases()
|
2022-09-20 11:17:15 +02:00
|
|
|
|
|
|
|
|
2023-06-20 16:03:28 +02:00
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.esp32c3
|
|
|
|
@pytest.mark.host_test
|
|
|
|
@pytest.mark.qemu
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config, embedded_services',
|
|
|
|
[
|
|
|
|
('no_poisoning', 'idf,qemu'),
|
|
|
|
('light_poisoning', 'idf,qemu'),
|
|
|
|
('comprehensive_poisoning', 'idf,qemu')
|
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_heap_poisoning_qemu(dut: Dut) -> None:
|
|
|
|
for case in dut.test_menu:
|
|
|
|
if 'qemu-ignore' not in case.groups and not case.is_ignored and case.type == 'normal':
|
|
|
|
dut._run_normal_case(case)
|
|
|
|
|
|
|
|
|
2023-04-03 15:16:55 +02:00
|
|
|
@pytest.mark.generic
|
2023-10-24 12:25:20 +08:00
|
|
|
@pytest.mark.supported_targets
|
2024-08-26 19:06:03 +08:00
|
|
|
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD') # TODO [ESP32C61] IDF-9858 IDF-10989
|
2023-04-03 15:16:55 +02:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config',
|
|
|
|
[
|
|
|
|
'in_flash'
|
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_heap_in_flash(dut: Dut) -> None:
|
|
|
|
dut.run_all_single_board_cases()
|
|
|
|
|
|
|
|
|
2022-09-20 11:17:15 +02:00
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.esp32s2
|
|
|
|
@pytest.mark.esp32s3
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config',
|
|
|
|
[
|
|
|
|
'psram',
|
|
|
|
'psram_all_ext'
|
|
|
|
]
|
|
|
|
)
|
2022-09-19 11:46:55 +02:00
|
|
|
def test_heap(dut: Dut) -> None:
|
2023-02-01 12:12:57 +08:00
|
|
|
dut.run_all_single_board_cases()
|
2022-09-20 11:17:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config',
|
|
|
|
[
|
2023-10-24 12:25:20 +08:00
|
|
|
'misc_options'
|
2022-09-20 11:17:15 +02:00
|
|
|
]
|
|
|
|
)
|
2023-10-24 12:25:20 +08:00
|
|
|
def test_heap_misc_options(dut: Dut) -> None:
|
2024-05-06 11:12:04 +08:00
|
|
|
dut.run_all_single_board_cases(name=[
|
|
|
|
'IRAM_8BIT capability test',
|
|
|
|
'test allocation and free function hooks'
|
|
|
|
])
|
2022-09-20 11:17:15 +02:00
|
|
|
|
2023-10-24 12:25:20 +08:00
|
|
|
dut.expect_exact("Enter next test, or 'enter' to see menu")
|
|
|
|
dut.write('"When enabled, allocation operation failure generates an abort"')
|
|
|
|
dut.expect('Backtrace: ')
|
2022-12-22 11:36:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config',
|
|
|
|
[
|
2023-04-12 12:17:00 +02:00
|
|
|
'heap_trace',
|
|
|
|
'heap_trace_hashmap'
|
2022-12-22 11:36:36 +01:00
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_heap_trace_dump(dut: Dut) -> None:
|
2024-05-06 11:12:04 +08:00
|
|
|
dut.run_all_single_board_cases(group='trace-dump&internal')
|
|
|
|
dut.run_all_single_board_cases(group='trace-dump&external')
|
|
|
|
dut.run_all_single_board_cases(group='trace-dump&all')
|
|
|
|
dut.run_all_single_board_cases(group='heap-trace')
|
2023-01-23 06:59:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.generic
|
|
|
|
@pytest.mark.supported_targets
|
2024-08-26 19:06:03 +08:00
|
|
|
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD') # TODO [ESP32C61] IDF-9858 IDF-10989
|
2023-01-23 06:59:58 +01:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'config',
|
|
|
|
[
|
|
|
|
'mem_prot'
|
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_memory_protection(dut: Dut) -> None:
|
2024-05-06 11:12:04 +08:00
|
|
|
dut.run_all_single_board_cases(group='heap&mem_prot', timeout=300)
|