From eea2fdf9a94ac01bff00859607cedbedb69695d1 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Tue, 26 Nov 2024 11:11:48 +0100 Subject: [PATCH] ci(target-test): support timeout 4h markers --- tools/ci/dynamic_pipelines/constants.py | 3 +++ .../scripts/generate_target_test_child_pipeline.py | 9 +++++++++ tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml | 3 +++ tools/ci/idf_pytest/constants.py | 6 ++++++ .../mqtt/publish_connect_test/pytest_mqtt_publish_app.py | 2 +- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tools/ci/dynamic_pipelines/constants.py b/tools/ci/dynamic_pipelines/constants.py index c0c90c4d27..d724cbfe15 100644 --- a/tools/ci/dynamic_pipelines/constants.py +++ b/tools/ci/dynamic_pipelines/constants.py @@ -20,6 +20,9 @@ DEFAULT_TARGET_TEST_CHILD_PIPELINE_FILEPATH = os.path.join(IDF_PATH, 'target_tes DEFAULT_BUILD_CHILD_PIPELINE_NAME = 'Build Child Pipeline' DEFAULT_TARGET_TEST_CHILD_PIPELINE_NAME = 'Target Test Child Pipeline' +DEFAULT_TARGET_TEST_JOB_TEMPLATE_NAME = '.dynamic_target_test_template' +TIMEOUT_4H_TEMPLATE_NAME = '.timeout_4h_template' + TEST_RELATED_BUILD_JOB_NAME = 'build_test_related_apps' NON_TEST_RELATED_BUILD_JOB_NAME = 'build_non_test_related_apps' diff --git a/tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py b/tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py index 019bc789a6..d845311170 100644 --- a/tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py +++ b/tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py @@ -19,16 +19,19 @@ from dynamic_pipelines.constants import BUILD_ONLY_LABEL from dynamic_pipelines.constants import DEFAULT_CASES_TEST_PER_JOB from dynamic_pipelines.constants import DEFAULT_TARGET_TEST_CHILD_PIPELINE_FILEPATH from dynamic_pipelines.constants import DEFAULT_TARGET_TEST_CHILD_PIPELINE_NAME +from dynamic_pipelines.constants import DEFAULT_TARGET_TEST_JOB_TEMPLATE_NAME from dynamic_pipelines.constants import DEFAULT_TEST_PATHS from dynamic_pipelines.constants import ( KNOWN_GENERATE_TEST_CHILD_PIPELINE_WARNINGS_FILEPATH, ) +from dynamic_pipelines.constants import TIMEOUT_4H_TEMPLATE_NAME from dynamic_pipelines.models import EmptyJob from dynamic_pipelines.models import Job from dynamic_pipelines.models import TargetTestJob from dynamic_pipelines.utils import dump_jobs_to_yaml from idf_build_apps import App from idf_ci.app import import_apps_from_txt +from idf_pytest.constants import TIMEOUT_4H_MARKERS from idf_pytest.script import get_pytest_cases @@ -82,7 +85,13 @@ def get_target_test_jobs( print('WARNING: excluding test cases with runner tags:', runner_tags) continue + _extends = [DEFAULT_TARGET_TEST_JOB_TEMPLATE_NAME] + for timeout_4h_marker in TIMEOUT_4H_MARKERS: + if timeout_4h_marker in env_markers: + _extends.append(TIMEOUT_4H_TEMPLATE_NAME) + target_test_job = TargetTestJob( + extends=_extends, name=f'{target_selector} - {",".join(env_markers)}', tags=runner_tags, parallel=len(cases) // DEFAULT_CASES_TEST_PER_JOB + 1, diff --git a/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml b/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml index 4d78137e60..06a63fc0bd 100644 --- a/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml +++ b/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml @@ -94,3 +94,6 @@ - section_start "upload_junit_reports" - run_cmd python tools/ci/artifacts_handler.py upload --type logs junit_reports - section_end "upload_junit_reports" + +.timeout_4h_template: + timeout: 4 hours diff --git a/tools/ci/idf_pytest/constants.py b/tools/ci/idf_pytest/constants.py index 1aa138b87b..b0dbcaf5f0 100644 --- a/tools/ci/idf_pytest/constants.py +++ b/tools/ci/idf_pytest/constants.py @@ -75,6 +75,7 @@ ENV_MARKERS = { 'twai_transceiver': 'runners with a TWAI PHY transceiver', 'flash_encryption_wifi_high_traffic': 'Flash Encryption runners with wifi high traffic support', 'ethernet': 'ethernet runner', + 'ethernet_stress': 'ethernet runner with stress test', 'ethernet_flash_8m': 'ethernet runner with 8mb flash', 'ethernet_router': 'both the runner and dut connect to the same router through ethernet NIC', 'ethernet_vlan': 'ethernet runner GARM-32-SH-1-R16S5N3', @@ -127,6 +128,11 @@ ENV_MARKERS = { 'ram_app': 'ram_app runners', } +# by default the timeout is 1h, for some special cases we need to extend it +TIMEOUT_4H_MARKERS = [ + 'ethernet_stress', +] + DEFAULT_CONFIG_RULES_STR = ['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'] DEFAULT_IGNORE_WARNING_FILEPATH = os.path.join(IDF_PATH, 'tools', 'ci', 'ignore_build_warnings.txt') DEFAULT_BUILD_TEST_RULES_FILEPATH = os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml') diff --git a/tools/test_apps/protocols/mqtt/publish_connect_test/pytest_mqtt_publish_app.py b/tools/test_apps/protocols/mqtt/publish_connect_test/pytest_mqtt_publish_app.py index 2a2c0c89ca..366c56f255 100644 --- a/tools/test_apps/protocols/mqtt/publish_connect_test/pytest_mqtt_publish_app.py +++ b/tools/test_apps/protocols/mqtt/publish_connect_test/pytest_mqtt_publish_app.py @@ -238,7 +238,7 @@ def test_mqtt_publish(dut: Dut, test_case: Any) -> None: @pytest.mark.esp32 -@pytest.mark.ethernet +@pytest.mark.ethernet_stress @pytest.mark.nightly_run @pytest.mark.parametrize('test_case', stress_test_cases) @pytest.mark.parametrize('config', ['default'], indirect=True)