mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'fix/replace_pytest_function' into 'master'
ci: replace pytest function Closes IDFCI-1693 See merge request espressif/esp-idf!30531
This commit is contained in:
commit
b5ab82ce3c
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import re
|
||||
|
||||
@ -22,11 +22,4 @@ def run_multiple_stages(dut: Dut, test_case_num: int, stages: int) -> None:
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
|
||||
@pytest.mark.generic
|
||||
def test_app_update(dut: Dut) -> None:
|
||||
extra_data = dut.parse_test_menu()
|
||||
for test_case in extra_data:
|
||||
if test_case.type != 'multi_stage':
|
||||
dut.write(str(test_case.index))
|
||||
else:
|
||||
run_multiple_stages(dut, test_case.index, len(test_case.subcases))
|
||||
dut.expect_unity_test_output(timeout=90)
|
||||
dut.expect_exact("Enter next test, or 'enter' to see menu")
|
||||
dut.run_all_single_board_cases(timeout=90)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@ -15,9 +14,7 @@ configurations = [
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', configurations, indirect=True)
|
||||
def test_cxx_static_init_non_pod(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('\"can use static initializers for non-POD types\"')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(name=['can use static initializers for non-POD types'])
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@ -25,9 +22,7 @@ def test_cxx_static_init_non_pod(dut: Dut) -> None:
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', configurations, indirect=True)
|
||||
def test_cxx_misc(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('[misc]')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(group='misc')
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@ -17,6 +16,4 @@ from pytest_embedded import Dut
|
||||
'release',
|
||||
], indirect=True)
|
||||
def test_legacy_temp_sensor_driver(dut: Dut) -> None:
|
||||
dut.expect('Press ENTER to see the list of tests')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.run_all_single_board_cases(timeout=120)
|
||||
|
@ -21,6 +21,4 @@ def test_efuse_qemu(dut: Dut) -> None:
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
def test_efuse_linux(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=60)
|
||||
dut.run_all_single_board_cases(timeout=60)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
@ -7,6 +7,4 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
def test_esp_hw_support_linux(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('![ignore]')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.run_all_single_board_cases(group='!ignore', timeout=120)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
from typing import Any
|
||||
|
||||
@ -9,25 +9,19 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.esp32
|
||||
def test_rtc_clk(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('[rtc_clk]')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(group='rtc_clk')
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.xtal32k
|
||||
def test_rtc_xtal32k(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('[test_env=xtal32k]')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(attributes={'test_env': 'xtal32k'})
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.no32kXtal
|
||||
def test_rtc_no_xtal32k(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('[test_env=noXtal32k]')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(attributes={'test_env': 'noXtal32k'})
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
@ -7,8 +7,4 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet
|
||||
def test_esp_netif_vfs_l2tp(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('\n')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases()
|
||||
|
@ -7,6 +7,4 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
def test_esp_system_linux(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=60)
|
||||
dut.run_all_single_board_cases(timeout=60)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@ -8,6 +7,4 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
def test_hal_utils(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases()
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@ -74,13 +73,10 @@ def test_heap(dut: Dut) -> None:
|
||||
]
|
||||
)
|
||||
def test_heap_misc_options(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('"IRAM_8BIT capability test"')
|
||||
dut.expect_unity_test_output()
|
||||
|
||||
dut.expect_exact("Enter next test, or 'enter' to see menu")
|
||||
dut.write('"test allocation and free function hooks"')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(name=[
|
||||
'IRAM_8BIT capability test',
|
||||
'test allocation and free function hooks'
|
||||
])
|
||||
|
||||
dut.expect_exact("Enter next test, or 'enter' to see menu")
|
||||
dut.write('"When enabled, allocation operation failure generates an abort"')
|
||||
@ -97,22 +93,10 @@ def test_heap_misc_options(dut: Dut) -> None:
|
||||
]
|
||||
)
|
||||
def test_heap_trace_dump(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('[trace-dump][internal]')
|
||||
dut.expect('Internal')
|
||||
|
||||
dut.expect_exact('Enter next test, or \'enter\' to see menu')
|
||||
dut.write('[trace-dump][external]')
|
||||
dut.expect('PSRAM')
|
||||
|
||||
dut.expect_exact('Enter next test, or \'enter\' to see menu')
|
||||
dut.write('[trace-dump][all]')
|
||||
dut.expect('Internal')
|
||||
dut.expect('PSRAM')
|
||||
|
||||
dut.expect_exact('Enter next test, or \'enter\' to see menu')
|
||||
dut.write('[heap-trace]')
|
||||
dut.expect_unity_test_output(timeout=100)
|
||||
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')
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@ -124,6 +108,4 @@ def test_heap_trace_dump(dut: Dut) -> None:
|
||||
]
|
||||
)
|
||||
def test_memory_protection(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('[heap][mem_prot]')
|
||||
dut.expect_unity_test_output(timeout=300)
|
||||
dut.run_all_single_board_cases(group='heap&mem_prot', timeout=300)
|
||||
|
@ -7,6 +7,4 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
def test_heap_linux(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=60)
|
||||
dut.run_all_single_board_cases(timeout=60)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
@ -13,9 +13,7 @@ CONFIGS_NVS_ENCR_FLASH_ENC = [
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.parametrize('config', ['default'], indirect=True)
|
||||
def test_nvs_flash(dut: IdfDut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('![nvs_encr_hmac]')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.run_all_single_board_cases(group='!nvs_encr_hmac', timeout=120)
|
||||
|
||||
|
||||
@pytest.mark.esp32c3
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@ -15,9 +14,7 @@ from pytest_embedded import Dut
|
||||
indirect=True,
|
||||
)
|
||||
def test_pthread(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('![thread-specific]')
|
||||
dut.expect_unity_test_output(timeout=300)
|
||||
dut.run_all_single_board_cases(group='!thread-specific', timeout=300)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@ -30,9 +27,7 @@ def test_pthread(dut: Dut) -> None:
|
||||
indirect=True,
|
||||
)
|
||||
def test_pthread_single_core(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('![thread-specific]')
|
||||
dut.expect_unity_test_output(timeout=300)
|
||||
dut.run_all_single_board_cases(group='!thread-specific', timeout=300)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@ -13,11 +12,7 @@ from pytest_embedded import Dut
|
||||
'release',
|
||||
], indirect=True)
|
||||
def test_spiffs_generic(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.run_all_single_board_cases(timeout=120)
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@ -26,8 +21,4 @@ def test_spiffs_generic(dut: Dut) -> None:
|
||||
'psram',
|
||||
], indirect=True)
|
||||
def test_spiffs_psram(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.run_all_single_board_cases(timeout=120)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
@ -16,6 +16,4 @@ from pytest_embedded import Dut
|
||||
indirect=True,
|
||||
)
|
||||
def test_touch_element(dut: Dut) -> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.run_all_single_board_cases(timeout=120)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
@ -362,16 +362,32 @@ If you need to run a group of test cases, you may run:
|
||||
|
||||
It would trigger all test cases with the ``[psram]`` tag.
|
||||
|
||||
.. warning::
|
||||
|
||||
You may also see that there are some test scripts with the following statements, which are deprecated. Please use the suggested one as above.
|
||||
If you need to run all test cases except for a specific groups, you may run:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def test_unity_single_dut(dut: IdfDut):
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(group='!psram')
|
||||
|
||||
This code will trigger all test cases except those with the [psram] tag.
|
||||
|
||||
If you need to run a group of test cases filtered by specific attributes, you may run:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def test_rtc_xtal32k(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(attributes={'test_env': 'xtal32k'})
|
||||
|
||||
This command will trigger all tests with the attribute ``test_env`` equal to ``xtal32k``.
|
||||
|
||||
If you need to run tests by specific names, you may run:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def test_dut_run_all_single_board_cases(dut):
|
||||
dut.run_all_single_board_cases(name=["normal_case1", "multiple_stages_test"])
|
||||
|
||||
This command will trigger ``normal_case1`` and ``multiple_stages_test``
|
||||
|
||||
We also provide a fixture ``case_tester`` to trigger all kinds of test cases easier. For example:
|
||||
|
||||
|
@ -362,16 +362,32 @@ ESP-IDF 在主机端使用 pytest 框架(以及一些 pytest 插件)来自
|
||||
|
||||
此代码会触发模块包含 ``[psram]`` tag 的所有测试用例。
|
||||
|
||||
.. warning::
|
||||
|
||||
你可能还会看到一些包含以下语句的测试脚本,这些脚本已被弃用。请使用上述建议的方法。
|
||||
如需除了某个特定组之外执行测试用例,可运行:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def test_unity_single_dut(dut: IdfDut):
|
||||
dut.expect_exact('Press ENTER to see the list of tests')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output()
|
||||
dut.run_all_single_board_cases(group='!psram')
|
||||
|
||||
此代码会触发模块包含 ``[psram]`` tag 以外的所有测试用例。
|
||||
|
||||
如需按特定属性执行测试用例,可运行:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def test_rtc_xtal32k(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(attributes={'test_env': 'xtal32k'})
|
||||
|
||||
这此代码会触发模块包含具有属性 ``test_env`` 等于 ``xtal32k`` 的测试用例。
|
||||
|
||||
如需按特定名称执行测试用例,可运行:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def test_dut_run_all_single_board_cases(dut):
|
||||
dut.run_all_single_board_cases(name=["normal_case1", "multiple_stages_test"])
|
||||
|
||||
这此代码会触发模块包含具有 ``normal_case1`` 和 ``multiple_stages_test`` 名称的测试用例。
|
||||
|
||||
我们的 ``case_tester`` 夹具让执行各种测试用例更加简便。例如:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user