add esp32c2 pytest

This commit is contained in:
liyashuai
2024-04-24 10:31:06 +08:00
parent 0aac1d35e5
commit 190af4c3f3
4 changed files with 97 additions and 4 deletions
+33
View File
@@ -230,6 +230,28 @@ build_esp_matter_examples_pytest_H2_idf_v5_1:
- pip install -r tools/ci/requirements-build.txt
- 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:
extends:
- .build_examples_template
@@ -307,6 +329,17 @@ pytest_esp32c6_esp_matter_dut:
- pytest examples/ --target esp32c6 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
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:
stage: target_test
image: ${TARGET_TEST_ENV}
+41 -2
View File
@@ -54,7 +54,46 @@ def test_matter_commissioning_c3(dut:Dut) -> None:
print(out_str)
result = re.findall(r'Run command failure', str(out_str))
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.esp_matter_dut
@@ -93,7 +132,7 @@ def test_matter_commissioning_c6(dut:Dut) -> None:
print(out_str)
result = re.findall(r'Run command failure', str(out_str))
if len(result) != 0:
assert False
assert False
# get the host interface name
+2 -1
View File
@@ -19,12 +19,13 @@ filterwarnings =
markers =
# target markers
esp32c3: support esp32c3 target
esp32c2: support esp32c2 target
esp32c6: support esp32c6 target
esp32h2: support esp32h2 target
esp32s3: support esp32s3 target
# env markers
esp_matter_dut: esp matter runner which have single dut
# log related
log_cli = True
log_cli_level = INFO
+21 -1
View File
@@ -40,6 +40,13 @@ MAINFEST_FILES = [
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:
print(app.name, app.target)
for pytest_app in PYTEST_C6_APPS:
@@ -60,6 +67,12 @@ def _is_c3_pytest_app(app: App) -> bool:
return True
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(
paths: List[str],
target: str,
@@ -83,7 +96,7 @@ def main(args: argparse.Namespace) -> None:
apps = get_cmake_apps(args.paths, args.target, args.config)
# 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:
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:
@@ -92,6 +105,8 @@ def main(args: argparse.Namespace) -> None:
apps_for_build = [app for app in apps if _is_h2_pytest_app(app)]
elif args.pytest_c3:
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:
apps_for_build = apps[:]
@@ -167,6 +182,11 @@ if __name__ == '__main__':
action="store_true",
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(
'--collect-size-info',
type=argparse.FileType('w'),