blob: 100b0ed084ccd588a852f3631c4f86ad90992ae6 [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")
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010038 if not regression:
39 tests.pop("Regression")
40
41 cfg["tests"] = tests
42 return cfg
43
44
45tfm_mps2_sse_200 = {
46 "templ": "template_tfm_mps2_sse_200.jinja2",
47 "job_name": "mps2plus-arm-tfm",
48 "device_type": "mps",
49 "job_timeout": 60,
50 "action_timeout": 60,
51 "monitor_timeout": 60,
52 "recovery_store_url": "https://ci.trustedfirmware.org/"
Minos Galanakis054ec1b2019-05-17 12:01:36 +010053 "job/tf-m-fpga-image-store",
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010054 "artifact_store_url": "https://ci.trustedfirmware.org/"
55 "job/tf-m-build-test-review",
56 "platforms": {"AN521": "mps2_sse200_an512.tar.gz"},
57 "compilers": ["GNUARM"],
58 "build_types": ["Debug"],
59 "boot_types": ["BL2"],
60 "tests": {
61 'Default': {
Minos Galanakis8305a6e2019-04-04 15:55:40 +010062 "recovery": "mps2_sse200_an512.tar.gz",
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010063 "binaries": {
64 "firmware":
65 "install/outputs/AN521/tfm_sign.bin",
66 "bootloader":
67 "install/outputs/AN521/mcuboot.bin"
68 },
69 "monitors": [
70 {
71 'name': 'Secure_Test_Suites_Summary',
72 'start': 'Jumping to the first image slot',
73 'end': '\\x1b\\\[0m',
74 'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
75 r'(?P<test_case_id>Secure image '
76 r'initializing)(?P<result>!)',
77 'fixup': {"pass": "!", "fail": ""},
78 'required': ["secure_image_initializing"]
79 } # Monitors
80 ]
81 }, # Default
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010082 'Regression': {
83 "recovery": "mps2_sse200_an512.tar.gz",
84 "binaries": {
85 "firmware": "install/outputs/AN521/tfm_sign.bin",
86 "bootloader": "install/outputs/AN521/mcuboot.bin"
87 },
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
134 } # Tests
135}
136
137# All configurations should be mapped here
138lava_gen_config_map = {"tfm_mps2_sse_200": tfm_mps2_sse_200}
139lavagen_config_sort_order = [
140 "templ",
141 "job_name",
142 "device_type",
143 "job_timeout",
144 "action_timeout",
145 "monitor_timeout",
146 "recovery_store_url",
147 "artifact_store_url",
148 "platforms",
149 "compilers",
150 "build_types",
151 "boot_types",
152 "tests"
153]
154
155lava_gen_monitor_sort_order = [
156 'name',
157 'start',
158 'end',
159 'pattern',
160 'fixup',
161]
162
163if __name__ == "__main__":
164 import os
165 import sys
166 from lava_helper import sort_lavagen_config
167 try:
168 from tfm_ci_pylib.utils import export_config_map
169 except ImportError:
170 dir_path = os.path.dirname(os.path.realpath(__file__))
171 sys.path.append(os.path.join(dir_path, "../"))
172 from tfm_ci_pylib.utils import export_config_map
173
174 if len(sys.argv) == 2:
175 if sys.argv[1] == "--export":
176 export_config_map(lava_gen_config_map)
177 if len(sys.argv) == 3:
178 if sys.argv[1] == "--export":
179 export_config_map(sort_lavagen_config(lava_gen_config_map),
180 sys.argv[2])