mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
test: format all test scripts
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-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
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c6', 'esp32p4'], indirect=['target'])
|
||||
def test_lp_core_pcnt(dut: Dut) -> None:
|
||||
|
||||
res = dut.expect(r'ULP will wake up processor after every (\d+) pulses')
|
||||
wakeup_limit = res.group(1).decode('utf-8')
|
||||
assert (int(wakeup_limit) > 0)
|
||||
assert int(wakeup_limit) > 0
|
||||
logging.info(f'Wake-up limit: {wakeup_limit} pulses')
|
||||
|
||||
dut.expect_exact('Not a ULP wakeup, initializing it!')
|
||||
@@ -27,4 +26,4 @@ def test_lp_core_pcnt(dut: Dut) -> None:
|
||||
|
||||
# Check that pulse count is correct, we could have gotten pulses between triggering
|
||||
# the wakeup signal and printing the count, but it should at be equal to or greater
|
||||
assert (int(pulse_count) >= int(wakeup_limit))
|
||||
assert int(pulse_count) >= int(wakeup_limit)
|
||||
|
||||
@@ -1,11 +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.esp32c6
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c6', 'esp32p4'], indirect=['target'])
|
||||
def test_lp_core_intr(dut: Dut) -> None:
|
||||
dut.expect('Triggered 10 interrupts on the LP-Core, LP-Core received 10 interrupts')
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
# 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 logging
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_example_ulp_fsm(dut: Dut) -> None:
|
||||
dut.expect_exact('Not ULP wakeup')
|
||||
dut.expect_exact('Entering deep sleep')
|
||||
@@ -30,8 +28,9 @@ def test_example_ulp_fsm(dut: Dut) -> None:
|
||||
dut.expect_exact('ULP wakeup, saving pulse count', timeout=5)
|
||||
logging.info('Woke up...')
|
||||
init_count = int(dut.expect(r'Read pulse count from NVS:\s+(\d+)', timeout=5).group(1), 10)
|
||||
assert nvs_value in (init_count, None), ('Read count is {} and previously written value is {}'
|
||||
''.format(init_count, nvs_value))
|
||||
assert nvs_value in (init_count, None), 'Read count is {} and previously written value is {}'.format(
|
||||
init_count, nvs_value
|
||||
)
|
||||
|
||||
inc = int(dut.expect(r'Pulse count from ULP:\s+(\d+)', timeout=5).group(1), 10)
|
||||
assert inc in (5, 6), 'pulse count is {}'.format(inc)
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
# 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 logging
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s3'], indirect=['target'])
|
||||
def test_example_ulp_fsm_adc(dut: Dut) -> None:
|
||||
|
||||
dut.expect_exact('Not ULP wakeup')
|
||||
dut.expect_exact('Entering deep sleep')
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# 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 time
|
||||
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_ulp_riscv_gpio(dut: Dut) -> None:
|
||||
|
||||
dut.expect_exact('Not a ULP-RISC-V wakeup, initializing it!')
|
||||
dut.expect_exact('Entering in deep sleep')
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_ulp_riscv_interrupts(dut: Dut) -> None:
|
||||
|
||||
dut.expect_exact('Not a ULP RISC-V wakeup, initializing it!')
|
||||
dut.expect_exact('Entering in deep sleep')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user