diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index 741d47ea70..968dcec1bf 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -352,6 +352,36 @@ test_pytest_linux: --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} --app-info-filepattern \"list_job_*.txt\" +test_pytest_macos: + extends: + - .host_test_template + - .before_script:build:macos + tags: + - macos_shell + artifacts: + paths: + - XUNIT_RESULT.xml + - pytest-embedded/ + - "**/build*/build_log.txt" + reports: + junit: XUNIT_RESULT.xml + script: + - run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -vv + --target linux + --pytest-apps + -m \"host_test and macos_shell\" + --collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt" + --modified-components ${MR_MODIFIED_COMPONENTS} + --modified-files ${MR_MODIFIED_FILES} + - python tools/ci/get_known_failure_cases_file.py + - run_cmd pytest + --target linux + -m \"host_test and macos_shell\" + --junitxml=XUNIT_RESULT.xml + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} + --app-info-filepattern \"list_job_*.txt\" + + test_idf_pytest_plugin: extends: - .host_test_template diff --git a/examples/get-started/hello_world/pytest_hello_world.py b/examples/get-started/hello_world/pytest_hello_world.py index caeeff16b7..3524fd9495 100644 --- a/examples/get-started/hello_world/pytest_hello_world.py +++ b/examples/get-started/hello_world/pytest_hello_world.py @@ -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 hashlib import logging from typing import Callable @@ -27,6 +26,13 @@ def test_hello_world_linux(dut: IdfDut) -> None: dut.expect('Hello world!') +@pytest.mark.linux +@pytest.mark.host_test +@pytest.mark.macos_shell +def test_hello_world_macos(dut: IdfDut) -> None: + dut.expect('Hello world!') + + def verify_elf_sha256_embedding(app: QemuApp, sha256_reported: str) -> None: sha256 = hashlib.sha256() with open(app.elf_file, 'rb') as f: diff --git a/tools/ci/idf_pytest/constants.py b/tools/ci/idf_pytest/constants.py index 89f3bbe1c1..2886b3ac0a 100644 --- a/tools/ci/idf_pytest/constants.py +++ b/tools/ci/idf_pytest/constants.py @@ -46,6 +46,7 @@ SPECIAL_MARKERS = { ENV_MARKERS = { # special markers 'qemu': 'build and test using qemu, not real target', + 'macos_shell': 'tests should be run on macos hosts', # single-dut markers 'generic': 'tests should be run on generic runners', 'flash_suspend': 'support flash suspend feature',