mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
add esp32c2 pytest
This commit is contained in:
@@ -230,6 +230,28 @@ build_esp_matter_examples_pytest_H2_idf_v5_1:
|
|||||||
- pip install -r tools/ci/requirements-build.txt
|
- pip install -r tools/ci/requirements-build.txt
|
||||||
- python tools/ci/build_apps.py ./examples --pytest_h2
|
- python tools/ci/build_apps.py ./examples --pytest_h2
|
||||||
|
|
||||||
|
build_esp_matter_examples_pytest_C2_idf_v5_1:
|
||||||
|
extends:
|
||||||
|
- .build_examples_template
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- "examples/**/build*/size.json"
|
||||||
|
- "examples/**/build*/build_log.txt"
|
||||||
|
- "examples/**/build*/*.bin"
|
||||||
|
- "examples/**/build*/flasher_args.json"
|
||||||
|
- "examples/**/build*/config/sdkconfig.json"
|
||||||
|
- "examples/**/build*/bootloader/*.bin"
|
||||||
|
- "examples/**/build*/partition_table/*.bin"
|
||||||
|
- "connectedhomeip/connectedhomeip/out/host/chip-tool"
|
||||||
|
when: always
|
||||||
|
expire_in: 4 days
|
||||||
|
variables:
|
||||||
|
IDF_VERSION: "v5.2.1"
|
||||||
|
script:
|
||||||
|
- cd ${ESP_MATTER_PATH}
|
||||||
|
- pip install -r tools/ci/requirements-build.txt
|
||||||
|
- python tools/ci/build_apps.py ./examples --pytest_c2
|
||||||
|
|
||||||
build_esp_matter_examples_non_pytest_idf_v5_1:
|
build_esp_matter_examples_non_pytest_idf_v5_1:
|
||||||
extends:
|
extends:
|
||||||
- .build_examples_template
|
- .build_examples_template
|
||||||
@@ -307,6 +329,17 @@ pytest_esp32c6_esp_matter_dut:
|
|||||||
- pytest examples/ --target esp32c6 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
|
- pytest examples/ --target esp32c6 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
|
||||||
tags: ["esp32c6", "esp_matter_dut"]
|
tags: ["esp32c6", "esp_matter_dut"]
|
||||||
|
|
||||||
|
pytest_esp32c2_esp_matter_dut:
|
||||||
|
stage: target_test
|
||||||
|
image: ${TARGET_TEST_ENV}
|
||||||
|
needs:
|
||||||
|
- build_esp_matter_examples_pytest_C2_idf_v5_1
|
||||||
|
script:
|
||||||
|
- cd ${ESP_MATTER_PATH}
|
||||||
|
- pip install -r tools/ci/requirements-pytest.txt
|
||||||
|
- pytest examples/ --target esp32c2 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
|
||||||
|
tags: ["esp32c2", "esp_matter_dut"]
|
||||||
|
|
||||||
pytest_esp32h2_esp_matter_dut:
|
pytest_esp32h2_esp_matter_dut:
|
||||||
stage: target_test
|
stage: target_test
|
||||||
image: ${TARGET_TEST_ENV}
|
image: ${TARGET_TEST_ENV}
|
||||||
|
|||||||
@@ -54,7 +54,46 @@ def test_matter_commissioning_c3(dut:Dut) -> None:
|
|||||||
print(out_str)
|
print(out_str)
|
||||||
result = re.findall(r'Run command failure', str(out_str))
|
result = re.findall(r'Run command failure', str(out_str))
|
||||||
if len(result) != 0:
|
if len(result) != 0:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
@pytest.mark.esp32c2
|
||||||
|
@pytest.mark.esp_matter_dut
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
' count, app_path, target, erase_all', [
|
||||||
|
( 1, pytest_build_dir, 'esp32c2', 'y'),
|
||||||
|
],
|
||||||
|
indirect=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Matter over wifi commissioning
|
||||||
|
def test_matter_commissioning_c2(dut:Dut) -> None:
|
||||||
|
light = dut
|
||||||
|
# BLE start advertising
|
||||||
|
light.expect(r'chip\[DL\]\: Configuring CHIPoBLE advertising', timeout=20)
|
||||||
|
# Start commissioning
|
||||||
|
time.sleep(5)
|
||||||
|
command = CHIP_TOOL_EXE + ' pairing ble-wifi 1 ChipTEH2 chiptest123 20202021 3840'
|
||||||
|
out_str = subprocess.getoutput(command)
|
||||||
|
print(out_str)
|
||||||
|
result = re.findall(r'Run command failure', str(out_str))
|
||||||
|
if len(result) != 0:
|
||||||
|
assert False
|
||||||
|
# Use toggle command to turn-off the light
|
||||||
|
time.sleep(3)
|
||||||
|
command = CHIP_TOOL_EXE + ' onoff toggle 1 1'
|
||||||
|
out_str = subprocess.getoutput(command)
|
||||||
|
print(out_str)
|
||||||
|
result = re.findall(r'Run command failure', str(out_str))
|
||||||
|
if len(result) != 0:
|
||||||
|
assert False
|
||||||
|
# Use toggle command to turn-on the light
|
||||||
|
time.sleep(5)
|
||||||
|
command = CHIP_TOOL_EXE + ' onoff toggle 1 1'
|
||||||
|
out_str = subprocess.getoutput(command)
|
||||||
|
print(out_str)
|
||||||
|
result = re.findall(r'Run command failure', str(out_str))
|
||||||
|
if len(result) != 0:
|
||||||
|
assert False
|
||||||
|
|
||||||
@pytest.mark.esp32c6
|
@pytest.mark.esp32c6
|
||||||
@pytest.mark.esp_matter_dut
|
@pytest.mark.esp_matter_dut
|
||||||
@@ -93,7 +132,7 @@ def test_matter_commissioning_c6(dut:Dut) -> None:
|
|||||||
print(out_str)
|
print(out_str)
|
||||||
result = re.findall(r'Run command failure', str(out_str))
|
result = re.findall(r'Run command failure', str(out_str))
|
||||||
if len(result) != 0:
|
if len(result) != 0:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
||||||
# get the host interface name
|
# get the host interface name
|
||||||
|
|||||||
+2
-1
@@ -19,12 +19,13 @@ filterwarnings =
|
|||||||
markers =
|
markers =
|
||||||
# target markers
|
# target markers
|
||||||
esp32c3: support esp32c3 target
|
esp32c3: support esp32c3 target
|
||||||
|
esp32c2: support esp32c2 target
|
||||||
esp32c6: support esp32c6 target
|
esp32c6: support esp32c6 target
|
||||||
esp32h2: support esp32h2 target
|
esp32h2: support esp32h2 target
|
||||||
esp32s3: support esp32s3 target
|
esp32s3: support esp32s3 target
|
||||||
# env markers
|
# env markers
|
||||||
esp_matter_dut: esp matter runner which have single dut
|
esp_matter_dut: esp matter runner which have single dut
|
||||||
|
|
||||||
# log related
|
# log related
|
||||||
log_cli = True
|
log_cli = True
|
||||||
log_cli_level = INFO
|
log_cli_level = INFO
|
||||||
|
|||||||
+21
-1
@@ -40,6 +40,13 @@ MAINFEST_FILES = [
|
|||||||
str(PROJECT_ROOT / 'examples' / '.build-rules.yml'),
|
str(PROJECT_ROOT / 'examples' / '.build-rules.yml'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
PYTEST_C2_APPS = [
|
||||||
|
{"target": "esp32c2", "name": "light"},
|
||||||
|
]
|
||||||
|
MAINFEST_FILES = [
|
||||||
|
str(PROJECT_ROOT / 'examples' / '.build-rules.yml'),
|
||||||
|
]
|
||||||
|
|
||||||
def _is_c6_pytest_app(app: App) -> bool:
|
def _is_c6_pytest_app(app: App) -> bool:
|
||||||
print(app.name, app.target)
|
print(app.name, app.target)
|
||||||
for pytest_app in PYTEST_C6_APPS:
|
for pytest_app in PYTEST_C6_APPS:
|
||||||
@@ -60,6 +67,12 @@ def _is_c3_pytest_app(app: App) -> bool:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _is_c2_pytest_app(app: App) -> bool:
|
||||||
|
for pytest_app in PYTEST_C2_APPS:
|
||||||
|
if app.name == pytest_app["name"] and app.target == pytest_app["target"]:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def get_cmake_apps(
|
def get_cmake_apps(
|
||||||
paths: List[str],
|
paths: List[str],
|
||||||
target: str,
|
target: str,
|
||||||
@@ -83,7 +96,7 @@ def main(args: argparse.Namespace) -> None:
|
|||||||
apps = get_cmake_apps(args.paths, args.target, args.config)
|
apps = get_cmake_apps(args.paths, args.target, args.config)
|
||||||
|
|
||||||
# no_pytest and only_pytest can not be both True
|
# no_pytest and only_pytest can not be both True
|
||||||
assert not (args.no_pytest and args.pytest_c6 and args.pytest_h2 and args.pytest_c3)
|
assert not (args.no_pytest and args.pytest_c6 and args.pytest_h2 and args.pytest_c3 and args.pytest_c2)
|
||||||
if args.no_pytest:
|
if args.no_pytest:
|
||||||
apps_for_build = [app for app in apps if not (_is_c6_pytest_app(app) or _is_h2_pytest_app(app))]
|
apps_for_build = [app for app in apps if not (_is_c6_pytest_app(app) or _is_h2_pytest_app(app))]
|
||||||
elif args.pytest_c6:
|
elif args.pytest_c6:
|
||||||
@@ -92,6 +105,8 @@ def main(args: argparse.Namespace) -> None:
|
|||||||
apps_for_build = [app for app in apps if _is_h2_pytest_app(app)]
|
apps_for_build = [app for app in apps if _is_h2_pytest_app(app)]
|
||||||
elif args.pytest_c3:
|
elif args.pytest_c3:
|
||||||
apps_for_build = [app for app in apps if _is_c3_pytest_app(app)]
|
apps_for_build = [app for app in apps if _is_c3_pytest_app(app)]
|
||||||
|
elif args.pytest_c2:
|
||||||
|
apps_for_build = [app for app in apps if _is_c2_pytest_app(app)]
|
||||||
else:
|
else:
|
||||||
apps_for_build = apps[:]
|
apps_for_build = apps[:]
|
||||||
|
|
||||||
@@ -167,6 +182,11 @@ if __name__ == '__main__':
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help='Only build pytest apps, definded in PYTEST_C3_APPS',
|
help='Only build pytest apps, definded in PYTEST_C3_APPS',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--pytest_c2',
|
||||||
|
action="store_true",
|
||||||
|
help='Only build pytest apps, definded in PYTEST_C2_APPS',
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--collect-size-info',
|
'--collect-size-info',
|
||||||
type=argparse.FileType('w'),
|
type=argparse.FileType('w'),
|
||||||
|
|||||||
Reference in New Issue
Block a user