ci: fix pytest generic env markers

This commit is contained in:
Chen Yudong
2024-04-03 18:10:43 +08:00
parent 23bae90070
commit 7d13f8210f
16 changed files with 32 additions and 43 deletions

View File

@@ -24,7 +24,7 @@ def test_esp_timer(dut: Dut) -> None:
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.quad_psram @pytest.mark.psram
@pytest.mark.parametrize('config', [ @pytest.mark.parametrize('config', [
'psram', 'psram',
], indirect=True) ], indirect=True)

View File

@@ -1,12 +1,12 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
import pytest import pytest
from pytest_embedded import Dut from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.generic
def test_fatfs_flash_ro(dut: Dut) -> None: def test_fatfs_flash_ro(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests') dut.expect_exact('Press ENTER to see the list of tests')
dut.write('') dut.write('')

View File

@@ -1,12 +1,12 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
import pytest import pytest
from pytest_embedded import Dut from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.generic
@pytest.mark.parametrize( @pytest.mark.parametrize(
'config', 'config',
[ [

View File

@@ -1,10 +1,10 @@
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
import pytest import pytest
from pytest_embedded import Dut from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.psram
def test_pthread_psram(dut: Dut) -> None: def test_pthread_psram(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=10) dut.run_all_single_board_cases(timeout=10)

View File

@@ -1,8 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import hashlib import hashlib
import http.client import http.client
import logging import logging
@@ -17,12 +16,14 @@ except ModuleNotFoundError:
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'tools', 'ci', 'python_packages')) sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'tools', 'ci', 'python_packages'))
from idf_http_server_test import adder as client from idf_http_server_test import adder as client
from common_test_methods import get_env_config_variable
from pytest_embedded import Dut from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.esp32s3 @pytest.mark.esp32s3
@pytest.mark.wifi_router
@pytest.mark.parametrize('config', ['spiffs',], indirect=True) @pytest.mark.parametrize('config', ['spiffs',], indirect=True)
def test_examples_protocol_http_server_file_serving(dut: Dut) -> None: def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
@@ -35,6 +36,14 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
logging.info('Starting http file serving simple test app') logging.info('Starting http file serving simple test app')
dut.expect('Initializing SPIFFS', timeout=30) dut.expect('Initializing SPIFFS', timeout=30)
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
dut.expect('Please input ssid password:')
env_name = 'wifi_router'
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
ap_password = get_env_config_variable(env_name, 'ap_password')
dut.write(f'{ap_ssid} {ap_password}')
# Parse IP address of STA # Parse IP address of STA
logging.info('Waiting to connect with AP') logging.info('Waiting to connect with AP')
got_ip = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode() got_ip = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()

View File

@@ -0,0 +1 @@
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y

View File

@@ -1,12 +1,12 @@
# 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 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import os import os
import re import re
import shutil import shutil
import sys import sys
from datetime import datetime from datetime import datetime
from subprocess import STDOUT, run from subprocess import run
from subprocess import STDOUT
from typing import List from typing import List
import pytest import pytest
@@ -51,8 +51,8 @@ def compare_folders(fp1: str, fp2: str) -> bool:
return f1_.read() == f2_.read() return f1_.read() == f2_.read()
# Example_GENERIC
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.generic
@pytest.mark.parametrize('config', ['test_read_only_partition_gen', @pytest.mark.parametrize('config', ['test_read_only_partition_gen',
'test_read_only_partition_gen_default_dt', 'test_read_only_partition_gen_default_dt',
'test_read_only_partition_gen_ln', 'test_read_only_partition_gen_ln',

View File

@@ -1,11 +1,11 @@
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest import pytest
from pytest_embedded import Dut from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.generic
def test_nvsgen_example(dut: Dut) -> None: def test_nvsgen_example(dut: Dut) -> None:
dut.expect('Reading values from NVS', timeout=10) dut.expect('Reading values from NVS', timeout=10)
dut.expect('Reading values from NVS done - all OK', timeout=10) dut.expect('Reading values from NVS done - all OK', timeout=10)

View File

@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import re import re
import pytest import pytest
@@ -9,6 +8,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.generic
def test_partition_find_example(dut: Dut) -> None: def test_partition_find_example(dut: Dut) -> None:
def expect_partition(name: str, offset: int, size: int) -> None: def expect_partition(name: str, offset: int, size: int) -> None:
dut.expect(re.compile(str.encode("found partition '{}' at offset {:#x} with size {:#x}".format(name, offset, size))), timeout=5) dut.expect(re.compile(str.encode("found partition '{}' at offset {:#x} with size {:#x}".format(name, offset, size))), timeout=5)

View File

@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import re import re
import pytest import pytest
@@ -9,6 +8,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.generic
def test_partition_mmap_example(dut: Dut) -> None: def test_partition_mmap_example(dut: Dut) -> None:
# ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received # ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received
message_list = (rb'Written sample data to partition: ESP-IDF Partition Memory Map Example', message_list = (rb'Written sample data to partition: ESP-IDF Partition Memory Map Example',

View File

@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import re import re
import pytest import pytest
@@ -9,6 +8,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.generic
def test_partition_ops_example(dut: Dut) -> None: def test_partition_ops_example(dut: Dut) -> None:
# ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received # ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received
message_list = (rb'Written data: ESP-IDF Partition Operations Example \(Read, Erase, Write\)', message_list = (rb'Written data: ESP-IDF Partition Operations Example \(Read, Erase, Write\)',

View File

@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import os import os
import subprocess import subprocess
import sys import sys
@@ -10,6 +9,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.generic
def test_examples_parttool(dut: Dut) -> None: def test_examples_parttool(dut: Dut) -> None:
# Verify factory firmware # Verify factory firmware
dut.expect('Partitions Tool Example') dut.expect('Partitions Tool Example')

View File

@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import re import re
import pytest import pytest
@@ -9,6 +8,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32c3 @pytest.mark.esp32c3
@pytest.mark.generic
def test_examples_spiffs(dut: Dut) -> None: def test_examples_spiffs(dut: Dut) -> None:
message_list = (rb'example: Initializing SPIFFS', message_list = (rb'example: Initializing SPIFFS',
rb'example: Partition size: total: \d+, used: \d+', rb'example: Partition size: total: \d+, used: \d+',

View File

@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import hashlib import hashlib
import os import os
@@ -9,6 +8,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.generic
def test_spiffsgen_example(dut: Dut) -> None: def test_spiffsgen_example(dut: Dut) -> None:
# Test with default build configurations # Test with default build configurations
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image') base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image')

View File

@@ -1,39 +1,14 @@
no_env_marker_test_cases: no_env_marker_test_cases:
- components/fatfs/test_apps/flash_ro/pytest_fatfs_flash_ro.py::test_fatfs_flash_ro
- components/fatfs/test_apps/flash_wl/pytest_fatfs_flash_wl.py::test_fatfs_flash_wl_generic[default]
- components/fatfs/test_apps/flash_wl/pytest_fatfs_flash_wl.py::test_fatfs_flash_wl_generic[fastseek]
- components/fatfs/test_apps/flash_wl/pytest_fatfs_flash_wl.py::test_fatfs_flash_wl_generic[release]
- components/nvs_flash/test_apps/pytest_nvs_flash.py::test_nvs_flash[default] - components/nvs_flash/test_apps/pytest_nvs_flash.py::test_nvs_flash[default]
- components/pthread/test_apps/pthread_psram_tests/pytest_pthread_psram_tests.py::test_pthread_psram
- components/vfs/test_apps/pytest_vfs.py::test_vfs_ccomp[ccomp] - components/vfs/test_apps/pytest_vfs.py::test_vfs_ccomp[ccomp]
- components/vfs/test_apps/pytest_vfs.py::test_vfs_default[default] - components/vfs/test_apps/pytest_vfs.py::test_vfs_default[default]
- components/vfs/test_apps/pytest_vfs.py::test_vfs_default[iram] - components/vfs/test_apps/pytest_vfs.py::test_vfs_default[iram]
- examples/protocols/http_server/file_serving/pytest_http_server_file_serving.py::test_examples_protocol_http_server_file_serving[spiffs]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_only_partition_gen]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_only_partition_gen_default_dt]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_only_partition_gen_ln]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_only_partition_gen_ln_default_dt]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_write_partition_gen]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_write_partition_gen_default_dt]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_write_partition_gen_ln]
- examples/storage/fatfsgen/pytest_fatfsgen_example.py::test_examples_fatfsgen[test_read_write_partition_gen_ln_default_dt]
- examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py::test_examples_nvs_rw_blob - examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py::test_examples_nvs_rw_blob
- examples/storage/nvs_rw_value/pytest_nvs_rw_value.py::test_examples_nvs_rw_value - examples/storage/nvs_rw_value/pytest_nvs_rw_value.py::test_examples_nvs_rw_value
- examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py::test_examples_nvs_rw_value_cxx - examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py::test_examples_nvs_rw_value_cxx
- examples/storage/nvsgen/pytest_nvsgen_example.py::test_nvsgen_example
- examples/storage/partition_api/partition_find/pytest_partition_find_example.py::test_partition_find_example
- examples/storage/partition_api/partition_mmap/pytest_partition_mmap_example.py::test_partition_mmap_example
- examples/storage/partition_api/partition_ops/pytest_partition_ops_example.py::test_partition_ops_example
- examples/storage/parttool/pytest_parttool_example.py::test_examples_parttool
- examples/storage/spiffs/pytest_spiffs_example.py::test_examples_spiffs
- examples/storage/spiffsgen/pytest_spiffsgen_example.py::test_spiffsgen_example
- examples/storage/wear_levelling/pytest_wear_levelling_example.py::test_wear_levelling_example - examples/storage/wear_levelling/pytest_wear_levelling_example.py::test_wear_levelling_example
- tools/test_apps/system/panic/pytest_panic.py::test_gdbstub_coredump[gdbstub_coredump]
- tools/test_apps/system/panic/pytest_panic.py::test_panic_delay[panic_delay]
no_runner_tags: no_runner_tags:
- esp32,ip101 - esp32,ip101
- esp32,psram,quad_psram
- esp32,quad_psram
- esp32c2,jtag,xtal_40mhz - esp32c2,jtag,xtal_40mhz
- esp32c3,flash_multi - esp32c3,flash_multi
- esp32c3,sdcard_sdmode - esp32c3,sdcard_sdmode

View File

@@ -55,7 +55,9 @@ TARGETS_DUAL_CORE_NAMES = [x.mark.name for x in TARGETS_DUAL_CORE]
# The tests which panic on external stack require PSRAM capable runners # The tests which panic on external stack require PSRAM capable runners
CONFIGS_EXTRAM_STACK = [ CONFIGS_EXTRAM_STACK = [
pytest.param('coredump_extram_stack', marks=[pytest.mark.esp32, pytest.mark.esp32s2, pytest.mark.psram, pytest.mark.esp32s3, pytest.mark.quad_psram]) pytest.param('coredump_extram_stack', marks=[pytest.mark.esp32, pytest.mark.psram]),
pytest.param('coredump_extram_stack', marks=[pytest.mark.esp32s2, pytest.mark.generic]),
pytest.param('coredump_extram_stack', marks=[pytest.mark.esp32s3, pytest.mark.quad_psram]),
] ]
TARGETS_HW_STACK_GUARD = [ TARGETS_HW_STACK_GUARD = [
@@ -517,6 +519,7 @@ def test_assert_cache_disabled(
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.generic
@pytest.mark.parametrize('config', ['panic_delay'], indirect=True) @pytest.mark.parametrize('config', ['panic_delay'], indirect=True)
def test_panic_delay(dut: PanicTestDut) -> None: def test_panic_delay(dut: PanicTestDut) -> None:
dut.run_test_func('test_storeprohibited') dut.run_test_func('test_storeprohibited')
@@ -831,6 +834,7 @@ def test_drom_reg_execute_violation(dut: PanicTestDut, test_func_name: str) -> N
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.generic
@pytest.mark.parametrize('config', ['gdbstub_coredump'], indirect=True) @pytest.mark.parametrize('config', ['gdbstub_coredump'], indirect=True)
def test_gdbstub_coredump(dut: PanicTestDut) -> None: def test_gdbstub_coredump(dut: PanicTestDut) -> None:
test_func_name = 'test_storeprohibited' test_func_name = 'test_storeprohibited'