blob: ef87e988be190c0bcf539ab4df4d4717f6e7f452 [file] [log] [blame]
Minos Galanakisea421232019-06-20 17:11:28 +01001#!/usr/bin/env python3
2
3""" config_templatess.py:
4
5 """
6
7from __future__ import print_function
8from copy import deepcopy
9from .fastmodel_wrapper_config import fpv_wrapper_config
10
11__copyright__ = """
12/*
Karl Zhang08681e62020-10-30 13:56:03 +080013 * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
Minos Galanakisea421232019-06-20 17:11:28 +010014 *
15 * SPDX-License-Identifier: BSD-3-Clause
16 *
17 */
18 """
Karl Zhang08681e62020-10-30 13:56:03 +080019
20__author__ = "tf-m@lists.trustedfirmware.org"
Minos Galanakisea421232019-06-20 17:11:28 +010021__project__ = "Trusted Firmware-M Open CI"
Karl Zhang08681e62020-10-30 13:56:03 +080022__version__ = "1.2.0"
Minos Galanakisea421232019-06-20 17:11:28 +010023
24
25# =================== Template Classes ===================
26class template_cfg(fpv_wrapper_config):
27 """ Creates a skeleton template configuration that allows creation of
28 configuration variants which set the parameters of:
29 buildpath, config, platform, compiler , as well as the missing test params,
30 test_rex, test_cases, test_end_string """
31
32 _name = fpv_wrapper_config._name + "_%(platform)s_%(compiler)s_" + \
33 "%(config)s_%(build_type)s_%(bootloader)s"
34 # variant dictionary allows indivudal and targeted parameter modification
35 _vdict = {
36 "build_path": "%(build_path)s",
37 "variant_name_tpl": "%(variant_name_tpl)s",
38 "app_bin_path": "%(app_bin_path)s",
39 "app_bin": "%(app_bin)s",
40 "data_bin_path": "%(data_bin_path)s",
41 "data_bin": "%(data_bin)s",
42 "data_bin_offset": "%(data_bin_offset)s",
43 "config": "%(config)s",
44 "platform": "%(platform)s",
45 "compiler": "%(compiler)s",
Karl Zhangaff558a2020-05-15 14:28:23 +010046 "psa_suite": "%(psa_suite)s",
Minos Galanakisea421232019-06-20 17:11:28 +010047 "build_type": "%(build_type)s",
48 "bootloader": "%(bootloader)s"
49 }
50
51 _cfg = deepcopy(fpv_wrapper_config._cfg)
52 _cfg["directory"] = "FVP_MPS2"
53 _cfg["terminal_log"] = "terminal_%(variant_name_tpl)s.log"
54 _cfg["bin"] = "FVP_MPS2_AEMv8M"
55 _cfg["error_on_failed"] = False
56 _cfg["application"] = (
57 "cpu0=%(build_path)s/%(variant_name_tpl)s/" +
58 "%(app_bin_path)s/%(app_bin)s")
59 _cfg["data"] = (
60 "cpu0=%(build_path)s/%(variant_name_tpl)s/%(data_bin_path)s/" +
61 "%(data_bin)s@%(data_bin_offset)s")
62 _cfg["simlimit"] = "600"
63 _cfg["parameters"] = [
64 "fvp_mps2.platform_type=2",
65 "cpu0.baseline=0",
66 "cpu0.INITVTOR_S=0x10000000",
67 "cpu0.semihosting-enable=0",
68 "fvp_mps2.DISABLE_GATING=0",
69 "fvp_mps2.telnetterminal0.start_telnet=0",
70 "fvp_mps2.telnetterminal1.start_telnet=0",
71 "fvp_mps2.telnetterminal2.start_telnet=0",
72 "fvp_mps2.telnetterminal0.quiet=1",
73 "fvp_mps2.telnetterminal1.quiet=1",
74 "fvp_mps2.telnetterminal2.quiet=1",
75 "fvp_mps2.UART0.out_file=$TERM_FILE",
76 "fvp_mps2.UART0.unbuffered_output=1",
77 "fvp_mps2.UART0.shutdown_on_eot=1",
78 "fvp_mps2.mps2_visualisation.disable-visualisation=1"]
79
80
81class template_default_config(template_cfg):
82 """ Will automatically populate the required information for tfm
83 Default configuration testing. User still needs to set the
84 buildpath, platform, compiler variants """
85
86 _cfg = deepcopy(template_cfg._cfg)
87
88 _vdict = deepcopy(template_cfg._vdict)
89
90 # Set defaults across all variants
91 _vdict["build_path"] = "build-ci-all"
Fathi Boudra83e4f292020-12-04 22:33:40 +010092 _vdict["app_bin_path"] = "install/outputs/fvp"
93 _vdict["data_bin_path"] = "install/outputs/fvp"
Minos Galanakisea421232019-06-20 17:11:28 +010094 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
95 "%(build_type)s_%(bootloader)s"
96
97 # Mofify the %(config)s parameter of the template
98 _vdict["config"] = "ConfigDefault"
99 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
100
101 # System supports two types of matching with
102 # test_case_id and result match group and only test_case_id
103 _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] '
104 r'(?P<test_case_id>Secure image initializing!)\x1b\[0m'
105 )
106
107 # test_case_id capture group Should match test_cases entries
108 _cfg["test_cases"] = [
109 'Secure image initializing!',
110 ]
111 # Testing will stop if string is reached
112 _cfg["test_end_string"] = "Secure image initializing"
113 _cfg["simlimit"] = "120"
114
115class template_regression_config(template_cfg):
116 """ Will automatically populate the required information for tfm
117 Regression configuration testing. User still needs to set the
118 buildpath, platform, compiler variants """
119
120 _cfg = deepcopy(template_cfg._cfg)
121 _vdict = deepcopy(template_cfg._vdict)
122
123 # Set defaults across all variants
124 _vdict["build_path"] = "build-ci-all"
Fathi Boudra83e4f292020-12-04 22:33:40 +0100125 _vdict["app_bin_path"] = "install/outputs/fvp"
126 _vdict["data_bin_path"] = "install/outputs/fvp"
Minos Galanakisea421232019-06-20 17:11:28 +0100127 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
128 "%(build_type)s_%(bootloader)s"
129
130 # Mofify the %(config)s parameter of the template
131 _vdict["config"] = "ConfigRegression"
132 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
133
134 # Populate the test cases
135 _cfg["test_rex"] = (r"[\x1b]\[37mTest suite '(?P<test_case_id>[^\n]+)'"
136 r" has [\x1b]\[32m (?P<result>PASSED|FAILED)")
137 _cfg["test_cases"] = [
138 'PSA protected storage S interface tests (TFM_SST_TEST_2XXX)',
139 'PSA protected storage NS interface tests (TFM_SST_TEST_1XXX)',
140 'SST reliability tests (TFM_SST_TEST_3XXX)',
TudorCretu8b138472019-08-30 10:51:05 +0100141 'PSA internal trusted storage S interface tests (TFM_ITS_TEST_2XXX)',
142 'PSA internal trusted storage NS interface tests (TFM_ITS_TEST_1XXX)',
143 'ITS reliability tests (TFM_ITS_TEST_3XXX)',
Minos Galanakisea421232019-06-20 17:11:28 +0100144 'Core non-secure positive tests (TFM_CORE_TEST_1XXX)',
145 'AuditLog non-secure interface test (TFM_AUDIT_TEST_1XXX)',
146 'Crypto non-secure interface test (TFM_CRYPTO_TEST_6XXX)',
147 'Initial Attestation Service '
148 'non-secure interface tests(TFM_ATTEST_TEST_2XXX)',
Minos Galanakisea421232019-06-20 17:11:28 +0100149 'SST rollback protection tests (TFM_SST_TEST_4XXX)',
150 'Audit Logging secure interface test (TFM_AUDIT_TEST_1XXX)',
151 'Crypto secure interface tests (TFM_CRYPTO_TEST_5XXX)',
152 'Initial Attestation Service secure '
153 'interface tests(TFM_ATTEST_TEST_1XXX)',
Minos Galanakisea421232019-06-20 17:11:28 +0100154 ]
155 _cfg["test_end_string"] = "End of Non-secure test suites"
156
157 _cfg["simlimit"] = "1200"
158
159
160class template_coreipc_config(template_cfg):
161 """ Will automatically populate the required information for tfm
162 coreipc configuration testing. User still needs to set the
163 buildpath, platform, compiler variants """
164
165 _cfg = deepcopy(template_cfg._cfg)
166
167 _vdict = deepcopy(template_cfg._vdict)
168
169 # Set defaults across all variants
170 _vdict["build_path"] = "build-ci-all"
171
Fathi Boudra83e4f292020-12-04 22:33:40 +0100172 _vdict["app_bin_path"] = "install/outputs/fvp"
173 _vdict["data_bin_path"] = "install/outputs/fvp"
Minos Galanakisea421232019-06-20 17:11:28 +0100174
175 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
176 "%(build_type)s_%(bootloader)s"
177
178 # Mofify the %(config)s parameter of the template
179 _vdict["config"] = "ConfigCoreIPC"
180 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
181
182 # System supports two types of matching with
183 # test_case_id and result match group and only test_case_id
184 _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] '
185 r'(?P<test_case_id>Secure image initializing!)\x1b\[0m'
186 )
187
188 # test_case_id capture group Should match test_cases entries
189 _cfg["test_cases"] = [
190 'Secure image initializing!',
191 ]
192 # Testing will stop if string is reached
193 _cfg["test_end_string"] = "Secure image initializing"
194 _cfg["simlimit"] = "1200"
195
196class template_coreipctfmlevel2_config(template_cfg):
197 """ Will automatically populate the required information for tfm
198 coreipc tfmlevel2 configuration testing. User still needs to set the
199 buildpath, platform, compiler variants """
200
201 _cfg = deepcopy(template_cfg._cfg)
202
203 _vdict = deepcopy(template_cfg._vdict)
204
205 # Set defaults across all variants
206 _vdict["build_path"] = "build-ci-all"
207
Fathi Boudra83e4f292020-12-04 22:33:40 +0100208 _vdict["app_bin_path"] = "install/outputs/fvp"
209 _vdict["data_bin_path"] = "install/outputs/fvp"
Minos Galanakisea421232019-06-20 17:11:28 +0100210
211 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
212 "%(build_type)s_%(bootloader)s"
213
214 # Mofify the %(config)s parameter of the template
215 _vdict["config"] = "ConfigCoreIPCTfmLevel2"
216 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
217
218 # System supports two types of matching with
219 # test_case_id and result match group and only test_case_id
220 _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] '
221 r'(?P<test_case_id>Secure image initializing!)\x1b\[0m'
222 )
223
224 # test_case_id capture group Should match test_cases entries
225 _cfg["test_cases"] = [
226 'Secure image initializing!',
227 ]
228 # Testing will stop if string is reached
229 _cfg["test_end_string"] = "Secure image initializing"
230 _cfg["simlimit"] = "1200"
Karl Zhangaff558a2020-05-15 14:28:23 +0100231
232class template_psaapitestipctfmlevel2_config(template_cfg):
233 """ Will automatically populate the required information for tfm
234 coreipc tfmlevel2 configuration testing. User still needs to set the
235 buildpath, platform, compiler variants """
236
237 _cfg = deepcopy(template_cfg._cfg)
238
239 _vdict = deepcopy(template_cfg._vdict)
240
241 # Set defaults across all variants
242 _vdict["build_path"] = "build-ci-all"
243
Fathi Boudra83e4f292020-12-04 22:33:40 +0100244 _vdict["app_bin_path"] = "install/outputs/fvp"
245 _vdict["data_bin_path"] = "install/outputs/fvp"
Karl Zhangaff558a2020-05-15 14:28:23 +0100246
247 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
248 "%(psa_suite)s_%(build_type)s_%(bootloader)s"
249
250 # Mofify the %(config)s parameter of the template
251 _vdict["config"] = "ConfigPsaApiTestIPCTfmLevel2"
252 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
253
254 # System supports two types of matching with
255 # test_case_id and result match group and only test_case_id
256 _cfg["test_rex"] = (r'Entering standby'
257 )
258
259 # test_case_id capture group Should match test_cases entries
260 _cfg["test_cases"] = [
261 'Secure image initializing!',
262 ]
263 # Testing will stop if string is reached
264 _cfg["test_end_string"] = "Entering standby.."
265 _cfg["simlimit"] = "1200"
266
267class template_psaapitestipc_config(template_cfg):
268 """ Will automatically populate the required information for tfm
269 coreipc tfmlevel2 configuration testing. User still needs to set the
270 buildpath, platform, compiler variants """
271
272 _cfg = deepcopy(template_cfg._cfg)
273
274 _vdict = deepcopy(template_cfg._vdict)
275
276 # Set defaults across all variants
277 _vdict["build_path"] = "build-ci-all"
278
Fathi Boudra83e4f292020-12-04 22:33:40 +0100279 _vdict["app_bin_path"] = "install/outputs/fvp"
280 _vdict["data_bin_path"] = "install/outputs/fvp"
Karl Zhangaff558a2020-05-15 14:28:23 +0100281
282 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
283 "%(psa_suite)s_%(build_type)s_%(bootloader)s"
284
285 # Mofify the %(config)s parameter of the template
286 _vdict["config"] = "ConfigPsaApiTestIPC"
287 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
288
289 # System supports two types of matching with
290 # test_case_id and result match group and only test_case_id
291 _cfg["test_rex"] = (r'Entering standby'
292 )
293
294 # test_case_id capture group Should match test_cases entries
295 _cfg["test_cases"] = [
296 'Secure image initializing!',
297 ]
298 # Testing will stop if string is reached
299 _cfg["test_end_string"] = "Entering standby.."
300 _cfg["simlimit"] = "1200"
301
302class template_psaapitest_config(template_cfg):
303 """ Will automatically populate the required information for tfm
304 coreipc tfmlevel2 configuration testing. User still needs to set the
305 buildpath, platform, compiler variants """
306
307 _cfg = deepcopy(template_cfg._cfg)
308
309 _vdict = deepcopy(template_cfg._vdict)
310
311 # Set defaults across all variants
312 _vdict["build_path"] = "build-ci-all"
313
Fathi Boudra83e4f292020-12-04 22:33:40 +0100314 _vdict["app_bin_path"] = "install/outputs/fvp"
315 _vdict["data_bin_path"] = "install/outputs/fvp"
Karl Zhangaff558a2020-05-15 14:28:23 +0100316
317 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
318 "%(psa_suite)s_%(build_type)s_%(bootloader)s"
319
320 # Mofify the %(config)s parameter of the template
321 _vdict["config"] = "ConfigPsaApiTest"
322 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
323
324 # System supports two types of matching with
325 # test_case_id and result match group and only test_case_id
326 _cfg["test_rex"] = (r'Entering standby'
327 )
328
329 # test_case_id capture group Should match test_cases entries
330 _cfg["test_cases"] = [
331 'Secure image initializing!',
332 ]
333 # Testing will stop if string is reached
334 _cfg["test_end_string"] = "Entering standby.."
335 _cfg["simlimit"] = "1200"