test: format all test scripts

This commit is contained in:
Evgeny Torbin
2026-04-17 16:01:00 +02:00
committed by Fu Hanxi
parent 1740554ae3
commit 59f62ad15f
349 changed files with 4844 additions and 3464 deletions
@@ -1,16 +1,17 @@
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import os
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
PROMPT = 'test_intr_dump>'
@pytest.mark.esp32
@pytest.mark.qemu
@pytest.mark.host_test
@idf_parametrize('target', ['esp32'], indirect=['target'])
def test_esp_intr_dump_nonshared(dut: Dut) -> None:
dut.expect_exact(PROMPT, timeout=30)
@@ -22,9 +23,9 @@ def test_esp_intr_dump_nonshared(dut: Dut) -> None:
dut.expect(r'(\d+)\s+3\s+Level\s+Used: GPIO')
@pytest.mark.esp32
@pytest.mark.qemu
@pytest.mark.host_test
@idf_parametrize('target', ['esp32'], indirect=['target'])
def test_esp_intr_dump_shared(dut: Dut) -> None:
dut.expect_exact(PROMPT, timeout=30)
@@ -47,8 +48,8 @@ def test_esp_intr_dump_shared(dut: Dut) -> None:
# TODO: IDF-9512, Update the expected output of dual core RISC-V chips when the issue is resolved
@pytest.mark.supported_targets
@pytest.mark.generic
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_esp_intr_dump_expected_output(dut: Dut) -> None:
dut.expect_exact(PROMPT, timeout=30)
dut.write('intr_dump\n')
+4 -8
View File
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import os
import re
@@ -7,6 +7,7 @@ import typing
import pexpect
import pytest
from pytest_embedded_idf import IdfDut
from pytest_embedded_idf.utils import idf_parametrize
if typing.TYPE_CHECKING:
from conftest import OpenOCD
@@ -34,18 +35,13 @@ def _test_idf_gdb(openocd_dut: 'OpenOCD', dut: IdfDut) -> None:
p.expect_exact('hit Temporary breakpoint 1, app_main ()')
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.jtag
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2'], indirect=['target'])
def test_idf_gdb(openocd_dut: 'OpenOCD', dut: IdfDut) -> None:
_test_idf_gdb(openocd_dut, dut)
@pytest.mark.esp32s3
@pytest.mark.esp32c3
@pytest.mark.esp32c6
@pytest.mark.esp32h2
@pytest.mark.usb_serial_jtag
@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2'], indirect=['target'])
def test_idf_gdb_usj(openocd_dut: 'OpenOCD', dut: IdfDut) -> None:
_test_idf_gdb(openocd_dut, dut)
@@ -1,19 +1,16 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest
from pytest_embedded_idf import IdfDut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.parametrize('offset', [
pytest.param('0x40007d54', marks=[pytest.mark.esp32]),
# pytest.param('0x4000f6e2', marks=[pytest.mark.esp32s2]),
# pytest.param('0x40047654', marks=[pytest.mark.esp32c3]),
])
@pytest.mark.parametrize('embedded_services, skip_autoflash, erase_all', [
('esp,idf,jtag', 'y', 'y'),
], indirect=True)
@pytest.mark.jtag
@idf_parametrize('embedded_services', ['esp,idf,jtag'], indirect=['embedded_services'])
@idf_parametrize('erase_all', ['y'], indirect=['erase_all'])
@idf_parametrize('offset', ['0x40007d54'])
@idf_parametrize('skip_autoflash', ['y'], indirect=['skip_autoflash'])
@idf_parametrize('target', ['esp32'], indirect=['target'])
def test_loadable_elf(dut: IdfDut, offset: str) -> None:
dut.gdb.write('mon reset halt')
dut.gdb.write(f'thb *{offset}')
@@ -1,9 +1,10 @@
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import os.path as path
import sys
import pytest
from pytest_embedded_idf.utils import idf_parametrize
sys.path.append(path.expandvars(path.join('$IDF_PATH', 'tools', 'test_apps', 'system', 'panic')))
from test_panic_util import PanicTestDut # noqa: E402
@@ -19,8 +20,8 @@ def get_line_number(lookup: str, offset: int = 0) -> int:
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='esp32p4 support TBD') # TODO: IDF-8992
@pytest.mark.supported_targets
@pytest.mark.generic
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_gdbstub_runtime(dut: PanicTestDut) -> None:
dut.expect_exact('tested app is running.')
dut.write(b'\x03') # send Ctrl-C
@@ -73,7 +74,9 @@ def test_gdbstub_runtime(dut: PanicTestDut) -> None:
# 4200ae5c: f99ff0ef jal ra,4200adf4 <foo>
# 4200ae60: a011 j 4200ae64 <app_main+0x4e> <----------- here after return from foo()
# }
assert payload['frame']['line'] == str(get_line_number('label_3:', 1) if dut.is_xtensa else get_line_number('foo();', 0))
assert payload['frame']['line'] == str(
get_line_number('label_3:', 1) if dut.is_xtensa else get_line_number('foo();', 0)
)
assert payload['frame']['func'] == 'app_main'
assert payload['stopped-threads'] == 'all'
@@ -155,11 +158,9 @@ def test_gdbstub_runtime(dut: PanicTestDut) -> None:
assert payload['stopped-threads'] == 'all'
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.generic
@pytest.mark.temp_skip_ci(targets=['esp32', 'esp32s2', 'esp32s3'], reason='fix IDF-7927')
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32s3'], indirect=['target'])
def test_gdbstub_runtime_xtensa_stepping_bug(dut: PanicTestDut) -> None:
dut.expect_exact('tested app is running.')
dut.write(b'\x03') # send Ctrl-C
@@ -1,12 +1,11 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.generic
@idf_parametrize('target', ['esp32', 'esp32s2'], indirect=['target'])
def test_sys_longjmp(dut: Dut) -> None:
dut.expect_exact('Test successful')
@@ -1,10 +1,10 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import logging
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
MEM_TEST_UNICORE = {
'esp32s2': [
@@ -14,16 +14,12 @@ MEM_TEST_UNICORE = {
['DRAM0_RTCFAST', 'WR'],
['PERI1_RTCSLOW', 'WR'],
['PERI2_RTCSLOW_0', 'WRX'],
['PERI2_RTCSLOW_1', 'WRX']
],
'esp32c3': [
['IRAM0_SRAM', 'WRX'],
['DRAM0_SRAM', 'WR'],
['IRAM0_RTCFAST', 'WRX']
['PERI2_RTCSLOW_1', 'WRX'],
],
'esp32c3': [['IRAM0_SRAM', 'WRX'], ['DRAM0_SRAM', 'WR'], ['IRAM0_RTCFAST', 'WRX']],
'esp32s3': [
['IRAM0_SRAM (core 0)', 'WRX'],
['DRAM0_SRAM (core 0)', 'WR']
['DRAM0_SRAM (core 0)', 'WR'],
# temporarily disabled unless IDF-5208 gets merged
# ['IRAM0_RTCFAST', 'WR'],
],
@@ -38,19 +34,16 @@ MEM_TEST_MULTICORE = {
# instruction execute test temporarily disabled
# ['IRAM0_SRAM (core 1)', 'WRX'],
['IRAM0_SRAM (core 1)', 'WR'],
['DRAM0_SRAM (core 1)', 'WR']
['DRAM0_SRAM (core 1)', 'WR'],
# temporarily disabled unless IDF-5208 gets merged
# ['IRAM0_RTCFAST', 'WR'],
]
}
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32c3
@pytest.mark.generic
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32c3'], indirect=['target'])
def test_sys_memprot(dut: Dut) -> None:
current_target = dut.target
unicore = dut.app.sdkconfig.get('FREERTOS_UNICORE')
File diff suppressed because it is too large Load Diff
@@ -1,23 +1,35 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded_idf.dut import IdfDut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='esp32p4 support TBD') # TODO: IDF-8994
@pytest.mark.supported_targets
@pytest.mark.generic
@pytest.mark.parametrize('config', ['pure_ram',], indirect=True,)
@pytest.mark.parametrize(
'config',
[
'pure_ram',
],
indirect=True,
)
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_pure_ram_loadable_app(dut: IdfDut) -> None:
dut.expect('main_task: Calling app_main()', timeout=10)
dut.expect('Time since boot: 3 seconds...', timeout=10)
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='esp32p4 support TBD') # TODO: IDF-8994
@pytest.mark.supported_targets
@pytest.mark.generic
@pytest.mark.parametrize('config', ['defaults',], indirect=True,)
@pytest.mark.parametrize(
'config',
[
'defaults',
],
indirect=True,
)
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_ram_loadable_app(dut: IdfDut) -> None:
dut.expect('spi_flash: detected chip', timeout=10)
dut.expect('Time since boot: 3 seconds...', timeout=30)
@@ -1,10 +1,11 @@
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.esp32p4
@pytest.mark.generic
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
def test_rtc_mem_reserve(dut: Dut) -> None:
dut.run_all_single_board_cases()
@@ -1,31 +1,39 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.generic
@pytest.mark.parametrize('config', [
pytest.param('flash_80m_qio', marks=[pytest.mark.supported_targets]),
pytest.param('no_vfs', marks=[pytest.mark.supported_targets]),
pytest.param('no_vfs_partial', marks=[pytest.mark.supported_targets]),
pytest.param('opt_o0', marks=[pytest.mark.supported_targets]),
pytest.param('opt_o2', marks=[pytest.mark.supported_targets]),
pytest.param('stack_check_verbose_log', marks=[pytest.mark.supported_targets]),
pytest.param('sram1_iram', marks=[pytest.mark.esp32]),
pytest.param('main_task_cpu1', marks=[pytest.mark.esp32, pytest.mark.esp32s3]),
], indirect=True)
@idf_parametrize(
'config,target',
[
('flash_80m_qio', 'supported_targets'),
('no_vfs', 'supported_targets'),
('no_vfs_partial', 'supported_targets'),
('opt_o0', 'supported_targets'),
('opt_o2', 'supported_targets'),
('stack_check_verbose_log', 'supported_targets'),
('sram1_iram', 'esp32'),
('main_task_cpu1', 'esp32'),
('main_task_cpu1', 'esp32s3'),
],
indirect=['config', 'target'],
)
def test_sys_startup(dut: Dut) -> None:
dut.expect_exact('app_main running')
@pytest.mark.esp32
@pytest.mark.esp32s3
@pytest.mark.generic
@pytest.mark.parametrize('config', [
'single_core_variant',
], indirect=True)
@pytest.mark.parametrize(
'config',
[
'single_core_variant',
],
indirect=True,
)
@idf_parametrize('target', ['esp32', 'esp32s3'], indirect=['target'])
def test_sys_startup_single_core_variant(dut: Dut) -> None:
dut.expect('Running on single core variant of a chip, but app is built with multi-core support.')
dut.expect(r'abort\(\) was called at PC [0-9xa-f]+ on core 0')
@@ -1,12 +1,11 @@
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
def test_watchpoint(dut: Dut) -> None:
dut.expect_exact('stacks clean', timeout=3)
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import os
import re
@@ -7,13 +7,12 @@ import pytest
from artifacts_handler import ArtifactType
from idf_ci_utils import IDF_PATH
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.esp32
@pytest.mark.esp32s3
@pytest.mark.esp32p4
@pytest.mark.generic
@pytest.mark.parametrize('config', ['multicore', 'multicore_psram'], indirect=True)
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32p4'], indirect=['target'])
def test_multicore_app_and_unicore_bootloader(dut: Dut, app_downloader, config) -> None: # type: ignore
dut.expect('Multicore bootloader')
dut.expect('Multicore app')
@@ -37,11 +36,9 @@ def test_multicore_app_and_unicore_bootloader(dut: Dut, app_downloader, config)
dut.expect('NVS test done\n')
@pytest.mark.esp32
@pytest.mark.esp32s3
@pytest.mark.esp32p4
@pytest.mark.generic
@pytest.mark.parametrize('config', ['unicore', 'unicore_psram'], indirect=True)
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32p4'], indirect=['target'])
def test_unicore_app_and_multicore_bootloader(dut: Dut, app_downloader, config) -> None: # type: ignore
dut.expect('Unicore bootloader')
dut.expect('Unicore app')