Skip to content

Commit

Permalink
Merge branch 'ci/fix_generic_env_markers' into 'master'
Browse files Browse the repository at this point in the history
ci: fix pytest generic env markers

See merge request espressif/esp-idf!30021
  • Loading branch information
ydesp committed Apr 7, 2024
2 parents 279b67c + 7d13f82 commit 8ff5371
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 43 deletions.
2 changes: 1 addition & 1 deletion components/esp_timer/test_apps/pytest_esp_timer_ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_esp_timer(dut: Dut) -> None:


@pytest.mark.esp32
@pytest.mark.quad_psram
@pytest.mark.psram
@pytest.mark.parametrize('config', [
'psram',
], indirect=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0

import pytest
from pytest_embedded import Dut


@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
def test_fatfs_flash_ro(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0

import pytest
from pytest_embedded import Dut


@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0

import pytest
from pytest_embedded import Dut


@pytest.mark.esp32
@pytest.mark.psram
def test_pthread_psram(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=10)
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/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

import hashlib
import http.client
import logging
Expand All @@ -17,12 +16,14 @@
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'tools', 'ci', 'python_packages'))
from idf_http_server_test import adder as client

from common_test_methods import get_env_config_variable
from pytest_embedded import Dut


@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.wifi_router
@pytest.mark.parametrize('config', ['spiffs',], indirect=True)
def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:

Expand All @@ -35,6 +36,14 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
logging.info('Starting http file serving simple test app')

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
logging.info('Waiting to connect with AP')
got_ip = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y
8 changes: 4 additions & 4 deletions examples/storage/fatfsgen/pytest_fatfsgen_example.py
Original file line number Diff line number Diff line change
@@ -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

import os
import re
import shutil
import sys
from datetime import datetime
from subprocess import STDOUT, run
from subprocess import run
from subprocess import STDOUT
from typing import List

import pytest
Expand Down Expand Up @@ -51,8 +51,8 @@ def compare_folders(fp1: str, fp2: str) -> bool:
return f1_.read() == f2_.read()


# Example_GENERIC
@pytest.mark.esp32
@pytest.mark.generic
@pytest.mark.parametrize('config', ['test_read_only_partition_gen',
'test_read_only_partition_gen_default_dt',
'test_read_only_partition_gen_ln',
Expand Down
2 changes: 1 addition & 1 deletion examples/storage/nvsgen/pytest_nvsgen_example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import pytest
from pytest_embedded import Dut


@pytest.mark.esp32
@pytest.mark.generic
def test_nvsgen_example(dut: Dut) -> None:
dut.expect('Reading values from NVS', timeout=10)
dut.expect('Reading values from NVS done - all OK', timeout=10)
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import re

import pytest
Expand All @@ -9,6 +8,7 @@

@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
def test_partition_find_example(dut: Dut) -> 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import re

import pytest
Expand All @@ -9,6 +8,7 @@

@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
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
message_list = (rb'Written sample data to partition: ESP-IDF Partition Memory Map Example',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import re

import pytest
Expand All @@ -9,6 +8,7 @@

@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
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
message_list = (rb'Written data: ESP-IDF Partition Operations Example \(Read, Erase, Write\)',
Expand Down
2 changes: 1 addition & 1 deletion examples/storage/parttool/pytest_parttool_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import os
import subprocess
import sys
Expand All @@ -10,6 +9,7 @@


@pytest.mark.esp32
@pytest.mark.generic
def test_examples_parttool(dut: Dut) -> None:
# Verify factory firmware
dut.expect('Partitions Tool Example')
Expand Down
2 changes: 1 addition & 1 deletion examples/storage/spiffs/pytest_spiffs_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import re

import pytest
Expand All @@ -9,6 +8,7 @@

@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.generic
def test_examples_spiffs(dut: Dut) -> None:
message_list = (rb'example: Initializing SPIFFS',
rb'example: Partition size: total: \d+, used: \d+',
Expand Down
2 changes: 1 addition & 1 deletion examples/storage/spiffsgen/pytest_spiffsgen_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0

import hashlib
import os

Expand All @@ -9,6 +8,7 @@


@pytest.mark.esp32
@pytest.mark.generic
def test_spiffsgen_example(dut: Dut) -> None:
# Test with default build configurations
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
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/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_default[default]
- 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_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/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
- 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:
- esp32,ip101
- esp32,psram,quad_psram
- esp32,quad_psram
- esp32c2,jtag,xtal_40mhz
- esp32c3,flash_multi
- esp32c3,sdcard_sdmode
Expand Down
6 changes: 5 additions & 1 deletion tools/test_apps/system/panic/pytest_panic.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@

# The tests which panic on external stack require PSRAM capable runners
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 = [
Expand Down Expand Up @@ -517,6 +519,7 @@ def test_assert_cache_disabled(


@pytest.mark.esp32
@pytest.mark.generic
@pytest.mark.parametrize('config', ['panic_delay'], indirect=True)
def test_panic_delay(dut: PanicTestDut) -> None:
dut.run_test_func('test_storeprohibited')
Expand Down Expand Up @@ -831,6 +834,7 @@ def test_drom_reg_execute_violation(dut: PanicTestDut, test_func_name: str) -> N


@pytest.mark.esp32
@pytest.mark.generic
@pytest.mark.parametrize('config', ['gdbstub_coredump'], indirect=True)
def test_gdbstub_coredump(dut: PanicTestDut) -> None:
test_func_name = 'test_storeprohibited'
Expand Down

0 comments on commit 8ff5371

Please sign in to comment.