blob: b4165a97e2645823d437a2d877649ab1ae4a0073 [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"
21__version__ = "1.0"
22
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")
38 if not core:
39 tests.pop("CoreTest")
40 if not regression:
41 tests.pop("Regression")
42
43 cfg["tests"] = tests
44 return cfg
45
46
47tfm_mps2_sse_200 = {
48 "templ": "template_tfm_mps2_sse_200.jinja2",
49 "job_name": "mps2plus-arm-tfm",
50 "device_type": "mps",
51 "job_timeout": 60,
52 "action_timeout": 60,
53 "monitor_timeout": 60,
54 "recovery_store_url": "https://ci.trustedfirmware.org/"
Minos Galanakis054ec1b2019-05-17 12:01:36 +010055 "job/tf-m-fpga-image-store",
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010056 "artifact_store_url": "https://ci.trustedfirmware.org/"
57 "job/tf-m-build-test-review",
58 "platforms": {"AN521": "mps2_sse200_an512.tar.gz"},
59 "compilers": ["GNUARM"],
60 "build_types": ["Debug"],
61 "boot_types": ["BL2"],
62 "tests": {
63 'Default': {
Minos Galanakis8305a6e2019-04-04 15:55:40 +010064 "recovery": "mps2_sse200_an512.tar.gz",
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010065 "binaries": {
66 "firmware":
67 "install/outputs/AN521/tfm_sign.bin",
68 "bootloader":
69 "install/outputs/AN521/mcuboot.bin"
70 },
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
84 'CoreTest': {
85 "recovery": "mps2_sse200_an512.tar.gz",
86 "binaries": {
87 "firmware": "install/outputs/AN521/tfm_sign.bin",
88 "bootloader": "install/outputs/AN521/mcuboot.bin"
89 },
90 "monitors": [
91 {
92 'name': 'Non_Secure_Test_Suites_Summary',
93 'start': 'TFM level is: 3',
94 'end': 'End of Non-secure test suites',
95 'pattern': r"[\x1b]\\[37mTest suite '"
96 r"(?P<test_case_id>.*)' has [\x1b]\\[32m"
97 r" (?P<result>PASSED|FAILED)",
98 'fixup': {"pass": "PASSED", "fail": "FAILED"},
99 'required': [
100 "core_non_secure_positive_tests_tfm_core_test_1xxx_"]
101 } # Monitors
102 ]
103 }, # CoreTest
104 'Regression': {
105 "recovery": "mps2_sse200_an512.tar.gz",
106 "binaries": {
107 "firmware": "install/outputs/AN521/tfm_sign.bin",
108 "bootloader": "install/outputs/AN521/mcuboot.bin"
109 },
110 "monitors": [
111 {
112 'name': 'Secure_Test_Suites_Summary',
113 'start': 'Secure test suites summary',
114 'end': 'End of Secure test suites',
115 'pattern': r"[\x1b]\\[37mTest suite '(?P<"
116 r"test_case_id>.*)' has [\x1b]\\[32m "
117 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 "s_interface_tests_tfm_sst_test_2xxx_"),
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100122 "sst_reliability_tests_tfm_sst_test_3xxx_",
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100123 "sst_rollback_protection_tests_tfm_sst_test_4xxx_",
124 ("audit_"
125 "logging_secure_interface_test_tfm_audit_test_1xxx_"),
126 "crypto_secure_interface_tests_tfm_crypto_test_5xxx_",
127 ("initial_attestation_service_"
128 "secure_interface_tests_tfm_attest_test_1xxx_"),
129 "invert_secure_interface_tests_tfm_invert_test_1xxx_"
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100130 ]
131 },
132 {
133 'name': 'Non_Secure_Test_Suites_Summary',
134 'start': 'Non-secure test suites summary',
135 'end': r'End of Non-secure test suites',
136 'pattern': r"[\x1b]\\[37mTest suite '(?P"
137 r"<test_case_id>.*)' has [\x1b]\\[32m "
138 r"(?P<result>PASSED|FAILED)",
139 'fixup': {"pass": "PASSED", "fail": "FAILED"},
140 'required': [
Minos Galanakis8305a6e2019-04-04 15:55:40 +0100141 ("psa_protected_storage"
142 "_ns_interface_tests_tfm_sst_test_1xxx_"),
143 ("auditlog_"
144 "non_secure_interface_test_tfm_audit_test_1xxx_"),
145 ("crypto_"
146 "non_secure_interface_test_tfm_crypto_test_6xxx_"),
147 ("initial_attestation_service_"
148 "secure_interface_tests_tfm_attest_test_2xxx_"),
149 ("invert_"
150 "non_secure_interface_tests_tfm_invert_test_1xxx_"),
151 "core_non_secure_positive_tests_tfm_core_test_1xxx_"
152 ]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +0100153 }
154 ] # Monitors
155 }, # Regression
156 } # Tests
157}
158
159# All configurations should be mapped here
160lava_gen_config_map = {"tfm_mps2_sse_200": tfm_mps2_sse_200}
161lavagen_config_sort_order = [
162 "templ",
163 "job_name",
164 "device_type",
165 "job_timeout",
166 "action_timeout",
167 "monitor_timeout",
168 "recovery_store_url",
169 "artifact_store_url",
170 "platforms",
171 "compilers",
172 "build_types",
173 "boot_types",
174 "tests"
175]
176
177lava_gen_monitor_sort_order = [
178 'name',
179 'start',
180 'end',
181 'pattern',
182 'fixup',
183]
184
185if __name__ == "__main__":
186 import os
187 import sys
188 from lava_helper import sort_lavagen_config
189 try:
190 from tfm_ci_pylib.utils import export_config_map
191 except ImportError:
192 dir_path = os.path.dirname(os.path.realpath(__file__))
193 sys.path.append(os.path.join(dir_path, "../"))
194 from tfm_ci_pylib.utils import export_config_map
195
196 if len(sys.argv) == 2:
197 if sys.argv[1] == "--export":
198 export_config_map(lava_gen_config_map)
199 if len(sys.argv) == 3:
200 if sys.argv[1] == "--export":
201 export_config_map(sort_lavagen_config(lava_gen_config_map),
202 sys.argv[2])