blob: 6c9c636981f90b010efe47db0d359e2b74c05e2b [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/*
13 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
14 *
15 * SPDX-License-Identifier: BSD-3-Clause
16 *
17 */
18 """
19__author__ = "Minos Galanakis"
20__email__ = "minos.galanakis@linaro.org"
21__project__ = "Trusted Firmware-M Open CI"
22__status__ = "stable"
23__version__ = "1.1"
24
25
26# =================== Template Classes ===================
27class template_cfg(fpv_wrapper_config):
28 """ Creates a skeleton template configuration that allows creation of
29 configuration variants which set the parameters of:
30 buildpath, config, platform, compiler , as well as the missing test params,
31 test_rex, test_cases, test_end_string """
32
33 _name = fpv_wrapper_config._name + "_%(platform)s_%(compiler)s_" + \
34 "%(config)s_%(build_type)s_%(bootloader)s"
35 # variant dictionary allows indivudal and targeted parameter modification
36 _vdict = {
37 "build_path": "%(build_path)s",
38 "variant_name_tpl": "%(variant_name_tpl)s",
39 "app_bin_path": "%(app_bin_path)s",
40 "app_bin": "%(app_bin)s",
41 "data_bin_path": "%(data_bin_path)s",
42 "data_bin": "%(data_bin)s",
43 "data_bin_offset": "%(data_bin_offset)s",
44 "config": "%(config)s",
45 "platform": "%(platform)s",
46 "compiler": "%(compiler)s",
47 "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"
92 _vdict["app_bin_path"] = "install/outputs/fvp"
93 _vdict["data_bin_path"] = "install/outputs/fvp"
94 _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"
125 _vdict["app_bin_path"] = "install/outputs/fvp"
126 _vdict["data_bin_path"] = "install/outputs/fvp"
127 _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)',
141 'Core non-secure positive tests (TFM_CORE_TEST_1XXX)',
142 'AuditLog non-secure interface test (TFM_AUDIT_TEST_1XXX)',
143 'Crypto non-secure interface test (TFM_CRYPTO_TEST_6XXX)',
144 'Initial Attestation Service '
145 'non-secure interface tests(TFM_ATTEST_TEST_2XXX)',
146 'Invert non-secure interface tests (TFM_INVERT_TEST_1XXX)',
147 'SST rollback protection tests (TFM_SST_TEST_4XXX)',
148 'Audit Logging secure interface test (TFM_AUDIT_TEST_1XXX)',
149 'Crypto secure interface tests (TFM_CRYPTO_TEST_5XXX)',
150 'Initial Attestation Service secure '
151 'interface tests(TFM_ATTEST_TEST_1XXX)',
152 'Invert secure interface tests (TFM_INVERT_TEST_1XXX)',
153 ]
154 _cfg["test_end_string"] = "End of Non-secure test suites"
155
156 _cfg["simlimit"] = "1200"
157
158
159class template_coreipc_config(template_cfg):
160 """ Will automatically populate the required information for tfm
161 coreipc configuration testing. User still needs to set the
162 buildpath, platform, compiler variants """
163
164 _cfg = deepcopy(template_cfg._cfg)
165
166 _vdict = deepcopy(template_cfg._vdict)
167
168 # Set defaults across all variants
169 _vdict["build_path"] = "build-ci-all"
170
171 _vdict["app_bin_path"] = "install/outputs/fvp"
172 _vdict["data_bin_path"] = "install/outputs/fvp"
173
174 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
175 "%(build_type)s_%(bootloader)s"
176
177 # Mofify the %(config)s parameter of the template
178 _vdict["config"] = "ConfigCoreIPC"
179 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
180
181 # System supports two types of matching with
182 # test_case_id and result match group and only test_case_id
183 _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] '
184 r'(?P<test_case_id>Secure image initializing!)\x1b\[0m'
185 )
186
187 # test_case_id capture group Should match test_cases entries
188 _cfg["test_cases"] = [
189 'Secure image initializing!',
190 ]
191 # Testing will stop if string is reached
192 _cfg["test_end_string"] = "Secure image initializing"
193 _cfg["simlimit"] = "1200"
194
195class template_coreipctfmlevel2_config(template_cfg):
196 """ Will automatically populate the required information for tfm
197 coreipc tfmlevel2 configuration testing. User still needs to set the
198 buildpath, platform, compiler variants """
199
200 _cfg = deepcopy(template_cfg._cfg)
201
202 _vdict = deepcopy(template_cfg._vdict)
203
204 # Set defaults across all variants
205 _vdict["build_path"] = "build-ci-all"
206
207 _vdict["app_bin_path"] = "install/outputs/fvp"
208 _vdict["data_bin_path"] = "install/outputs/fvp"
209
210 _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \
211 "%(build_type)s_%(bootloader)s"
212
213 # Mofify the %(config)s parameter of the template
214 _vdict["config"] = "ConfigCoreIPCTfmLevel2"
215 _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict
216
217 # System supports two types of matching with
218 # test_case_id and result match group and only test_case_id
219 _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] '
220 r'(?P<test_case_id>Secure image initializing!)\x1b\[0m'
221 )
222
223 # test_case_id capture group Should match test_cases entries
224 _cfg["test_cases"] = [
225 'Secure image initializing!',
226 ]
227 # Testing will stop if string is reached
228 _cfg["test_end_string"] = "Secure image initializing"
229 _cfg["simlimit"] = "1200"