From fe39b922caaec35cb164ceab98cb952a334ab96d Mon Sep 17 00:00:00 2001 From: Chen Sheng Date: Fri, 2 Dec 2022 11:12:00 +0800 Subject: [PATCH] seperate ble wifi environment and support ci esp32c2 --- .gitlab/ci/README.md | 2 +- .gitlab/ci/assign-test.yml | 1 + .gitlab/ci/dependencies/dependencies.yml | 11 +- .gitlab/ci/rules.yml | 58 ++++- .gitlab/ci/target-test.yml | 215 +++++++++++++----- tools/ci/integration_test/KnownIssues | 11 +- tools/ci/integration_test/README.md | 13 +- .../ci/integration_test/prepare_test_bins.py | 74 ------ .../test_configs/nvs_compatible_test_.yml | 11 - 9 files changed, 233 insertions(+), 163 deletions(-) delete mode 100644 tools/ci/integration_test/prepare_test_bins.py delete mode 100644 tools/ci/integration_test/test_configs/nvs_compatible_test_.yml diff --git a/.gitlab/ci/README.md b/.gitlab/ci/README.md index 8a8051e904..82b5ea6aae 100644 --- a/.gitlab/ci/README.md +++ b/.gitlab/ci/README.md @@ -56,7 +56,7 @@ - `example_test[_esp32/esp32s2/...]` - `fuzzer_test` - `host_test` -- `integration_test` +- `integration_test[_wifi/ble]` - `iperf_stress_test` - `macos` - `macos_test` diff --git a/.gitlab/ci/assign-test.yml b/.gitlab/ci/assign-test.yml index fd616f929a..636d6160e1 100644 --- a/.gitlab/ci/assign-test.yml +++ b/.gitlab/ci/assign-test.yml @@ -90,6 +90,7 @@ assign_integration_test: needs: - build_ssc_esp32 - build_ssc_esp32c3 + - build_ssc_esp32c2 artifacts: paths: - $TEST_DIR/test_configs diff --git a/.gitlab/ci/dependencies/dependencies.yml b/.gitlab/ci/dependencies/dependencies.yml index 15dcd38e6f..87a15d404f 100644 --- a/.gitlab/ci/dependencies/dependencies.yml +++ b/.gitlab/ci/dependencies/dependencies.yml @@ -177,13 +177,20 @@ build:integration_test: - "build:example_test" - build:target_test -"test:integration_test": +"test:integration_test_{0}": + matrix: + - - wifi + - ble labels: + - integration_test_{0} - integration_test - target_test patterns: - - integration_test + - integration_test_{0} + - target_test_{0} + # - maybe others included_in: + - test:integration_test - build:integration_test - build:target_test diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 9465472572..d40a017b96 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -93,14 +93,18 @@ - "examples/common_components/iperf/**/*" - "examples/openthread/**/*" -.patterns-integration_test: &patterns-integration_test +.patterns-integration_test_ble: &patterns-integration_test_ble - "tools/ci/python_packages/gitlab_api.py" - "tools/ci/integration_test/**/*" - - "components/bt/controller/lib_esp32" - "components/bt/controller/lib_esp32c3_family" - "components/bt/controller/lib_esp32h2/esp32h2-bt-lib" - "components/bt/host/nimble/nimble" + - "components/esp_phy/lib" + +.patterns-integration_test_wifi: &patterns-integration_test_wifi + - "tools/ci/python_packages/gitlab_api.py" + - "tools/ci/integration_test/**/*" - "components/esp_wifi/lib" - "components/esp_phy/lib" @@ -450,6 +454,12 @@ .if-label-integration_test: &if-label-integration_test if: '$BOT_LABEL_INTEGRATION_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test(?:,[^,\n\r]+)*$/i' +.if-label-integration_test_ble: &if-label-integration_test_ble + if: '$BOT_LABEL_INTEGRATION_TEST_BLE || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_ble(?:,[^,\n\r]+)*$/i' + +.if-label-integration_test_wifi: &if-label-integration_test_wifi + if: '$BOT_LABEL_INTEGRATION_TEST_WIFI || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_wifi(?:,[^,\n\r]+)*$/i' + .if-label-iperf_stress_test: &if-label-iperf_stress_test if: '$BOT_LABEL_IPERF_STRESS_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*iperf_stress_test(?:,[^,\n\r]+)*$/i' @@ -1210,13 +1220,17 @@ - <<: *if-protected - <<: *if-label-build - <<: *if-label-integration_test + - <<: *if-label-integration_test_ble + - <<: *if-label-integration_test_wifi - <<: *if-label-target_test - <<: *if-dev-push changes: *patterns-build_components - <<: *if-dev-push changes: *patterns-build_system - <<: *if-dev-push - changes: *patterns-integration_test + changes: *patterns-integration_test_ble + - <<: *if-dev-push + changes: *patterns-integration_test_wifi .rules:build:macos: rules: @@ -1263,6 +1277,8 @@ - <<: *if-label-example_test_esp32s2 - <<: *if-label-example_test_esp32s3 - <<: *if-label-integration_test + - <<: *if-label-integration_test_ble + - <<: *if-label-integration_test_wifi - <<: *if-label-iperf_stress_test - <<: *if-label-lan8720 - <<: *if-label-target_test @@ -1300,7 +1316,9 @@ - <<: *if-dev-push changes: *patterns-example_test-wifi - <<: *if-dev-push - changes: *patterns-integration_test + changes: *patterns-integration_test_ble + - <<: *if-dev-push + changes: *patterns-integration_test_wifi - <<: *if-dev-push changes: *patterns-target_test-i154 - <<: *if-dev-push @@ -1940,9 +1958,39 @@ - <<: *if-label-build-only when: never - <<: *if-label-integration_test + - <<: *if-label-integration_test_ble + - <<: *if-label-integration_test_wifi - <<: *if-label-target_test - <<: *if-dev-push - changes: *patterns-integration_test + changes: *patterns-integration_test_ble + - <<: *if-dev-push + changes: *patterns-integration_test_wifi + +.rules:test:integration_test_ble: + rules: + - <<: *if-revert-branch + when: never + - <<: *if-protected + - <<: *if-label-build-only + when: never + - <<: *if-label-integration_test + - <<: *if-label-integration_test_ble + - <<: *if-label-target_test + - <<: *if-dev-push + changes: *patterns-integration_test_ble + +.rules:test:integration_test_wifi: + rules: + - <<: *if-revert-branch + when: never + - <<: *if-protected + - <<: *if-label-build-only + when: never + - <<: *if-label-integration_test + - <<: *if-label-integration_test_wifi + - <<: *if-label-target_test + - <<: *if-dev-push + changes: *patterns-integration_test_wifi .rules:test:submodule: rules: diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 9f72b08eb2..98b01bac63 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -1170,7 +1170,7 @@ UT_S3_FLASH: CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/ci/integration_test/test_configs" KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/tools/ci/integration_test/KnownIssues" CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py" - PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/tools/ci/integration_test/prepare_test_bins.py" + PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/tools/ci/idf_prepare_test_bins.py" PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages:${CI_PROJECT_DIR}/tools/ci/python_packages:${PYTHONPATH}" INITIAL_CONDITION_RETRY_COUNT: "1" GIT_LFS_SKIP_SMUDGE: 1 @@ -1199,8 +1199,16 @@ UT_S3_FLASH: variables: LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32C3_IDF" +.integration_test_esp32c2_template: + extends: + - .integration_test_template + variables: + LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32C2_IDF" + nvs_compatible_test: - extends: .integration_test_template + extends: + - .integration_test_template + - .rules:test:integration_test artifacts: when: always paths: @@ -1229,122 +1237,217 @@ nvs_compatible_test: - python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE - python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -IT_001: - extends: .integration_test_template +IT_T1_Simple: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi parallel: 2 tags: - ESP32_IDF - - SSC_T1_4 + - SSC_T1_Simple -IT_002: - extends: .integration_test_template +IT_T1_WAP: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - - SSC_T1_2 + - SSC_T1_WAP -IT_003: - extends: .integration_test_template +IT_T2_Simple: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi parallel: 9 tags: - ESP32_IDF - - SSC_T2_5 + - SSC_T2_Simple -IT_005: - extends: .integration_test_template +IT_T5_BT_Simple: + extends: + - .integration_test_template + - .rules:test:integration_test_ble + parallel: 3 tags: - ESP32_IDF - - SSC_T1_5 + - SSC_T5_BT_Simple -IT_006: - extends: .integration_test_template +IT_T2_BT_Simple: + extends: + - .integration_test_template + - .rules:test:integration_test_ble + parallel: 6 + tags: + - ESP32_IDF + - SSC_T2_BT_Simple + +IT_T1_BT_Dongle: + extends: + - .integration_test_template + - .rules:test:integration_test_ble + parallel: 2 + tags: + - ESP32_IDF + - SSC_T1_BT_Dongle + +IT_T1_AP: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi + tags: + - ESP32_IDF + - SSC_T1_AP + +IT_T1_AP_E: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi parallel: 5 tags: - ESP32_IDF - - SSC_T1_6 + - SSC_T1_AP_E -IT_007: - extends: .integration_test_template +IT_T1_WNIC_AP: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - - SSC_T1_7 + - SSC_T1_WNIC_AP -IT_008: - extends: .integration_test_template +IT_T1_WNIC_AP_E: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - - SSC_T1_8 + - SSC_T1_WNIC_AP_E -IT_011: - extends: .integration_test_template +IT_T1_MESH1: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - SSC_T1_MESH1 -IT_012: - extends: .integration_test_template +IT_T2_MESH1: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi parallel: 2 tags: - ESP32_IDF - SSC_T2_MESH1 -IT_013: - extends: .integration_test_template +IT_T3_MESH1: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - SSC_T3_MESH1 -IT_014: - extends: .integration_test_template +IT_T6_MESH1: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - SSC_T6_MESH1 -IT_015: - extends: .integration_test_template +IT_T12_MESH1: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - SSC_T12_MESH1 -IT_016: - extends: .integration_test_template +IT_T50_MESH1: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi allow_failure: true tags: - ESP32_IDF - SSC_T50_MESH1 -IT_017: - extends: .integration_test_template +IT_T1_MESH2: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - SSC_T1_MESH2 -IT_018: - extends: .integration_test_template +IT_T2_WNIC: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - - SSC_T1_9 + - SSC_T2_WNIC -IT_019: - extends: .integration_test_template +IT_T2_AP: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - - SSC_T2_2 + - SSC_T2_AP -IT_020: - extends: .integration_test_template +IT_T3_Simple: + extends: + - .integration_test_template + - .rules:test:integration_test_wifi tags: - ESP32_IDF - - SSC_T2_3 + - SSC_T3_Simple -IT_022: - extends: .integration_test_template - tags: - - ESP32_IDF - - SSC_T3_2 - -IT_C3_001: - extends: .integration_test_esp32c3_template - parallel: 6 +IT_C3_T2_BT_Simple: + extends: + - .integration_test_esp32c3_template + - .rules:test:integration_test_ble + parallel: 11 tags: - ESP32C3_IDF - - SSC_T2_5 + - SSC_T2_BT_Simple + +IT_C3_T5_BT_Simple: + extends: + - .integration_test_esp32c3_template + - .rules:test:integration_test_ble + parallel: 5 + tags: + - ESP32C3_IDF + - SSC_T5_BT_Simple + +IT_C3_T1_BT_Dongle: + extends: + - .integration_test_esp32c3_template + - .rules:test:integration_test_ble + image: gitlab.espressif.cn:5050/qa/dockerfiles/integration-test-env-dbg:1 + parallel: 2 + tags: + - ESP32C3_IDF + - SSC_T1_BT_Dongle + +IT_C2_T2_BT_Simple: + extends: + - .integration_test_esp32c2_template + - .rules:test:integration_test_ble + parallel: 9 + tags: + - ESP32C2_IDF + - SSC_T2_BT_Simple + +IT_C2_T1_BT_Dongle: + extends: + - .integration_test_esp32c2_template + - .rules:test:integration_test_ble + image: gitlab.espressif.cn:5050/qa/dockerfiles/integration-test-env-dbg:1 + parallel: 2 + tags: + - ESP32C2_IDF + - SSC_T1_BT_Dongle diff --git a/tools/ci/integration_test/KnownIssues b/tools/ci/integration_test/KnownIssues index 73647f9bd9..186b7a90c3 100644 --- a/tools/ci/integration_test/KnownIssues +++ b/tools/ci/integration_test/KnownIssues @@ -1,7 +1,12 @@ # CI -ESP32.NIMBLE_GATT_60015 ESP32.BLUEDROID_GAP_03003 -ESP32.BTPROF_A2DP_04011 -ESP32.BTPROF_A2DP_05011 +ESP32.NIMBLE_GAP_11002 +ESP32.NIMBLE_GAP_14007 ESP32C3.NIMBLE_GAP_14009 + +ESP32C2.NIMBLE_GAP_03001 +ESP32C2.NIMBLE_GAP_03004 +ESP32C2.BLUEDROID_GAP_23004 +ESP32C2.BLUEDROID_GAP_03001 +ESP32C2.BLUEDROID_GAP_03004 diff --git a/tools/ci/integration_test/README.md b/tools/ci/integration_test/README.md index 16afb7650b..40d81e78c4 100644 --- a/tools/ci/integration_test/README.md +++ b/tools/ci/integration_test/README.md @@ -6,16 +6,7 @@ ## Trigger - By labels: - - `integration_test` + - `integration_test[_wifi/ble]` - By file changes: - integration test related files -- By bot: - - `@bot test with label: integration_test` - -## Advanced -- There are labels can be used to run less integration test cases. - - These labels only take effect when the integration test has been triggered. - - label: `integration::wifi_only` - - Only run WiFi cases. - - label: `integration::ble_only` - - Only run BLE cases. + - See `patterns-integration_test[_wifi/ble]` in `.gitlab/ci/rules.yml` diff --git a/tools/ci/integration_test/prepare_test_bins.py b/tools/ci/integration_test/prepare_test_bins.py deleted file mode 100644 index 48d847c7c8..0000000000 --- a/tools/ci/integration_test/prepare_test_bins.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: Apache-2.0 - -import argparse -import os - -import gitlab - -try: - import gitlab_api -except ImportError: - import sys - sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python_packages')) - import gitlab_api - -from AutoTestScript.RunnerConfigs.Config import Config - -SSC_BUILD_JOB_MAP = { - 'ESP32': 'build_ssc_esp32', - 'ESP32C3': 'build_ssc_esp32c3', -} -NEEDED_FILES = [ - 'flasher_args.json', - 'bootloader/bootloader.bin', - 'partition_table/partition-table.bin', - 'ssc.bin', - 'ssc.elf', -] -IDF_PATH = os.environ.get('IDF_PATH') - - -def try_to_download_artifacts(bin_path: str) -> None: - ''' - bin_path: "SSC/ssc_bin/ESP32[C3]/SSC[_APP]" - ''' - project_id = os.getenv('CI_PROJECT_ID') - pipeline_id = os.getenv('CI_PIPELINE_ID') - gitlab_inst = gitlab_api.Gitlab(project_id) - build_job_name = SSC_BUILD_JOB_MAP[bin_path.split('/')[-2]] - job_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id) - files_to_download = [os.path.join(bin_path, f) for f in NEEDED_FILES] - for job_info in job_list: - try: - gitlab_inst.download_artifact(job_info['id'], files_to_download, IDF_PATH) - print('Downloaded {} from {}'.format(bin_path, job_info['id'])) - break - except gitlab.exceptions.GitlabError as e: - if e.response_code == 404: - continue - raise - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument( - 'test_config_file', - help='The test config file to be used.' - ) - args = parser.parse_args() - - configs = Config.parse(args.test_config_file) - test_bin_paths = configs.get_bin_paths() - - for _path in test_bin_paths: - if os.path.exists(_path): - continue - relative_path = os.path.relpath(_path, IDF_PATH) - try_to_download_artifacts(relative_path) - - -if __name__ == '__main__': - main() diff --git a/tools/ci/integration_test/test_configs/nvs_compatible_test_.yml b/tools/ci/integration_test/test_configs/nvs_compatible_test_.yml deleted file mode 100644 index 582774492d..0000000000 --- a/tools/ci/integration_test/test_configs/nvs_compatible_test_.yml +++ /dev/null @@ -1,11 +0,0 @@ -BinPath: - path: SSC/ssc_bin/ESP32/SSC_BLE_WIFI - test app: SSC_BLE_WIFI - -DUT: [SSC1] - -Filter: -- Add: - SDK: ESP32_IDF - Test App: SSC_BLE_WIFI - summary: 'use old NVS data WIFI function test'