Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | //------------------------------------------------------------------------------- |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 3 | // Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 4 | // |
| 5 | // SPDX-License-Identifier: BSD-3-Clause |
| 6 | // |
| 7 | //------------------------------------------------------------------------------- |
| 8 | |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 9 | @Library('trustedfirmware') _ |
| 10 | import org.trustedfirmware.Gerrit |
| 11 | import org.trustedfirmware.Summary |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 12 | |
Xinyu Zhang | 0aced4c | 2021-09-03 17:06:21 +0800 | [diff] [blame] | 13 | failure_states = ["FAILURE", "ABORTED", "UNSTABLE", "NOT_BUILT"] |
| 14 | |
Summer Qin | 3c2b572 | 2021-05-26 10:43:45 +0800 | [diff] [blame] | 15 | mapPlatform = ["cypress/psoc64": "psoc64", |
| 16 | "arm/mps2/an519": "AN519", |
| 17 | "arm/mps2/an521": "AN521", |
| 18 | "arm/mps2/an539": "AN539", |
| 19 | "arm/mps2/sse-200_aws": "SSE-200_AWS", |
| 20 | "arm/mps3/an524": "AN524", |
| 21 | "arm/musca_b1/sse_200": "MUSCA_B1", |
| 22 | "arm/musca_b1/secure_enclave": "MUSCA_B1_SE", |
Arthur She | 19c0e1a | 2021-06-02 11:06:19 -0700 | [diff] [blame] | 23 | "arm/musca_s1": "MUSCA_S1", |
Xinyu Zhang | fcb6aad | 2021-08-25 16:24:11 +0800 | [diff] [blame] | 24 | "stm/stm32l562e_dk": "stm32l562e_dk", |
Xinyu Zhang | 6afdd61 | 2021-10-12 17:07:32 +0800 | [diff] [blame] | 25 | "arm/corstone1000": "corstone1000", |
Arthur She | f365774 | 2021-09-07 14:23:18 -0700 | [diff] [blame] | 26 | "nxp/lpcxpresso55s69": "lpcxpresso55s69"] |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 27 | |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 28 | mapBL2 = ["True": "--bl2", |
| 29 | "False": ""] |
| 30 | |
| 31 | mapTestPsaApi = ["OFF": "", |
Xinyu Zhang | 39acb41 | 2021-07-09 20:35:19 +0800 | [diff] [blame] | 32 | "STORAGE": "STORAGE", |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 33 | "CRYPTO": "Crypto", |
| 34 | "INITIAL_ATTESTATION": "Attest", |
| 35 | "IPC": "FF"] |
| 36 | |
Xinyu Zhang | 73ed299 | 2021-09-15 11:38:23 +0800 | [diff] [blame] | 37 | // LIB_MODEL, ISOLATION_LEVEL, TEST_REG, TEST_PSA_API, PROFILE, CONFIG_NAME |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 38 | mapConfigs = [ |
Xinyu Zhang | 73ed299 | 2021-09-15 11:38:23 +0800 | [diff] [blame] | 39 | ["True", "1", "False", "OFF", "N.A", "Default"], |
| 40 | ["False", "1", "False", "OFF", "N.A", "CoreIPC"], |
| 41 | ["False", "2", "False", "OFF", "N.A", "CoreIPCTfmLevel2"], |
| 42 | ["False", "3", "False", "OFF", "N.A", "CoreIPCTfmLevel3"], |
| 43 | ["True", "1", "False", "OFF", "profile_small", "DefaultProfileS"], |
| 44 | ["False", "2", "False", "OFF", "profile_medium", "DefaultProfileM"], |
| 45 | ["False", "3", "False", "OFF", "profile_large", "DefaultProfileL"], |
| 46 | ["True", "1", "True", "OFF", "N.A", "Regression"], |
| 47 | ["False", "1", "True", "OFF", "N.A", "RegressionIPC"], |
| 48 | ["False", "2", "True", "OFF", "N.A", "RegressionIPCTfmLevel2"], |
| 49 | ["False", "3", "True", "OFF", "N.A", "RegressionIPCTfmLevel3"], |
| 50 | ["True", "1", "True", "OFF", "profile_small", "RegressionProfileS"], |
| 51 | ["False", "2", "True", "OFF", "profile_medium", "RegressionProfileM"], |
| 52 | ["False", "3", "True", "OFF", "profile_large", "RegressionProfileL"], |
| 53 | ["True", "1", "False", "STORAGE", "N.A", "PsaApiTest (STORAGE)"], |
| 54 | ["True", "1", "False", "CRYPTO", "N.A", "PsaApiTest (Crypto)"], |
| 55 | ["True", "1", "False", "INITIAL_ATTESTATION", "N.A", "PsaApiTest (Attest)"], |
| 56 | ["True", "1", "False", "IPC", "N.A", "PsaApiTest (FF)"], |
| 57 | ["False", "1", "False", "STORAGE", "N.A", "PsaApiTestIPC (STORAGE)"], |
| 58 | ["False", "1", "False", "CRYPTO", "N.A", "PsaApiTestIPC (Crypto)"], |
| 59 | ["False", "1", "False", "INITIAL_ATTESTATION", "N.A", "PsaApiTestIPC (Attest)"], |
| 60 | ["False", "1", "False", "IPC", "N.A", "PsaApiTestIPC (FF)"], |
| 61 | ["False", "2", "False", "STORAGE", "N.A", "PsaApiTestIPCTfmLevel2 (STORAGE)"], |
| 62 | ["False", "2", "False", "CRYPTO", "N.A", "PsaApiTestIPCTfmLevel2 (Crypto)"], |
| 63 | ["False", "2", "False", "INITIAL_ATTESTATION", "N.A", "PsaApiTestIPCTfmLevel2 (Attest)"], |
| 64 | ["False", "2", "False", "IPC", "N.A", "PsaApiTestIPCTfmLevel2 (FF)"], |
| 65 | ["False", "3", "False", "STORAGE", "N.A", "PsaApiTestIPCTfmLevel3 (STORAGE)"], |
| 66 | ["False", "3", "False", "CRYPTO", "N.A", "PsaApiTestIPCTfmLevel3 (Crypto)"], |
| 67 | ["False", "3", "False", "INITIAL_ATTESTATION", "N.A", "PsaApiTestIPCTfmLevel3 (Attest)"], |
| 68 | ["False", "3", "False", "IPC", "N.A", "PsaApiTestIPCTfmLevel3 (FF)"], |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 69 | ] |
| 70 | |
| 71 | cfgs = ["Default", "CoreIPC", "CoreIPCTfmLevel2", "CoreIPCTfmLevel3", |
| 72 | "Regression", "RegressionIPC", |
| 73 | "RegressionIPCTfmLevel2", "RegressionIPCTfmLevel3", |
| 74 | "DefaultProfileS", "RegressionProfileS", |
| 75 | "DefaultProfileM", "RegressionProfileM", "RegressionProfileM PSOFF", |
Xinyu Zhang | 9b1aef9 | 2021-03-12 15:36:44 +0800 | [diff] [blame] | 76 | "DefaultProfileL", "RegressionProfileL", |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 77 | "PsaApiTest (Attest)", "PsaApiTestIPC (Attest)", |
| 78 | "PsaApiTestIPCTfmLevel2 (Attest)", |
| 79 | "PsaApiTest (Crypto)", "PsaApiTestIPC (Crypto)", |
| 80 | "PsaApiTestIPCTfmLevel2 (Crypto)", |
Xinyu Zhang | 39acb41 | 2021-07-09 20:35:19 +0800 | [diff] [blame] | 81 | "PsaApiTest (STORAGE)", "PsaApiTestIPC (STORAGE)", |
| 82 | "PsaApiTestIPCTfmLevel2 (STORAGE)", |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 83 | "PsaApiTestIPC (FF)", |
| 84 | "PsaApiTestIPCTfmLevel2 (FF)", |
Xinyu Zhang | 39acb41 | 2021-07-09 20:35:19 +0800 | [diff] [blame] | 85 | "PsaApiTestIPCTfmLevel3 (STORAGE)", "PsaApiTestIPCTfmLevel3 (Crypto)", |
| 86 | "PsaApiTestIPCTfmLevel3 (Attest)", "PsaApiTestIPCTfmLevel3 (FF)"] |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 87 | |
Xinyu Zhang | aa3747f | 2020-12-24 16:27:06 +0800 | [diff] [blame] | 88 | @NonCPS |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 89 | def generateLavaParam(build_params) { |
| 90 | def params = [] |
Summer Qin | 3c2b572 | 2021-05-26 10:43:45 +0800 | [diff] [blame] | 91 | if (build_params["TFM_PLATFORM"] == "arm/musca_b1/sse_200" && \ |
Xinyu Zhang | 9711434 | 2021-01-21 14:08:03 +0800 | [diff] [blame] | 92 | build_params["OTP"] == "ENABLED") { |
| 93 | params += string(name: "TARGET_PLATFORM", value: "MUSCA_B1_OTP") |
| 94 | } |
| 95 | else { |
| 96 | params += string(name: "TARGET_PLATFORM", \ |
| 97 | value: mapPlatform[build_params["TFM_PLATFORM"]]) |
| 98 | } |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 99 | params += string(name: "COMPILER", \ |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 100 | value: build_params["COMPILER"].split('_')[0]) |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 101 | params += string(name: "PSA_API_SUITE", \ |
| 102 | value: mapTestPsaApi[build_params["TEST_PSA_API"]]) |
| 103 | |
Xinyu Zhang | dbfadae | 2020-12-07 14:42:59 +0800 | [diff] [blame] | 104 | configName = "Config" |
Xinyu Zhang | 73ed299 | 2021-09-15 11:38:23 +0800 | [diff] [blame] | 105 | config_params = [build_params["LIB_MODEL"], build_params["ISOLATION_LEVEL"], \ |
Xinyu Zhang | dbfadae | 2020-12-07 14:42:59 +0800 | [diff] [blame] | 106 | build_params["TEST_REGRESSION"], build_params["TEST_PSA_API"], \ |
| 107 | build_params["PROFILE"]] |
Xinyu Zhang | 7c8d337 | 2021-12-22 11:15:42 +0800 | [diff] [blame] | 108 | // Regression Test is enabled if CRYPTO is ON |
| 109 | if (build_params["EXTRA_PARAMS"] == "CRYPTO_ON") { |
| 110 | config_params[2] = "True" |
| 111 | } |
Xinyu Zhang | dbfadae | 2020-12-07 14:42:59 +0800 | [diff] [blame] | 112 | for (config in mapConfigs) { |
Xinyu Zhang | 3f7e2f5 | 2021-09-02 13:43:57 +0800 | [diff] [blame] | 113 | if (config_params == config[0..4]) { |
| 114 | configName += config[5].replace(' (', '_').replace(')', '') |
Xinyu Zhang | dbfadae | 2020-12-07 14:42:59 +0800 | [diff] [blame] | 115 | break |
| 116 | } |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 117 | } |
Xinyu Zhang | dbfadae | 2020-12-07 14:42:59 +0800 | [diff] [blame] | 118 | if (configName == "Config") { |
| 119 | configName = "ConfigDefault" |
| 120 | } |
| 121 | params += string(name: "PROJ_CONFIG", value: configName) |
Xinyu Zhang | aa3747f | 2020-12-24 16:27:06 +0800 | [diff] [blame] | 122 | print("Params of ${configName} :") |
| 123 | print(config_params) |
Xinyu Zhang | 5c4bbca | 2020-09-24 16:36:03 +0800 | [diff] [blame] | 124 | return params |
| 125 | } |
| 126 | |
Xinyu Zhang | 0aced4c | 2021-09-03 17:06:21 +0800 | [diff] [blame] | 127 | def submit_lava_tests(config, results, build_res, params, params_collection) { |
| 128 | print("Doing LAVA stuff for ${build_res.getAbsoluteUrl()}") |
| 129 | params += generateLavaParam(params_collection) |
| 130 | params += string(name: 'BUILD_NUMBER', value: "${build_res.number}") |
| 131 | params += string(name: 'BUILD_URL', value: build_res.getAbsoluteUrl()) |
| 132 | params += string(name: 'LAVA_URL', value: env.LAVA_URL) |
Paul Sokolovsky | daa430a | 2022-01-06 09:59:16 +0300 | [diff] [blame] | 133 | params += string(name: 'CI_SCRIPTS_REPO', value: env.CI_SCRIPTS_REPO) |
Xinyu Zhang | 0aced4c | 2021-09-03 17:06:21 +0800 | [diff] [blame] | 134 | params += string(name: 'CI_SCRIPTS_BRANCH', value: env.CI_SCRIPTS_BRANCH) |
| 135 | params += string(name: 'LAVA_CREDENTIALS', value: env.LAVA_CREDENTIALS) |
| 136 | params += string(name: 'CODE_COVERAGE_EN', value: env.CODE_COVERAGE_EN) |
| 137 | def lava_res = build(job: 'tf-m-lava-submit', parameters: params, propagate: false) |
| 138 | def lava_resubmitted = false |
| 139 | if (lava_res.result in failure_states) { |
| 140 | error("LAVA Create and Submit failed at ${lava_res.getAbsoluteUrl()}") |
| 141 | } else { |
| 142 | lava_des = lava_res.getDescription() |
| 143 | if (lava_des.contains(" Submitted twice!")) { |
| 144 | lava_resubmitted = true |
| 145 | lava_des = lava_des - " Submitted twice!" |
| 146 | } |
| 147 | results['lava_jobs'] += lava_des |
| 148 | } |
| 149 | links = "Build Config: ${config}\n" |
| 150 | links += "Build URL: ${build_res.getAbsoluteUrl()}\n" |
| 151 | links += "LAVA Submit: ${lava_res.getAbsoluteUrl()}" |
| 152 | if (lava_resubmitted) { |
| 153 | links += "\nLAVA Job Re-Submitted!" |
| 154 | } |
| 155 | print(links) |
| 156 | } |
| 157 | |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 158 | def listConfigs(ci_scripts_dir, config_list, filter_group) { |
| 159 | dir(ci_scripts_dir) { |
| 160 | echo "Obtaining list of configs." |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 161 | echo "Running: python3 ./configs.py -g ${filter_group.replace(" ", " -g ")}" |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 162 | def build_config_list_raw = sh(script: """\ |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 163 | python3 ./configs.py -g ${filter_group.replace(" ", " -g ")} |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 164 | """, returnStdout: true).trim() |
| 165 | def build_config_list = build_config_list_raw.tokenize('\n') |
| 166 | config_list.addAll(build_config_list) |
| 167 | } |
| 168 | } |
| 169 | |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 170 | def buildConfig(ci_scripts_dir, config, filter_group, results) { |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 171 | def params = [] |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 172 | def params_collection = [:] |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 173 | def build_config_params |
| 174 | dir(ci_scripts_dir) { |
| 175 | echo "Obtaining build configuration for config ${config}" |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 176 | echo "Running: python3 ./configs.py -g ${filter_group.replace(" ", " -g ")} ${config}" |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 177 | build_config_params = sh(script: """\ |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 178 | python3 ./configs.py -g ${filter_group.replace(" ", " -g ")} ${config} |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 179 | """, returnStdout: true).trim() |
| 180 | } |
| 181 | def lines = build_config_params.tokenize('\n') |
| 182 | for (String line : lines) { |
| 183 | def key, value |
| 184 | (key, value) = line.tokenize('=') |
| 185 | params += string(name: key, value: value) |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 186 | params_collection[key] = value |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 187 | } |
| 188 | params += string(name: 'GERRIT_BRANCH', value: env.GERRIT_BRANCH) |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 189 | params += string(name: 'GERRIT_HOST', value: env.GERRIT_HOST) |
| 190 | params += string(name: 'GERRIT_CHANGE_NUMBER', value: env.GERRIT_CHANGE_NUMBER) |
| 191 | params += string(name: 'GERRIT_PATCHSET_REVISION', value: env.GERRIT_PATCHSET_REVISION) |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 192 | params += string(name: 'GERRIT_REFSPEC', value: env.GERRIT_REFSPEC) |
Karl Zhang | 02d3035 | 2020-08-20 13:48:52 +0800 | [diff] [blame] | 193 | params += string(name: 'MBEDTLS_VERSION', value: env.MBEDTLS_VERSION) |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 194 | params += string(name: 'CODE_REPO', value: env.CODE_REPO) |
Karl Zhang | f6f467e | 2020-07-10 16:24:45 +0800 | [diff] [blame] | 195 | params += string(name: 'CODE_COVERAGE_EN', value: env.CODE_COVERAGE_EN) |
Paul Sokolovsky | daa430a | 2022-01-06 09:59:16 +0300 | [diff] [blame] | 196 | params += string(name: 'CI_SCRIPTS_REPO', value: env.CI_SCRIPTS_REPO) |
Colin Thorbinson | 58703db | 2020-11-24 12:02:19 +0000 | [diff] [blame] | 197 | params += string(name: 'CI_SCRIPTS_BRANCH', value: env.CI_SCRIPTS_BRANCH) |
Leonardo Sandoval | 7090b2c | 2021-09-17 13:20:44 -0500 | [diff] [blame] | 198 | params += string(name: 'MCUBOOT_REFSPEC', value: env.MCUBOOT_REFSPEC) |
| 199 | params += string(name: 'MCUBOOT_URL', value: env.MCUBOOT_URL) |
| 200 | params += string(name: 'MBEDTLS_VERSION', value: env.MBEDTLS_VERSION) |
Paul Sokolovsky | 8d28871 | 2022-01-13 00:53:03 +0300 | [diff] [blame] | 201 | params += string(name: 'MBEDTLS_URL', value: env.MBEDTLS_URL) |
Leonardo Sandoval | 7090b2c | 2021-09-17 13:20:44 -0500 | [diff] [blame] | 202 | params += string(name: 'TFM_TESTS_REFSPEC', value: env.TFM_TESTS_REFSPEC) |
| 203 | params += string(name: 'TFM_TESTS_URL', value: env.TFM_TESTS_URL) |
| 204 | params += string(name: 'PSA_ARCH_TESTS_VERSION', value: env.PSA_ARCH_TESTS_VERSION) |
| 205 | params += string(name: 'PSA_ARCH_TESTS_URL', value: env.PSA_ARCH_TESTS_URL) |
| 206 | params += string(name: 'SHARE_FOLDER', value: env.SHARE_FOLDER) |
Hugo L'Hostis | e55a275 | 2021-01-27 11:09:08 +0000 | [diff] [blame] | 207 | if (env.JOB_NAME.equals("tf-m-nightly")) { //Setting the Memory footprint gathering. |
| 208 | params += string(name: 'SQUAD_CONFIGURATIONS', value: env.SQUAD_CONFIGURATIONS) |
| 209 | } |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 210 | return { -> results |
| 211 | def build_res = build(job: 'tf-m-build-config', parameters: params, propagate: false) |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 212 | def build_url = build_res.getAbsoluteUrl() |
Xinyu Zhang | 0aced4c | 2021-09-03 17:06:21 +0800 | [diff] [blame] | 213 | results['builds'][build_res.number] = [build_res, config, params_collection] |
| 214 | |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 215 | print("${build_res.number}: ${config} ${build_res.result} ${build_url}") |
Xinyu Zhang | f2ba911 | 2021-09-02 13:31:16 +0800 | [diff] [blame] | 216 | |
| 217 | // Filter out configs do not need LAVA tests |
| 218 | |
Xinyu Zhang | 543dddb | 2021-12-15 11:05:49 +0800 | [diff] [blame] | 219 | // Job tf-m-extra-build does not need LAVA tests |
| 220 | if (env.JOB_NAME.equals("tf-m-extra-build")) { |
| 221 | print("LAVA is not needed in tf-m-extra-build job.") |
| 222 | } |
Xinyu Zhang | f2ba911 | 2021-09-02 13:31:16 +0800 | [diff] [blame] | 223 | // Configs with build failure do not need LAVA tests |
Xinyu Zhang | 543dddb | 2021-12-15 11:05:49 +0800 | [diff] [blame] | 224 | else if (build_res.result in failure_states) { |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 225 | error("Build failed at ${build_url}") |
Arthur She | 3c0dadd | 2021-11-18 21:17:48 -0800 | [diff] [blame] | 226 | } else { |
| 227 | // Build successful |
Arthur She | 87602dc | 2022-02-06 14:42:18 -0800 | [diff] [blame] | 228 | // Submit test job for NXP LPCXpresso55S69 & Cypress PSoC64 |
| 229 | if (params_collection["TFM_PLATFORM"].contains("lpcxpresso55s69") || params_collection["TFM_PLATFORM"].contains("psoc64")) { |
Arthur She | 3c0dadd | 2021-11-18 21:17:48 -0800 | [diff] [blame] | 230 | submit_lava_tests(config, results, build_res, params, params_collection) |
| 231 | } else { |
| 232 | // Configs without BL2 do not need LAVA tests |
| 233 | if (params_collection["BL2"] == "False") { |
| 234 | print("LAVA is not needed for ${build_url}") |
| 235 | } |
| 236 | // Configs without building NS app do not need LAVA tests |
| 237 | else if (params_collection["NS"] == "False") { |
| 238 | print("LAVA is not needed for ${build_url}") |
| 239 | } |
| 240 | // LAVA tests on MUSCA_B1 are not needed in per-patch job |
| 241 | else if (params_collection["TFM_PLATFORM"].contains("musca_b1") && \ |
| 242 | env.JOB_NAME.equals("tf-m-build-and-test")) { |
| 243 | print("LAVA is not needed for ${build_url}") |
| 244 | } |
| 245 | // Only submit LAVA test for a specified OTP enabled config in nightly or release job |
| 246 | else if (params_collection["OTP"] == "ENABLED" && \ |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 247 | params_collection["CONFIG_NAME"] != "MUSCA_B1_GCC_PSA_3_REG_Debug_OTP_BL2_NS") { |
Arthur She | 3c0dadd | 2021-11-18 21:17:48 -0800 | [diff] [blame] | 248 | print("LAVA is not needed for ${build_url}") |
| 249 | } |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 250 | else if (params_collection["CONFIG_NAME"] == "MUSCA_B1_GCC_PSA_3_REG_Debug_OTP_BL2_NS" && \ |
Arthur She | 3c0dadd | 2021-11-18 21:17:48 -0800 | [diff] [blame] | 251 | !(env.JOB_NAME.equals("tf-m-nightly") || env.JOB_NAME.equals("tf-m-release"))) { |
| 252 | print("LAVA is not needed for ${build_url}") |
| 253 | } |
| 254 | // Submit LAVA tests |
| 255 | else { |
| 256 | submit_lava_tests(config, results, build_res, params, params_collection) |
| 257 | } |
| 258 | } |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
Matthew Hart | 06340d7 | 2020-06-15 16:08:20 +0100 | [diff] [blame] | 263 | def buildDocs(results) { |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 264 | def params = [] |
| 265 | params += string(name: 'GERRIT_BRANCH', value: env.GERRIT_BRANCH) |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 266 | params += string(name: 'GERRIT_HOST', value: env.GERRIT_HOST) |
| 267 | params += string(name: 'GERRIT_CHANGE_NUMBER', value: env.GERRIT_CHANGE_NUMBER) |
| 268 | params += string(name: 'GERRIT_PATCHSET_REVISION', value: env.GERRIT_PATCHSET_REVISION) |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 269 | params += string(name: 'GERRIT_REFSPEC', value: env.GERRIT_REFSPEC) |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 270 | params += string(name: 'CODE_REPO', value: env.CODE_REPO) |
Paul Sokolovsky | daa430a | 2022-01-06 09:59:16 +0300 | [diff] [blame] | 271 | params += string(name: 'CI_SCRIPTS_REPO', value: env.CI_SCRIPTS_REPO) |
Colin Thorbinson | 58703db | 2020-11-24 12:02:19 +0000 | [diff] [blame] | 272 | params += string(name: 'CI_SCRIPTS_BRANCH', value: env.CI_SCRIPTS_BRANCH) |
Leonardo Sandoval | 7090b2c | 2021-09-17 13:20:44 -0500 | [diff] [blame] | 273 | params += string(name: 'SHARE_FOLDER', value: env.SHARE_FOLDER) |
Matthew Hart | 06340d7 | 2020-06-15 16:08:20 +0100 | [diff] [blame] | 274 | return { -> results |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 275 | def res = build(job: 'tf-m-build-docs', parameters: params, propagate:false) |
| 276 | print("${res.number}: Docs ${res.result} ${res.getAbsoluteUrl()}") |
Matthew Hart | 06340d7 | 2020-06-15 16:08:20 +0100 | [diff] [blame] | 277 | results['docs'] = [res.number, res.result, params] |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 278 | if (res.result in ["FAILURE", "ABORTED", "UNSTABLE", "NOT_BUILT"]) { |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 279 | error("Build failed at ${res.getAbsoluteUrl()}") |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | |
Xinyu Zhang | 38a1887 | 2020-11-23 16:45:28 +0800 | [diff] [blame] | 284 | def generateEmailBody(stage, failed_jobs) { |
| 285 | body = "Check console output at ${env.BUILD_URL} \n\n" |
| 286 | |
| 287 | body += "Failed Jobs:\n" |
| 288 | failed_jobs.each { job -> |
| 289 | body += "${job.key} ${job.value}\n" |
| 290 | } |
| 291 | |
| 292 | body += "\nFor detailed ${stage} results please refer to \ |
| 293 | ${env.BUILD_URL}artifact/${stage}_results.csv \n" |
| 294 | return body |
| 295 | } |
| 296 | |
| 297 | def emailNotification(results, stage, failed_jobs) { |
Karl Zhang | 0413e97 | 2020-09-18 17:59:26 +0800 | [diff] [blame] | 298 | script { |
| 299 | if (env.JOB_NAME.equals("tf-m-nightly") && !env.EMAIL_NOTIFICATION.equals('')) { |
| 300 | def result = "Fail." |
Karl Zhang | 182ecdf | 2020-10-10 09:52:12 +0800 | [diff] [blame] | 301 | if (results == true) { |
Karl Zhang | 0413e97 | 2020-09-18 17:59:26 +0800 | [diff] [blame] | 302 | result = "Success." |
Karl Zhang | 182ecdf | 2020-10-10 09:52:12 +0800 | [diff] [blame] | 303 | print("Skip sending as ${result} for ${stage}") |
| 304 | } |
| 305 | else { |
| 306 | emailext ( |
| 307 | subject: ("Job ${env.JOB_NAME} ${stage} ${env.BUILD_NUMBER} ${result}"), |
Xinyu Zhang | 38a1887 | 2020-11-23 16:45:28 +0800 | [diff] [blame] | 308 | body: generateEmailBody(stage, failed_jobs), |
Karl Zhang | 182ecdf | 2020-10-10 09:52:12 +0800 | [diff] [blame] | 309 | to: "${EMAIL_NOTIFICATION}" |
| 310 | ) |
| 311 | } |
Karl Zhang | 0413e97 | 2020-09-18 17:59:26 +0800 | [diff] [blame] | 312 | } |
| 313 | } /* script */ |
| 314 | } |
| 315 | |
Xinyu Zhang | 38a1887 | 2020-11-23 16:45:28 +0800 | [diff] [blame] | 316 | def filterFailedBuild(results) { |
| 317 | def failed_builds = [:] |
| 318 | results.each { result -> |
| 319 | if (result.value[0].getResult() == "FAILURE") { |
| 320 | failed_builds[result.value[1]] = result.value[0].getAbsoluteUrl() |
| 321 | } |
| 322 | } |
| 323 | return failed_builds |
| 324 | } |
| 325 | |
| 326 | def filterFailedTest(string) { |
| 327 | def failed_tests = [:] |
| 328 | line = lineInString(string, "FAILURE_TESTS:") |
| 329 | a = line.split(' ') |
| 330 | if (a.size() > 1) { |
| 331 | a = line.split(' ')[1..-1] |
| 332 | a.each { fail_test -> |
| 333 | config_link = fail_test.split(':') |
| 334 | failed_tests[config_link[0]] = config_link[1..-1].join(':') |
| 335 | } |
| 336 | } |
| 337 | return failed_tests |
| 338 | } |
| 339 | |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 340 | @NonCPS |
| 341 | def generateCsvContent(results) { |
| 342 | def resultsParam = [] |
| 343 | results.each { result -> |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 344 | if (result.value[2]['BL2'] == "True") { |
| 345 | resultsParam.add([result.value[1], \ |
| 346 | result.value[0].getResult(), \ |
| 347 | result.value[2]['TFM_PLATFORM'], \ |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 348 | result.value[2]['COMPILER'].split('_')[0], \ |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 349 | result.value[2]['CMAKE_BUILD_TYPE'], \ |
| 350 | result.value[2]['BL2'], \ |
| 351 | result.value[2]['NS'], \ |
Xinyu Zhang | 73ed299 | 2021-09-15 11:38:23 +0800 | [diff] [blame] | 352 | result.value[2]['LIB_MODEL'], \ |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 353 | result.value[2]['ISOLATION_LEVEL'], \ |
| 354 | result.value[2]['TEST_REGRESSION'], \ |
| 355 | result.value[2]['TEST_PSA_API'], \ |
| 356 | result.value[2]['PROFILE'], \ |
| 357 | result.value[2]['PARTITION_PS'], \ |
| 358 | result.value[2]['OTP']]) |
| 359 | } |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 360 | } |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 361 | resultsParam.each { result -> |
Xinyu Zhang | 8d95fc1 | 2021-07-21 10:58:39 +0800 | [diff] [blame] | 362 | if (result[2] == 'arm/musca_b1/sse_200') { |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 363 | if (result[13] != 'off') { |
Xinyu Zhang | 8d95fc1 | 2021-07-21 10:58:39 +0800 | [diff] [blame] | 364 | result[2] = 'arm/musca_b1/sse_200_OTP' |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 365 | } |
| 366 | } |
Xinyu Zhang | 433771e | 2022-04-01 16:49:17 +0800 | [diff] [blame] | 367 | result[3] = result[3].split('_')[0] |
Xinyu Zhang | 3f7e2f5 | 2021-09-02 13:43:57 +0800 | [diff] [blame] | 368 | build_params = result[7..12] |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 369 | configName = "" |
| 370 | for (map_cfg in mapConfigs) { |
Xinyu Zhang | 3f7e2f5 | 2021-09-02 13:43:57 +0800 | [diff] [blame] | 371 | if (build_params[0..4] == map_cfg[0..4]) { |
| 372 | configName = map_cfg[5] |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 373 | break |
| 374 | } |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 375 | } |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 376 | if (configName == "") { |
| 377 | configName = "Default" |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 378 | } |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 379 | else if (configName == "RegressionProfileM") { |
Xinyu Zhang | 3f7e2f5 | 2021-09-02 13:43:57 +0800 | [diff] [blame] | 380 | if (build_params[5] == "OFF") { |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 381 | configName = "RegressionProfileM PSOFF" |
| 382 | } |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 383 | } |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 384 | result.add(configName) |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 385 | } |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 386 | def csvContent = [] |
| 387 | resultsParam.each { result -> |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 388 | current_row = result[2..4] |
| 389 | cfgs.each {cfg -> |
| 390 | if (cfg == result[14]) { |
| 391 | current_row.add(cfg) |
| 392 | current_row.add(result[1]) |
| 393 | } |
| 394 | } |
| 395 | csvContent.add(current_row) |
| 396 | } |
| 397 | csvContent.sort{a,b -> a[0] <=> b[0] ?: a[1] <=> b[1] ?: a[2] <=> b[2]} |
| 398 | build_summary = [] |
| 399 | current_platform = "" |
| 400 | current_compiler = "" |
| 401 | current_build_type = "" |
| 402 | csvContent.each { build_cfg -> |
| 403 | if (current_platform != build_cfg[0] || \ |
| 404 | current_compiler != build_cfg[1] || \ |
| 405 | current_build_type != build_cfg[2]) { |
| 406 | current_platform = build_cfg[0] |
| 407 | current_compiler = build_cfg[1] |
| 408 | current_build_type = build_cfg[2] |
| 409 | csv_line = [current_platform, current_compiler, current_build_type] |
| 410 | cfgs.each { |
| 411 | csv_line.add("N.A.") |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 412 | } |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 413 | build_summary.add(csv_line) |
| 414 | } |
| 415 | i = 0 |
| 416 | cfgs.each { cfg -> |
| 417 | if (cfg == build_cfg[3]) { |
| 418 | build_summary[-1][3+i] = build_cfg[4] |
| 419 | } |
| 420 | i += 1 |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 421 | } |
| 422 | } |
Xinyu Zhang | 4f2ef5a | 2020-11-09 18:11:43 +0800 | [diff] [blame] | 423 | build_summary.add(0, ['Platform', 'Compiler', 'Cmake Build Type']) |
| 424 | build_summary[0] += cfgs |
| 425 | return build_summary |
xinyu-tfm | b4fc041 | 2020-08-19 10:49:51 +0800 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | def generateBuildCsv(results) { |
| 429 | def csvContent = generateCsvContent(results) |
| 430 | node("master") { |
| 431 | writeCSV file: 'build_results.csv', records: csvContent, format: CSVFormat.EXCEL |
| 432 | archiveArtifacts 'build_results.csv' |
| 433 | } |
| 434 | } |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 435 | |
| 436 | def buildCsv(results) { |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 437 | def summary = new Summary(); |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 438 | def csvContent = summary.getBuildCsv(results) |
| 439 | node("master") { |
| 440 | writeCSV file: 'build_results.csv', records: csvContent, format: CSVFormat.EXCEL |
| 441 | archiveArtifacts 'build_results.csv' |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | def writeSummary(results) { |
Dean Birch | d0f9f8c | 2020-03-26 11:10:33 +0000 | [diff] [blame] | 446 | def summary = new Summary(); |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 447 | def buildLinks = summary.getLinks(results) |
| 448 | node("master") { |
| 449 | writeFile file: "build_links.html", text: buildLinks |
| 450 | archiveArtifacts 'build_links.html' |
| 451 | } |
| 452 | } |
| 453 | |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 454 | def lineInString(string, match) { |
| 455 | def lines = string.split("\n") |
| 456 | def result = lines.findAll { it.contains(match) } |
| 457 | return result[0] |
| 458 | } |
| 459 | |
Xinyu Zhang | 97ee3fd | 2020-12-14 14:45:06 +0800 | [diff] [blame] | 460 | def showLinks(string) { |
| 461 | def lines = string.split("\n") |
| 462 | def result = lines.findAll { it.contains("Build Config: ")} |
| 463 | links = result.join("\n") |
| 464 | print(links) |
| 465 | } |
| 466 | |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 467 | def getResult(string, match) { |
| 468 | line = lineInString(string, match) |
Dean Birch | 1d545c0 | 2020-05-29 14:09:21 +0100 | [diff] [blame] | 469 | a = line.split(match)[1].split(' ') |
| 470 | score = a[0] |
| 471 | if (a.size() > 1) |
| 472 | { |
| 473 | fail_text = a[1..-1].join(" ") |
| 474 | return [score, fail_text] |
| 475 | } |
| 476 | return [score, ""] |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | def submitJobsToList(results) { |
| 480 | def all_jobs = [] |
| 481 | for (String result : results){ |
| 482 | jobs_s = result.split('JOBS: ') |
| 483 | if (jobs_s.size() > 1) { |
| 484 | all_jobs += jobs_s[1] |
| 485 | } |
| 486 | } |
| 487 | return(all_jobs) |
| 488 | } |
| 489 | |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 490 | def configs = [] |
| 491 | def builds = [:] |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 492 | def results = [:] |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 493 | |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 494 | timestamps { |
| 495 | node("docker-amd64-tf-m-bionic") { |
| 496 | stage("Init") { |
| 497 | cleanWs() |
| 498 | dir("tf-m-ci-scripts") { |
| 499 | checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]]) |
Xinyu Zhang | 8472b85 | 2021-09-04 00:13:34 +0800 | [diff] [blame] | 500 | sh "git rev-parse --short HEAD" |
Leonardo Sandoval | 7090b2c | 2021-09-17 13:20:44 -0500 | [diff] [blame] | 501 | // Clone TF-M repositories so share folder can be reused by downstream jobs |
| 502 | sh "./clone.sh" |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 503 | } |
| 504 | } |
| 505 | stage("Configs") { |
| 506 | // Populate configs |
| 507 | listConfigs('tf-m-ci-scripts', configs, env.FILTER_GROUP) |
| 508 | results['builds'] = [:] |
| 509 | results['lava_jobs'] = [] |
| 510 | for (config in configs) { |
| 511 | builds[config] = buildConfig("tf-m-ci-scripts", config, env.FILTER_GROUP, results) |
| 512 | } |
Xinyu Zhang | 351f14c | 2021-11-15 14:30:09 +0800 | [diff] [blame] | 513 | if (!env.JOB_NAME.equals("tf-m-extra-build")) { |
| 514 | builds["docs"] = buildDocs(results) |
| 515 | } |
Dean Birch | 62c4f08 | 2020-01-17 16:13:26 +0000 | [diff] [blame] | 516 | } |
| 517 | } |
Karl Zhang | fec8410 | 2020-06-24 09:56:36 +0800 | [diff] [blame] | 518 | |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 519 | stage("Builds") { |
| 520 | def verify = 1 |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 521 | def success = true |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 522 | try { |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 523 | parallel(builds) |
| 524 | } catch (Exception e) { |
| 525 | print(e) |
| 526 | manager.buildFailure() |
| 527 | verify = -1 |
| 528 | success = false |
| 529 | } finally { |
| 530 | print("Verifying status") |
| 531 | def failed_builds = filterFailedBuild(results['builds']) |
| 532 | emailNotification(success, 'build', failed_builds) |
| 533 | g = new Gerrit() |
| 534 | g.verifyStatus(verify, 'tf-m-build', 'build') |
| 535 | print("Building CSV") |
| 536 | generateBuildCsv(results['builds']) |
| 537 | writeSummary(results['builds']) |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | node("docker-amd64-tf-m-bionic") { |
| 542 | stage("Tests") { |
| 543 | dir("tf-m-ci-scripts") { |
| 544 | checkout([$class: 'GitSCM', branches: [[name: '$CI_SCRIPTS_BRANCH']], userRemoteConfigs: [[credentialsId: 'GIT_SSH_KEY', url: '$CI_SCRIPTS_REPO']]]) |
| 545 | } |
| 546 | def all_jobs = [] |
| 547 | def success = true |
| 548 | print("Wait for LAVA results here...") |
| 549 | try { |
| 550 | all_jobs = submitJobsToList(results['lava_jobs']) |
| 551 | if (all_jobs.size() > 0) { |
| 552 | dir("tf-m-ci-scripts") { |
| 553 | withCredentials([usernamePassword(credentialsId: env.LAVA_CREDENTIALS, passwordVariable: 'LAVA_TOKEN', usernameVariable: 'LAVA_USER')]) { |
| 554 | output = sh(script: """./lava_helper/lava_wait_jobs.py --job-ids ${all_jobs.join(",")} \ |
| 555 | --lava-url ${env.LAVA_URL} --lava-user ${LAVA_USER} --lava-token ${LAVA_TOKEN} \ |
Xinyu Zhang | e9fb624 | 2021-11-16 11:05:28 +0800 | [diff] [blame] | 556 | --artifacts-path lava_artifacts --lava-timeout 12000 \ |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 557 | """, returnStdout: true).trim() |
| 558 | showLinks(output) |
| 559 | archiveArtifacts artifacts: 'test_summary.*', allowEmptyArchive: true |
| 560 | archiveArtifacts artifacts: 'test_results.csv', allowEmptyArchive: true |
| 561 | g = new Gerrit() |
| 562 | def (boot_result, boot_output) = getResult(output, 'BOOT_RESULT: ') |
| 563 | if (boot_result) { |
| 564 | g.verifyStatus(boot_result, "lava_boot", "test") |
| 565 | } |
| 566 | def (test_result, test_output) = getResult(output, 'TEST_RESULT: ') |
| 567 | if (test_result) { |
| 568 | g.verifyStatus(test_result, "lava_test", "test") |
| 569 | } |
| 570 | if (boot_result.toInteger() < 1 || test_result.toInteger() < 1) { |
Paul Sokolovsky | 84dd94f | 2022-01-27 22:08:56 +0300 | [diff] [blame] | 571 | error("Marking job as failed due to failed boots: \"${boot_output}\" or tests: \"${test_output}\"") |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 572 | } |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 573 | } |
| 574 | } |
| 575 | } |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 576 | else { |
| 577 | print("There were no LAVA jobs to test.") |
| 578 | } |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 579 | } |
Xinyu Zhang | 4cdfd1b | 2021-05-21 15:10:49 +0800 | [diff] [blame] | 580 | catch (Exception e) { |
| 581 | print("ERROR: ${e}") |
| 582 | success = false |
| 583 | } finally { |
| 584 | archiveArtifacts artifacts: 'tf-m-ci-scripts/lava_artifacts/**', allowEmptyArchive: true |
| 585 | if (all_jobs.size() > 0) { |
| 586 | emailNotification(success, 'test', filterFailedTest(output)) |
| 587 | } |
| 588 | cleanWs() |
| 589 | if (!success) { |
| 590 | error("There was an Error waiting for LAVA jobs") |
| 591 | } |
Matthew Hart | fb6fd36 | 2020-03-04 21:03:59 +0000 | [diff] [blame] | 592 | } |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 593 | } |
| 594 | } |
Dean Birch | a6ede7e | 2020-03-13 14:00:33 +0000 | [diff] [blame] | 595 | } |