blob: 1ac1479e5e662c5fdf3b00a43fa83cada36ab79a [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/"
55 "job/tf-m-build-test-review",
56 "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': {
64 "binaries": {
65 "firmware":
66 "install/outputs/AN521/tfm_sign.bin",
67 "bootloader":
68 "install/outputs/AN521/mcuboot.bin"
69 },
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
83 'CoreTest': {
84 "recovery": "mps2_sse200_an512.tar.gz",
85 "binaries": {
86 "firmware": "install/outputs/AN521/tfm_sign.bin",
87 "bootloader": "install/outputs/AN521/mcuboot.bin"
88 },
89 "monitors": [
90 {
91 'name': 'Non_Secure_Test_Suites_Summary',
92 'start': 'TFM level is: 3',
93 'end': 'End of Non-secure test suites',
94 'pattern': r"[\x1b]\\[37mTest suite '"
95 r"(?P<test_case_id>.*)' has [\x1b]\\[32m"
96 r" (?P<result>PASSED|FAILED)",
97 'fixup': {"pass": "PASSED", "fail": "FAILED"},
98 'required': [
99 "core_non_secure_positive_tests_tfm_core_test_1xxx_"]
100 } # Monitors
101 ]
102 }, # CoreTest
103 'Regression': {
104 "recovery": "mps2_sse200_an512.tar.gz",
105 "binaries": {
106 "firmware": "install/outputs/AN521/tfm_sign.bin",
107 "bootloader": "install/outputs/AN521/mcuboot.bin"
108 },
109 "monitors": [
110 {
111 'name': 'Secure_Test_Suites_Summary',
112 'start': 'Secure test suites summary',
113 'end': 'End of Secure test suites',
114 'pattern': r"[\x1b]\\[37mTest suite '(?P<"
115 r"test_case_id>.*)' has [\x1b]\\[32m "
116 r"(?P<result>PASSED|FAILED)",
117 'fixup': {"pass": "PASSED", "fail": "FAILED"},
118 'required': [
119 "invert_secure_interface_tests_tfm_invert_test_1xxx_",
120 "sst_reliability_tests_tfm_sst_test_3xxx_",
121 "sst_secure_interface_tests_tfm_sst_test_2xxx_"
122 ]
123 },
124 {
125 'name': 'Non_Secure_Test_Suites_Summary',
126 'start': 'Non-secure test suites summary',
127 'end': r'End of Non-secure test suites',
128 'pattern': r"[\x1b]\\[37mTest suite '(?P"
129 r"<test_case_id>.*)' has [\x1b]\\[32m "
130 r"(?P<result>PASSED|FAILED)",
131 'fixup': {"pass": "PASSED", "fail": "FAILED"},
132 'required': [
133 "core_non_secure_positive_tests_tfm_core_test_1xxx_",
134 ("invert_non_secure_interface_tests_"
135 "tfm_invert_test_1xxx_"),
136 "sst_policy_tests_tfm_sst_test_4xxx_",
137 "sst_non_secure_interface_tests_tfm_sst_test_1xxx_",
138 "sst_referenced_access_tests_tfm_sst_test_5xxx_"]
139 }
140 ] # Monitors
141 }, # Regression
142 } # Tests
143}
144
145# All configurations should be mapped here
146lava_gen_config_map = {"tfm_mps2_sse_200": tfm_mps2_sse_200}
147lavagen_config_sort_order = [
148 "templ",
149 "job_name",
150 "device_type",
151 "job_timeout",
152 "action_timeout",
153 "monitor_timeout",
154 "recovery_store_url",
155 "artifact_store_url",
156 "platforms",
157 "compilers",
158 "build_types",
159 "boot_types",
160 "tests"
161]
162
163lava_gen_monitor_sort_order = [
164 'name',
165 'start',
166 'end',
167 'pattern',
168 'fixup',
169]
170
171if __name__ == "__main__":
172 import os
173 import sys
174 from lava_helper import sort_lavagen_config
175 try:
176 from tfm_ci_pylib.utils import export_config_map
177 except ImportError:
178 dir_path = os.path.dirname(os.path.realpath(__file__))
179 sys.path.append(os.path.join(dir_path, "../"))
180 from tfm_ci_pylib.utils import export_config_map
181
182 if len(sys.argv) == 2:
183 if sys.argv[1] == "--export":
184 export_config_map(lava_gen_config_map)
185 if len(sys.argv) == 3:
186 if sys.argv[1] == "--export":
187 export_config_map(sort_lavagen_config(lava_gen_config_map),
188 sys.argv[2])