mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
test: format all test scripts
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
def not_expect(dut: Dut, output_regex: str) -> None:
|
||||
@@ -24,26 +25,18 @@ JTAG_SERIAL_MARKS = [
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
pytest.param('console_none', marks=pytest.mark.supported_targets),
|
||||
],
|
||||
indirect=True
|
||||
)
|
||||
@idf_parametrize('config', ['console_none'], indirect=['config'])
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_esp_system_console_no_output_uart(dut: Dut) -> None:
|
||||
not_expect(dut, r'2nd stage bootloader|Hello World')
|
||||
dut.expect('This message will be printed even with CONFIG_ESP_CONSOLE_NONE')
|
||||
|
||||
|
||||
@pytest.mark.usb_serial_jtag
|
||||
@pytest.mark.parametrize(
|
||||
'port, flash_port, config',
|
||||
[
|
||||
pytest.param('/dev/serial_ports/ttyACM-esp32', '/dev/serial_ports/ttyUSB-esp32', 'serial_jtag_only', marks=JTAG_SERIAL_MARKS),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('config', ['serial_jtag_only'], indirect=['config'])
|
||||
@idf_parametrize('flash_port', ['/dev/serial_ports/ttyUSB-esp32'], indirect=['flash_port'])
|
||||
@idf_parametrize('port', ['/dev/serial_ports/ttyACM-esp32'], indirect=['port'])
|
||||
@idf_parametrize('target', ['esp32c2', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32s3'], indirect=['target'])
|
||||
def test_esp_system_console_only_serial_jtag(dut: Dut) -> None:
|
||||
dut.expect('2nd stage bootloader')
|
||||
dut.expect('Hello World')
|
||||
@@ -54,26 +47,18 @@ def test_esp_system_console_only_serial_jtag(dut: Dut) -> None:
|
||||
|
||||
|
||||
@pytest.mark.usb_serial_jtag
|
||||
@pytest.mark.parametrize(
|
||||
'port, flash_port, config',
|
||||
[
|
||||
pytest.param('/dev/serial_ports/ttyACM-esp32', '/dev/serial_ports/ttyUSB-esp32', 'serial_jtag_only_no_vfs', marks=JTAG_SERIAL_MARKS),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('config', ['serial_jtag_only_no_vfs'], indirect=['config'])
|
||||
@idf_parametrize('flash_port', ['/dev/serial_ports/ttyUSB-esp32'], indirect=['flash_port'])
|
||||
@idf_parametrize('port', ['/dev/serial_ports/ttyACM-esp32'], indirect=['port'])
|
||||
@idf_parametrize('target', ['esp32c2', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32s3'], indirect=['target'])
|
||||
def test_esp_system_console_only_serial_jtag_no_vfs(dut: Dut) -> None:
|
||||
dut.expect('2nd stage bootloader')
|
||||
dut.expect('Hello World')
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
pytest.param('simple', marks=pytest.mark.supported_targets),
|
||||
],
|
||||
indirect=True
|
||||
)
|
||||
@idf_parametrize('config', ['simple'], indirect=['config'])
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_esp_system_console_correct_open_and_close(dut: Dut) -> None:
|
||||
dut.expect('2nd stage bootloader')
|
||||
dut.expect('Hello World')
|
||||
|
||||
+16
-15
@@ -1,19 +1,24 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 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',
|
||||
@idf_parametrize(
|
||||
'config,target',
|
||||
[
|
||||
pytest.param('default', marks=[pytest.mark.supported_targets]),
|
||||
pytest.param('pd_vddsdio', marks=[pytest.mark.supported_targets]),
|
||||
pytest.param('psram', marks=[pytest.mark.esp32, pytest.mark.esp32s2, pytest.mark.esp32s3, pytest.mark.esp32p4]),
|
||||
pytest.param('psram_with_pd_top', marks=[pytest.mark.esp32p4]),
|
||||
pytest.param('single_core_esp32', marks=[pytest.mark.esp32]),
|
||||
]
|
||||
('default', 'supported_targets'),
|
||||
('pd_vddsdio', 'supported_targets'),
|
||||
('psram', 'esp32'),
|
||||
('psram', 'esp32p4'),
|
||||
('psram', 'esp32s2'),
|
||||
('psram', 'esp32s3'),
|
||||
('psram_with_pd_top', 'esp32p4'),
|
||||
('single_core_esp32', 'esp32'),
|
||||
],
|
||||
indirect=['config', 'target'],
|
||||
)
|
||||
def test_esp_system(dut: Dut) -> None:
|
||||
# esp32p4 32MB PSRAM initialize in startup takes more than 30 sec
|
||||
@@ -21,12 +26,8 @@ def test_esp_system(dut: Dut) -> None:
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
pytest.param('default', marks=[pytest.mark.supported_targets]),
|
||||
]
|
||||
)
|
||||
@idf_parametrize('config', ['default'], indirect=['config'])
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_stack_smash_protection(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('"stack smashing protection"')
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
@idf_parametrize('target', ['linux'], indirect=['target'])
|
||||
def test_esp_system_linux(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('*')
|
||||
|
||||
Reference in New Issue
Block a user