blob: b1ddd4e3677135de8a56f00d0f13a5dbe354c8a9 [file] [log] [blame]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +01001#!/usr/bin/env python3
2
3""" lava_job_generator_configs.py:
4
5 Default configurations for lava job generator """
6
7from __future__ import print_function
8
9__copyright__ = """
10/*
11 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
12 *
13 * SPDX-License-Identifier: BSD-3-Clause
14 *
15 */
16 """
17__author__ = "Minos Galanakis"
18__email__ = "minos.galanakis@linaro.org"
19__project__ = "Trusted Firmware-M Open CI"
20__status__ = "stable"
Minos Galanakisea421232019-06-20 17:11:28 +010021__version__ = "1.1"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010022
23
24def lava_gen_get_config_subset(config,
25 default=True,
26 core=True,
27 regression=True):
28 """ Allow dynamic generation of configuration combinations by subtracking
29 undesired ones """
30
31 from copy import deepcopy
32 cfg = deepcopy(config)
33 tests = deepcopy(config["tests"])
34
35 # Remove all configs not requests by the caller
36 if not default:
37 tests.pop("Default")
Minos Galanakisea421232019-06-20 17:11:28 +010038 if not core:
39 tests.pop("CoreIPC")
40 tests.pop("CoreIPCTfmLevel2")
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010041 if not regression:
42 tests.pop("Regression")
43
44 cfg["tests"] = tests
45 return cfg
46
47
48tfm_mps2_sse_200 = {
49 "templ": "template_tfm_mps2_sse_200.jinja2",
50 "job_name": "mps2plus-arm-tfm",
Minos Galanakisafb43152019-09-25 14:17:39 +010051 "device_type": "mps",
Minos Galanakis8da148a2019-10-18 17:26:40 +010052 "job_timeout": 180,
Minos Galanakisea421232019-06-20 17:11:28 +010053 "action_timeout": 90,
54 "monitor_timeout": 90,
Minos Galanakis8da148a2019-10-18 17:26:40 +010055 "poweroff_timeout": 5,
Minos Galanakisea421232019-06-20 17:11:28 +010056 "recovery_store_url": "%(jenkins_url)s/"
57 "job/%(jenkins_job)s",
58 "artifact_store_url": "%(jenkins_url)s/"
59 "job/%(jenkins_job)s",
Minos Galanakis329cf102019-09-24 15:58:25 +010060 "platforms": {"AN521": "mps2_an521_v3.0.tar.gz"},
61 "compilers": ["GNUARM"],
Minos Galanakisea421232019-06-20 17:11:28 +010062 "build_types": ["Debug", "Release"],
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010063 "boot_types": ["BL2"],
64 "tests": {
65 'Default': {
66 "binaries": {
Minos Galanakisea421232019-06-20 17:11:28 +010067 "firmware": "tfm_sign.bin",
68 "bootloader": "mcuboot.bin"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010069 },
70 "monitors": [
71 {
72 'name': 'Secure_Test_Suites_Summary',
Minos Galanakis8da148a2019-10-18 17:26:40 +010073 'start': '[Sec Thread]',
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010074 'end': '\\x1b\\\[0m',
75 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
76 r'(?P<test_case_id>Secure image '
77 r'initializing)(?P<result>!)',
78 'fixup': {"pass": "!", "fail": ""},
79 'required': ["secure_image_initializing"]
80 } # Monitors
81 ]
82 }, # Default
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010083 'Regression': {
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010084 "binaries": {
Minos Galanakisea421232019-06-20 17:11:28 +010085 "firmware": "tfm_sign.bin",
86 "bootloader": "mcuboot.bin"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010087 },
88 "monitors": [
89 {
90 'name': 'Secure_Test_Suites_Summary',
91 'start': 'Secure test suites summary',
92 'end': 'End of Secure test suites',
93 'pattern': r"[\x1b]\\[37mTest suite '(?P<"
Dean Birchf1b727a2019-05-17 17:39:24 +010094 r"test_case_id>[^\n]+)' has [\x1b]\\[32m "
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010095 r"(?P<result>PASSED|FAILED)",
96 'fixup': {"pass": "PASSED", "fail": "FAILED"},
97 'required': [
Minos Galanakis8305a6e2019-04-04 15:55:40 +010098 ("psa_protected_storage_"
99 "s_interface_tests_tfm_sst_test_2xxx_"),
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100100 "sst_reliability_tests_tfm_sst_test_3xxx_",
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100101 "sst_rollback_protection_tests_tfm_sst_test_4xxx_",
TudorCretu8b138472019-08-30 10:51:05 +0100102 ("psa_internal_trusted_storage_"
103 "s_interface_tests_tfm_its_test_2xxx_"),
104 "its_reliability_tests_tfm_its_test_3xxx_",
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100105 ("audit_"
106 "logging_secure_interface_test_tfm_audit_test_1xxx_"),
107 "crypto_secure_interface_tests_tfm_crypto_test_5xxx_",
108 ("initial_attestation_service_"
109 "secure_interface_tests_tfm_attest_test_1xxx_"),
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100110 ]
111 },
112 {
113 'name': 'Non_Secure_Test_Suites_Summary',
114 'start': 'Non-secure test suites summary',
115 'end': r'End of Non-secure test suites',
116 'pattern': r"[\x1b]\\[37mTest suite '(?P"
Dean Birchf1b727a2019-05-17 17:39:24 +0100117 r"<test_case_id>[^\n]+)' has [\x1b]\\[32m "
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100118 r"(?P<result>PASSED|FAILED)",
119 'fixup': {"pass": "PASSED", "fail": "FAILED"},
120 'required': [
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100121 ("psa_protected_storage"
122 "_ns_interface_tests_tfm_sst_test_1xxx_"),
TudorCretu8b138472019-08-30 10:51:05 +0100123 ("psa_internal_trusted_storage"
124 "_ns_interface_tests_tfm_its_test_1xxx_"),
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100125 ("auditlog_"
126 "non_secure_interface_test_tfm_audit_test_1xxx_"),
127 ("crypto_"
128 "non_secure_interface_test_tfm_crypto_test_6xxx_"),
129 ("initial_attestation_service_"
Minos Galanakisf0dae4e2019-05-20 10:56:57 +0100130 "non_secure_interface_tests_tfm_attest_test_2xxx_"),
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100131 "core_non_secure_positive_tests_tfm_core_test_1xxx_"
132 ]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100133 }
134 ] # Monitors
135 }, # Regression
Minos Galanakisea421232019-06-20 17:11:28 +0100136 'CoreIPC': {
137 "binaries": {
138 "firmware": "tfm_sign.bin",
139 "bootloader": "mcuboot.bin"
140 },
141 "monitors": [
142 {
143 'name': 'Secure_Test_Suites_Summary',
Minos Galanakis8da148a2019-10-18 17:26:40 +0100144 'start': '[Sec Thread]',
Minos Galanakisea421232019-06-20 17:11:28 +0100145 'end': '\\x1b\\\[0m',
146 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
147 r'(?P<test_case_id>Secure image '
148 r'initializing)(?P<result>!)',
149 'fixup': {"pass": "!", "fail": ""},
150 'required': ["secure_image_initializing"]
151 } # Monitors
152 ]
153 }, # CoreIPC
154 'CoreIPCTfmLevel2': {
155 "binaries": {
156 "firmware": "tfm_sign.bin",
157 "bootloader": "mcuboot.bin"
158 },
159 "monitors": [
160 {
161 'name': 'Secure_Test_Suites_Summary',
Minos Galanakis8da148a2019-10-18 17:26:40 +0100162 'start': '[Sec Thread]',
Minos Galanakisea421232019-06-20 17:11:28 +0100163 'end': '\\x1b\\\[0m',
164 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
165 r'(?P<test_case_id>Secure image '
166 r'initializing)(?P<result>!)',
167 'fixup': {"pass": "!", "fail": ""},
168 'required': ["secure_image_initializing"]
169 } # Monitors
170 ]
171 }, # CoreIPCTfmLevel2
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100172 } # Tests
173}
174
175# All configurations should be mapped here
176lava_gen_config_map = {"tfm_mps2_sse_200": tfm_mps2_sse_200}
177lavagen_config_sort_order = [
178 "templ",
179 "job_name",
180 "device_type",
181 "job_timeout",
182 "action_timeout",
183 "monitor_timeout",
184 "recovery_store_url",
185 "artifact_store_url",
186 "platforms",
187 "compilers",
188 "build_types",
189 "boot_types",
190 "tests"
191]
192
193lava_gen_monitor_sort_order = [
194 'name',
195 'start',
196 'end',
197 'pattern',
198 'fixup',
199]
200
201if __name__ == "__main__":
202 import os
203 import sys
204 from lava_helper import sort_lavagen_config
205 try:
206 from tfm_ci_pylib.utils import export_config_map
207 except ImportError:
208 dir_path = os.path.dirname(os.path.realpath(__file__))
209 sys.path.append(os.path.join(dir_path, "../"))
210 from tfm_ci_pylib.utils import export_config_map
211
212 if len(sys.argv) == 2:
213 if sys.argv[1] == "--export":
214 export_config_map(lava_gen_config_map)
215 if len(sys.argv) == 3:
216 if sys.argv[1] == "--export":
217 export_config_map(sort_lavagen_config(lava_gen_config_map),
218 sys.argv[2])