blob: 2f976523baddcaa404a6f78c8b9bdde09e24a1fa [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)',
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
172 _vdict["app_bin_path"] = "install/outputs/fvp"
173 _vdict["data_bin_path"] = "install/outputs/fvp"
174
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
208 _vdict["app_bin_path"] = "install/outputs/fvp"
209 _vdict["data_bin_path"] = "install/outputs/fvp"
210
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"