blob: 2f896e1d35410fa326f9b0570d72430329a09c65 [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 Galanakisea421232019-06-20 17:11:28 +010052 "job_timeout": 120,
53 "action_timeout": 90,
54 "monitor_timeout": 90,
Minos Galanakis44074242019-10-14 09:59:11 +010055 "poweroff_timeout": 50,
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',
73 'start': 'Jumping to the first image slot',
74 '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_",
102 ("audit_"
103 "logging_secure_interface_test_tfm_audit_test_1xxx_"),
104 "crypto_secure_interface_tests_tfm_crypto_test_5xxx_",
105 ("initial_attestation_service_"
106 "secure_interface_tests_tfm_attest_test_1xxx_"),
107 "invert_secure_interface_tests_tfm_invert_test_1xxx_"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100108 ]
109 },
110 {
111 'name': 'Non_Secure_Test_Suites_Summary',
112 'start': 'Non-secure test suites summary',
113 'end': r'End of Non-secure test suites',
114 'pattern': r"[\x1b]\\[37mTest suite '(?P"
Dean Birchf1b727a2019-05-17 17:39:24 +0100115 r"<test_case_id>[^\n]+)' has [\x1b]\\[32m "
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100116 r"(?P<result>PASSED|FAILED)",
117 'fixup': {"pass": "PASSED", "fail": "FAILED"},
118 'required': [
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100119 ("psa_protected_storage"
120 "_ns_interface_tests_tfm_sst_test_1xxx_"),
121 ("auditlog_"
122 "non_secure_interface_test_tfm_audit_test_1xxx_"),
123 ("crypto_"
124 "non_secure_interface_test_tfm_crypto_test_6xxx_"),
125 ("initial_attestation_service_"
Minos Galanakisf0dae4e2019-05-20 10:56:57 +0100126 "non_secure_interface_tests_tfm_attest_test_2xxx_"),
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100127 ("invert_"
128 "non_secure_interface_tests_tfm_invert_test_1xxx_"),
129 "core_non_secure_positive_tests_tfm_core_test_1xxx_"
130 ]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100131 }
132 ] # Monitors
133 }, # Regression
Minos Galanakisea421232019-06-20 17:11:28 +0100134 'CoreIPC': {
135 "binaries": {
136 "firmware": "tfm_sign.bin",
137 "bootloader": "mcuboot.bin"
138 },
139 "monitors": [
140 {
141 'name': 'Secure_Test_Suites_Summary',
142 'start': 'Jumping to the first image slot',
143 'end': '\\x1b\\\[0m',
144 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
145 r'(?P<test_case_id>Secure image '
146 r'initializing)(?P<result>!)',
147 'fixup': {"pass": "!", "fail": ""},
148 'required': ["secure_image_initializing"]
149 } # Monitors
150 ]
151 }, # CoreIPC
152 'CoreIPCTfmLevel2': {
153 "binaries": {
154 "firmware": "tfm_sign.bin",
155 "bootloader": "mcuboot.bin"
156 },
157 "monitors": [
158 {
159 'name': 'Secure_Test_Suites_Summary',
160 'start': 'Jumping to the first image slot',
161 'end': '\\x1b\\\[0m',
162 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
163 r'(?P<test_case_id>Secure image '
164 r'initializing)(?P<result>!)',
165 'fixup': {"pass": "!", "fail": ""},
166 'required': ["secure_image_initializing"]
167 } # Monitors
168 ]
169 }, # CoreIPCTfmLevel2
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100170 } # Tests
171}
172
173# All configurations should be mapped here
174lava_gen_config_map = {"tfm_mps2_sse_200": tfm_mps2_sse_200}
175lavagen_config_sort_order = [
176 "templ",
177 "job_name",
178 "device_type",
179 "job_timeout",
180 "action_timeout",
181 "monitor_timeout",
182 "recovery_store_url",
183 "artifact_store_url",
184 "platforms",
185 "compilers",
186 "build_types",
187 "boot_types",
188 "tests"
189]
190
191lava_gen_monitor_sort_order = [
192 'name',
193 'start',
194 'end',
195 'pattern',
196 'fixup',
197]
198
199if __name__ == "__main__":
200 import os
201 import sys
202 from lava_helper import sort_lavagen_config
203 try:
204 from tfm_ci_pylib.utils import export_config_map
205 except ImportError:
206 dir_path = os.path.dirname(os.path.realpath(__file__))
207 sys.path.append(os.path.join(dir_path, "../"))
208 from tfm_ci_pylib.utils import export_config_map
209
210 if len(sys.argv) == 2:
211 if sys.argv[1] == "--export":
212 export_config_map(lava_gen_config_map)
213 if len(sys.argv) == 3:
214 if sys.argv[1] == "--export":
215 export_config_map(sort_lavagen_config(lava_gen_config_map),
216 sys.argv[2])