Minos Galanakis | ea42123 | 2019-06-20 17:11:28 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | """ config_templatess.py: |
| 4 | |
| 5 | """ |
| 6 | |
| 7 | from __future__ import print_function |
| 8 | from copy import deepcopy |
| 9 | from .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 =================== |
| 27 | class 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", |
Karl Zhang | aff558a | 2020-05-15 14:28:23 +0100 | [diff] [blame] | 47 | "psa_suite": "%(psa_suite)s", |
Minos Galanakis | ea42123 | 2019-06-20 17:11:28 +0100 | [diff] [blame] | 48 | "build_type": "%(build_type)s", |
| 49 | "bootloader": "%(bootloader)s" |
| 50 | } |
| 51 | |
| 52 | _cfg = deepcopy(fpv_wrapper_config._cfg) |
| 53 | _cfg["directory"] = "FVP_MPS2" |
| 54 | _cfg["terminal_log"] = "terminal_%(variant_name_tpl)s.log" |
| 55 | _cfg["bin"] = "FVP_MPS2_AEMv8M" |
| 56 | _cfg["error_on_failed"] = False |
| 57 | _cfg["application"] = ( |
| 58 | "cpu0=%(build_path)s/%(variant_name_tpl)s/" + |
| 59 | "%(app_bin_path)s/%(app_bin)s") |
| 60 | _cfg["data"] = ( |
| 61 | "cpu0=%(build_path)s/%(variant_name_tpl)s/%(data_bin_path)s/" + |
| 62 | "%(data_bin)s@%(data_bin_offset)s") |
| 63 | _cfg["simlimit"] = "600" |
| 64 | _cfg["parameters"] = [ |
| 65 | "fvp_mps2.platform_type=2", |
| 66 | "cpu0.baseline=0", |
| 67 | "cpu0.INITVTOR_S=0x10000000", |
| 68 | "cpu0.semihosting-enable=0", |
| 69 | "fvp_mps2.DISABLE_GATING=0", |
| 70 | "fvp_mps2.telnetterminal0.start_telnet=0", |
| 71 | "fvp_mps2.telnetterminal1.start_telnet=0", |
| 72 | "fvp_mps2.telnetterminal2.start_telnet=0", |
| 73 | "fvp_mps2.telnetterminal0.quiet=1", |
| 74 | "fvp_mps2.telnetterminal1.quiet=1", |
| 75 | "fvp_mps2.telnetterminal2.quiet=1", |
| 76 | "fvp_mps2.UART0.out_file=$TERM_FILE", |
| 77 | "fvp_mps2.UART0.unbuffered_output=1", |
| 78 | "fvp_mps2.UART0.shutdown_on_eot=1", |
| 79 | "fvp_mps2.mps2_visualisation.disable-visualisation=1"] |
| 80 | |
| 81 | |
| 82 | class template_default_config(template_cfg): |
| 83 | """ Will automatically populate the required information for tfm |
| 84 | Default configuration testing. User still needs to set the |
| 85 | buildpath, platform, compiler variants """ |
| 86 | |
| 87 | _cfg = deepcopy(template_cfg._cfg) |
| 88 | |
| 89 | _vdict = deepcopy(template_cfg._vdict) |
| 90 | |
| 91 | # Set defaults across all variants |
| 92 | _vdict["build_path"] = "build-ci-all" |
| 93 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 94 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 95 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 96 | "%(build_type)s_%(bootloader)s" |
| 97 | |
| 98 | # Mofify the %(config)s parameter of the template |
| 99 | _vdict["config"] = "ConfigDefault" |
| 100 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 101 | |
| 102 | # System supports two types of matching with |
| 103 | # test_case_id and result match group and only test_case_id |
| 104 | _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] ' |
| 105 | r'(?P<test_case_id>Secure image initializing!)\x1b\[0m' |
| 106 | ) |
| 107 | |
| 108 | # test_case_id capture group Should match test_cases entries |
| 109 | _cfg["test_cases"] = [ |
| 110 | 'Secure image initializing!', |
| 111 | ] |
| 112 | # Testing will stop if string is reached |
| 113 | _cfg["test_end_string"] = "Secure image initializing" |
| 114 | _cfg["simlimit"] = "120" |
| 115 | |
| 116 | class template_regression_config(template_cfg): |
| 117 | """ Will automatically populate the required information for tfm |
| 118 | Regression configuration testing. User still needs to set the |
| 119 | buildpath, platform, compiler variants """ |
| 120 | |
| 121 | _cfg = deepcopy(template_cfg._cfg) |
| 122 | _vdict = deepcopy(template_cfg._vdict) |
| 123 | |
| 124 | # Set defaults across all variants |
| 125 | _vdict["build_path"] = "build-ci-all" |
| 126 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 127 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 128 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 129 | "%(build_type)s_%(bootloader)s" |
| 130 | |
| 131 | # Mofify the %(config)s parameter of the template |
| 132 | _vdict["config"] = "ConfigRegression" |
| 133 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 134 | |
| 135 | # Populate the test cases |
| 136 | _cfg["test_rex"] = (r"[\x1b]\[37mTest suite '(?P<test_case_id>[^\n]+)'" |
| 137 | r" has [\x1b]\[32m (?P<result>PASSED|FAILED)") |
| 138 | _cfg["test_cases"] = [ |
| 139 | 'PSA protected storage S interface tests (TFM_SST_TEST_2XXX)', |
| 140 | 'PSA protected storage NS interface tests (TFM_SST_TEST_1XXX)', |
| 141 | 'SST reliability tests (TFM_SST_TEST_3XXX)', |
TudorCretu | 8b13847 | 2019-08-30 10:51:05 +0100 | [diff] [blame] | 142 | 'PSA internal trusted storage S interface tests (TFM_ITS_TEST_2XXX)', |
| 143 | 'PSA internal trusted storage NS interface tests (TFM_ITS_TEST_1XXX)', |
| 144 | 'ITS reliability tests (TFM_ITS_TEST_3XXX)', |
Minos Galanakis | ea42123 | 2019-06-20 17:11:28 +0100 | [diff] [blame] | 145 | 'Core non-secure positive tests (TFM_CORE_TEST_1XXX)', |
| 146 | 'AuditLog non-secure interface test (TFM_AUDIT_TEST_1XXX)', |
| 147 | 'Crypto non-secure interface test (TFM_CRYPTO_TEST_6XXX)', |
| 148 | 'Initial Attestation Service ' |
| 149 | 'non-secure interface tests(TFM_ATTEST_TEST_2XXX)', |
Minos Galanakis | ea42123 | 2019-06-20 17:11:28 +0100 | [diff] [blame] | 150 | 'SST rollback protection tests (TFM_SST_TEST_4XXX)', |
| 151 | 'Audit Logging secure interface test (TFM_AUDIT_TEST_1XXX)', |
| 152 | 'Crypto secure interface tests (TFM_CRYPTO_TEST_5XXX)', |
| 153 | 'Initial Attestation Service secure ' |
| 154 | 'interface tests(TFM_ATTEST_TEST_1XXX)', |
Minos Galanakis | ea42123 | 2019-06-20 17:11:28 +0100 | [diff] [blame] | 155 | ] |
| 156 | _cfg["test_end_string"] = "End of Non-secure test suites" |
| 157 | |
| 158 | _cfg["simlimit"] = "1200" |
| 159 | |
| 160 | |
| 161 | class template_coreipc_config(template_cfg): |
| 162 | """ Will automatically populate the required information for tfm |
| 163 | coreipc configuration testing. User still needs to set the |
| 164 | buildpath, platform, compiler variants """ |
| 165 | |
| 166 | _cfg = deepcopy(template_cfg._cfg) |
| 167 | |
| 168 | _vdict = deepcopy(template_cfg._vdict) |
| 169 | |
| 170 | # Set defaults across all variants |
| 171 | _vdict["build_path"] = "build-ci-all" |
| 172 | |
| 173 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 174 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 175 | |
| 176 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 177 | "%(build_type)s_%(bootloader)s" |
| 178 | |
| 179 | # Mofify the %(config)s parameter of the template |
| 180 | _vdict["config"] = "ConfigCoreIPC" |
| 181 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 182 | |
| 183 | # System supports two types of matching with |
| 184 | # test_case_id and result match group and only test_case_id |
| 185 | _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] ' |
| 186 | r'(?P<test_case_id>Secure image initializing!)\x1b\[0m' |
| 187 | ) |
| 188 | |
| 189 | # test_case_id capture group Should match test_cases entries |
| 190 | _cfg["test_cases"] = [ |
| 191 | 'Secure image initializing!', |
| 192 | ] |
| 193 | # Testing will stop if string is reached |
| 194 | _cfg["test_end_string"] = "Secure image initializing" |
| 195 | _cfg["simlimit"] = "1200" |
| 196 | |
| 197 | class template_coreipctfmlevel2_config(template_cfg): |
| 198 | """ Will automatically populate the required information for tfm |
| 199 | coreipc tfmlevel2 configuration testing. User still needs to set the |
| 200 | buildpath, platform, compiler variants """ |
| 201 | |
| 202 | _cfg = deepcopy(template_cfg._cfg) |
| 203 | |
| 204 | _vdict = deepcopy(template_cfg._vdict) |
| 205 | |
| 206 | # Set defaults across all variants |
| 207 | _vdict["build_path"] = "build-ci-all" |
| 208 | |
| 209 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 210 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 211 | |
| 212 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 213 | "%(build_type)s_%(bootloader)s" |
| 214 | |
| 215 | # Mofify the %(config)s parameter of the template |
| 216 | _vdict["config"] = "ConfigCoreIPCTfmLevel2" |
| 217 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 218 | |
| 219 | # System supports two types of matching with |
| 220 | # test_case_id and result match group and only test_case_id |
| 221 | _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] ' |
| 222 | r'(?P<test_case_id>Secure image initializing!)\x1b\[0m' |
| 223 | ) |
| 224 | |
| 225 | # test_case_id capture group Should match test_cases entries |
| 226 | _cfg["test_cases"] = [ |
| 227 | 'Secure image initializing!', |
| 228 | ] |
| 229 | # Testing will stop if string is reached |
| 230 | _cfg["test_end_string"] = "Secure image initializing" |
| 231 | _cfg["simlimit"] = "1200" |
Karl Zhang | aff558a | 2020-05-15 14:28:23 +0100 | [diff] [blame] | 232 | |
| 233 | class template_psaapitestipctfmlevel2_config(template_cfg): |
| 234 | """ Will automatically populate the required information for tfm |
| 235 | coreipc tfmlevel2 configuration testing. User still needs to set the |
| 236 | buildpath, platform, compiler variants """ |
| 237 | |
| 238 | _cfg = deepcopy(template_cfg._cfg) |
| 239 | |
| 240 | _vdict = deepcopy(template_cfg._vdict) |
| 241 | |
| 242 | # Set defaults across all variants |
| 243 | _vdict["build_path"] = "build-ci-all" |
| 244 | |
| 245 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 246 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 247 | |
| 248 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 249 | "%(psa_suite)s_%(build_type)s_%(bootloader)s" |
| 250 | |
| 251 | # Mofify the %(config)s parameter of the template |
| 252 | _vdict["config"] = "ConfigPsaApiTestIPCTfmLevel2" |
| 253 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 254 | |
| 255 | # System supports two types of matching with |
| 256 | # test_case_id and result match group and only test_case_id |
| 257 | _cfg["test_rex"] = (r'Entering standby' |
| 258 | ) |
| 259 | |
| 260 | # test_case_id capture group Should match test_cases entries |
| 261 | _cfg["test_cases"] = [ |
| 262 | 'Secure image initializing!', |
| 263 | ] |
| 264 | # Testing will stop if string is reached |
| 265 | _cfg["test_end_string"] = "Entering standby.." |
| 266 | _cfg["simlimit"] = "1200" |
| 267 | |
| 268 | class template_psaapitestipc_config(template_cfg): |
| 269 | """ Will automatically populate the required information for tfm |
| 270 | coreipc tfmlevel2 configuration testing. User still needs to set the |
| 271 | buildpath, platform, compiler variants """ |
| 272 | |
| 273 | _cfg = deepcopy(template_cfg._cfg) |
| 274 | |
| 275 | _vdict = deepcopy(template_cfg._vdict) |
| 276 | |
| 277 | # Set defaults across all variants |
| 278 | _vdict["build_path"] = "build-ci-all" |
| 279 | |
| 280 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 281 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 282 | |
| 283 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 284 | "%(psa_suite)s_%(build_type)s_%(bootloader)s" |
| 285 | |
| 286 | # Mofify the %(config)s parameter of the template |
| 287 | _vdict["config"] = "ConfigPsaApiTestIPC" |
| 288 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 289 | |
| 290 | # System supports two types of matching with |
| 291 | # test_case_id and result match group and only test_case_id |
| 292 | _cfg["test_rex"] = (r'Entering standby' |
| 293 | ) |
| 294 | |
| 295 | # test_case_id capture group Should match test_cases entries |
| 296 | _cfg["test_cases"] = [ |
| 297 | 'Secure image initializing!', |
| 298 | ] |
| 299 | # Testing will stop if string is reached |
| 300 | _cfg["test_end_string"] = "Entering standby.." |
| 301 | _cfg["simlimit"] = "1200" |
| 302 | |
| 303 | class template_psaapitest_config(template_cfg): |
| 304 | """ Will automatically populate the required information for tfm |
| 305 | coreipc tfmlevel2 configuration testing. User still needs to set the |
| 306 | buildpath, platform, compiler variants """ |
| 307 | |
| 308 | _cfg = deepcopy(template_cfg._cfg) |
| 309 | |
| 310 | _vdict = deepcopy(template_cfg._vdict) |
| 311 | |
| 312 | # Set defaults across all variants |
| 313 | _vdict["build_path"] = "build-ci-all" |
| 314 | |
| 315 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 316 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 317 | |
| 318 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 319 | "%(psa_suite)s_%(build_type)s_%(bootloader)s" |
| 320 | |
| 321 | # Mofify the %(config)s parameter of the template |
| 322 | _vdict["config"] = "ConfigPsaApiTest" |
| 323 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 324 | |
| 325 | # System supports two types of matching with |
| 326 | # test_case_id and result match group and only test_case_id |
| 327 | _cfg["test_rex"] = (r'Entering standby' |
| 328 | ) |
| 329 | |
| 330 | # test_case_id capture group Should match test_cases entries |
| 331 | _cfg["test_cases"] = [ |
| 332 | 'Secure image initializing!', |
| 333 | ] |
| 334 | # Testing will stop if string is reached |
| 335 | _cfg["test_end_string"] = "Entering standby.." |
| 336 | _cfg["simlimit"] = "1200" |