ci(target-test): support timeout 4h markers

This commit is contained in:
Fu Hanxi
2024-11-26 11:11:48 +01:00
committed by Euripedes Rocha
parent 72fbf37648
commit eea2fdf9a9
5 changed files with 22 additions and 1 deletions

View File

@@ -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_BUILD_CHILD_PIPELINE_NAME = 'Build Child Pipeline'
DEFAULT_TARGET_TEST_CHILD_PIPELINE_NAME = 'Target Test 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' TEST_RELATED_BUILD_JOB_NAME = 'build_test_related_apps'
NON_TEST_RELATED_BUILD_JOB_NAME = 'build_non_test_related_apps' NON_TEST_RELATED_BUILD_JOB_NAME = 'build_non_test_related_apps'

View File

@@ -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_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_FILEPATH
from dynamic_pipelines.constants import DEFAULT_TARGET_TEST_CHILD_PIPELINE_NAME 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 DEFAULT_TEST_PATHS
from dynamic_pipelines.constants import ( from dynamic_pipelines.constants import (
KNOWN_GENERATE_TEST_CHILD_PIPELINE_WARNINGS_FILEPATH, 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 EmptyJob
from dynamic_pipelines.models import Job from dynamic_pipelines.models import Job
from dynamic_pipelines.models import TargetTestJob from dynamic_pipelines.models import TargetTestJob
from dynamic_pipelines.utils import dump_jobs_to_yaml from dynamic_pipelines.utils import dump_jobs_to_yaml
from idf_build_apps import App from idf_build_apps import App
from idf_ci.app import import_apps_from_txt 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 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) print('WARNING: excluding test cases with runner tags:', runner_tags)
continue 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( target_test_job = TargetTestJob(
extends=_extends,
name=f'{target_selector} - {",".join(env_markers)}', name=f'{target_selector} - {",".join(env_markers)}',
tags=runner_tags, tags=runner_tags,
parallel=len(cases) // DEFAULT_CASES_TEST_PER_JOB + 1, parallel=len(cases) // DEFAULT_CASES_TEST_PER_JOB + 1,

View File

@@ -94,3 +94,6 @@
- section_start "upload_junit_reports" - section_start "upload_junit_reports"
- run_cmd python tools/ci/artifacts_handler.py upload --type logs junit_reports - run_cmd python tools/ci/artifacts_handler.py upload --type logs junit_reports
- section_end "upload_junit_reports" - section_end "upload_junit_reports"
.timeout_4h_template:
timeout: 4 hours

View File

@@ -75,6 +75,7 @@ ENV_MARKERS = {
'twai_transceiver': 'runners with a TWAI PHY transceiver', 'twai_transceiver': 'runners with a TWAI PHY transceiver',
'flash_encryption_wifi_high_traffic': 'Flash Encryption runners with wifi high traffic support', 'flash_encryption_wifi_high_traffic': 'Flash Encryption runners with wifi high traffic support',
'ethernet': 'ethernet runner', 'ethernet': 'ethernet runner',
'ethernet_stress': 'ethernet runner with stress test',
'ethernet_flash_8m': 'ethernet runner with 8mb flash', 'ethernet_flash_8m': 'ethernet runner with 8mb flash',
'ethernet_router': 'both the runner and dut connect to the same router through ethernet NIC', 'ethernet_router': 'both the runner and dut connect to the same router through ethernet NIC',
'ethernet_vlan': 'ethernet runner GARM-32-SH-1-R16S5N3', 'ethernet_vlan': 'ethernet runner GARM-32-SH-1-R16S5N3',
@@ -127,6 +128,11 @@ ENV_MARKERS = {
'ram_app': 'ram_app runners', '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_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_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') DEFAULT_BUILD_TEST_RULES_FILEPATH = os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml')

View File

@@ -238,7 +238,7 @@ def test_mqtt_publish(dut: Dut, test_case: Any) -> None:
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.ethernet @pytest.mark.ethernet_stress
@pytest.mark.nightly_run @pytest.mark.nightly_run
@pytest.mark.parametrize('test_case', stress_test_cases) @pytest.mark.parametrize('test_case', stress_test_cases)
@pytest.mark.parametrize('config', ['default'], indirect=True) @pytest.mark.parametrize('config', ['default'], indirect=True)