blob: bcea89da07acae8ab718d7b278b22791bf118cd4 [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 Galanakisea421232019-06-20 17:11:28 +010051 "device_type": "mps2plus",
52 "job_timeout": 120,
53 "action_timeout": 90,
54 "monitor_timeout": 90,
55 "poweroff_timeout": 10,
56 "recovery_store_url": "%(jenkins_url)s/"
57 "job/%(jenkins_job)s",
58 "artifact_store_url": "%(jenkins_url)s/"
59 "job/%(jenkins_job)s",
Minos Galanakis1c5e3482019-07-01 10:25:48 +010060 "platforms": {"AN521": "mps2_an521_v3.0.tar.gz",
61 "AN519": "mps2_an519_v3.0.tar.gz"},
Minos Galanakisb6c56792019-07-01 11:42:36 +010062 "compilers": ["ARMCLANG", "GNUARM"],
Minos Galanakisea421232019-06-20 17:11:28 +010063 "build_types": ["Debug", "Release"],
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010064 "boot_types": ["BL2"],
65 "tests": {
66 'Default': {
67 "binaries": {
Minos Galanakisea421232019-06-20 17:11:28 +010068 "firmware": "tfm_sign.bin",
69 "bootloader": "mcuboot.bin"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010070 },
71 "monitors": [
72 {
73 'name': 'Secure_Test_Suites_Summary',
74 'start': 'Jumping to the first image slot',
75 'end': '\\x1b\\\[0m',
76 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
77 r'(?P<test_case_id>Secure image '
78 r'initializing)(?P<result>!)',
79 'fixup': {"pass": "!", "fail": ""},
80 'required': ["secure_image_initializing"]
81 } # Monitors
82 ]
83 }, # Default
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010084 'Regression': {
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010085 "binaries": {
Minos Galanakisea421232019-06-20 17:11:28 +010086 "firmware": "tfm_sign.bin",
87 "bootloader": "mcuboot.bin"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010088 },
89 "monitors": [
90 {
91 'name': 'Secure_Test_Suites_Summary',
92 'start': 'Secure test suites summary',
93 'end': 'End of Secure test suites',
94 'pattern': r"[\x1b]\\[37mTest suite '(?P<"
Dean Birchf1b727a2019-05-17 17:39:24 +010095 r"test_case_id>[^\n]+)' has [\x1b]\\[32m "
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010096 r"(?P<result>PASSED|FAILED)",
97 'fixup': {"pass": "PASSED", "fail": "FAILED"},
98 'required': [
Minos Galanakis8305a6e2019-04-04 15:55:40 +010099 ("psa_protected_storage_"
100 "s_interface_tests_tfm_sst_test_2xxx_"),
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100101 "sst_reliability_tests_tfm_sst_test_3xxx_",
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100102 "sst_rollback_protection_tests_tfm_sst_test_4xxx_",
103 ("audit_"
104 "logging_secure_interface_test_tfm_audit_test_1xxx_"),
105 "crypto_secure_interface_tests_tfm_crypto_test_5xxx_",
106 ("initial_attestation_service_"
107 "secure_interface_tests_tfm_attest_test_1xxx_"),
108 "invert_secure_interface_tests_tfm_invert_test_1xxx_"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100109 ]
110 },
111 {
112 'name': 'Non_Secure_Test_Suites_Summary',
113 'start': 'Non-secure test suites summary',
114 'end': r'End of Non-secure test suites',
115 'pattern': r"[\x1b]\\[37mTest suite '(?P"
Dean Birchf1b727a2019-05-17 17:39:24 +0100116 r"<test_case_id>[^\n]+)' has [\x1b]\\[32m "
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100117 r"(?P<result>PASSED|FAILED)",
118 'fixup': {"pass": "PASSED", "fail": "FAILED"},
119 'required': [
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100120 ("psa_protected_storage"
121 "_ns_interface_tests_tfm_sst_test_1xxx_"),
122 ("auditlog_"
123 "non_secure_interface_test_tfm_audit_test_1xxx_"),
124 ("crypto_"
125 "non_secure_interface_test_tfm_crypto_test_6xxx_"),
126 ("initial_attestation_service_"
Minos Galanakisf0dae4e2019-05-20 10:56:57 +0100127 "non_secure_interface_tests_tfm_attest_test_2xxx_"),
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100128 ("invert_"
129 "non_secure_interface_tests_tfm_invert_test_1xxx_"),
130 "core_non_secure_positive_tests_tfm_core_test_1xxx_"
131 ]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100132 }
133 ] # Monitors
134 }, # Regression
Minos Galanakisea421232019-06-20 17:11:28 +0100135 'CoreIPC': {
136 "binaries": {
137 "firmware": "tfm_sign.bin",
138 "bootloader": "mcuboot.bin"
139 },
140 "monitors": [
141 {
142 'name': 'Secure_Test_Suites_Summary',
143 'start': 'Jumping to the first image slot',
144 'end': '\\x1b\\\[0m',
145 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
146 r'(?P<test_case_id>Secure image '
147 r'initializing)(?P<result>!)',
148 'fixup': {"pass": "!", "fail": ""},
149 'required': ["secure_image_initializing"]
150 } # Monitors
151 ]
152 }, # CoreIPC
153 'CoreIPCTfmLevel2': {
154 "binaries": {
155 "firmware": "tfm_sign.bin",
156 "bootloader": "mcuboot.bin"
157 },
158 "monitors": [
159 {
160 'name': 'Secure_Test_Suites_Summary',
161 'start': 'Jumping to the first image slot',
162 'end': '\\x1b\\\[0m',
163 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
164 r'(?P<test_case_id>Secure image '
165 r'initializing)(?P<result>!)',
166 'fixup': {"pass": "!", "fail": ""},
167 'required': ["secure_image_initializing"]
168 } # Monitors
169 ]
170 }, # CoreIPCTfmLevel2
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100171 } # Tests
172}
173
174# All configurations should be mapped here
175lava_gen_config_map = {"tfm_mps2_sse_200": tfm_mps2_sse_200}
176lavagen_config_sort_order = [
177 "templ",
178 "job_name",
179 "device_type",
180 "job_timeout",
181 "action_timeout",
182 "monitor_timeout",
183 "recovery_store_url",
184 "artifact_store_url",
185 "platforms",
186 "compilers",
187 "build_types",
188 "boot_types",
189 "tests"
190]
191
192lava_gen_monitor_sort_order = [
193 'name',
194 'start',
195 'end',
196 'pattern',
197 'fixup',
198]
199
200if __name__ == "__main__":
201 import os
202 import sys
203 from lava_helper import sort_lavagen_config
204 try:
205 from tfm_ci_pylib.utils import export_config_map
206 except ImportError:
207 dir_path = os.path.dirname(os.path.realpath(__file__))
208 sys.path.append(os.path.join(dir_path, "../"))
209 from tfm_ci_pylib.utils import export_config_map
210
211 if len(sys.argv) == 2:
212 if sys.argv[1] == "--export":
213 export_config_map(lava_gen_config_map)
214 if len(sys.argv) == 3:
215 if sys.argv[1] == "--export":
216 export_config_map(sort_lavagen_config(lava_gen_config_map),
217 sys.argv[2])