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", |
| 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 | |
| 81 | class 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 | |
| 115 | class 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)', |
TudorCretu | 8b13847 | 2019-08-30 10:51:05 +0100 | [diff] [blame^] | 141 | '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 Galanakis | ea42123 | 2019-06-20 17:11:28 +0100 | [diff] [blame] | 144 | '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)', |
| 149 | 'Invert non-secure interface tests (TFM_INVERT_TEST_1XXX)', |
| 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)', |
| 155 | 'Invert secure interface tests (TFM_INVERT_TEST_1XXX)', |
| 156 | ] |
| 157 | _cfg["test_end_string"] = "End of Non-secure test suites" |
| 158 | |
| 159 | _cfg["simlimit"] = "1200" |
| 160 | |
| 161 | |
| 162 | class template_coreipc_config(template_cfg): |
| 163 | """ Will automatically populate the required information for tfm |
| 164 | coreipc configuration testing. User still needs to set the |
| 165 | buildpath, platform, compiler variants """ |
| 166 | |
| 167 | _cfg = deepcopy(template_cfg._cfg) |
| 168 | |
| 169 | _vdict = deepcopy(template_cfg._vdict) |
| 170 | |
| 171 | # Set defaults across all variants |
| 172 | _vdict["build_path"] = "build-ci-all" |
| 173 | |
| 174 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 175 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 176 | |
| 177 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 178 | "%(build_type)s_%(bootloader)s" |
| 179 | |
| 180 | # Mofify the %(config)s parameter of the template |
| 181 | _vdict["config"] = "ConfigCoreIPC" |
| 182 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 183 | |
| 184 | # System supports two types of matching with |
| 185 | # test_case_id and result match group and only test_case_id |
| 186 | _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] ' |
| 187 | r'(?P<test_case_id>Secure image initializing!)\x1b\[0m' |
| 188 | ) |
| 189 | |
| 190 | # test_case_id capture group Should match test_cases entries |
| 191 | _cfg["test_cases"] = [ |
| 192 | 'Secure image initializing!', |
| 193 | ] |
| 194 | # Testing will stop if string is reached |
| 195 | _cfg["test_end_string"] = "Secure image initializing" |
| 196 | _cfg["simlimit"] = "1200" |
| 197 | |
| 198 | class template_coreipctfmlevel2_config(template_cfg): |
| 199 | """ Will automatically populate the required information for tfm |
| 200 | coreipc tfmlevel2 configuration testing. User still needs to set the |
| 201 | buildpath, platform, compiler variants """ |
| 202 | |
| 203 | _cfg = deepcopy(template_cfg._cfg) |
| 204 | |
| 205 | _vdict = deepcopy(template_cfg._vdict) |
| 206 | |
| 207 | # Set defaults across all variants |
| 208 | _vdict["build_path"] = "build-ci-all" |
| 209 | |
| 210 | _vdict["app_bin_path"] = "install/outputs/fvp" |
| 211 | _vdict["data_bin_path"] = "install/outputs/fvp" |
| 212 | |
| 213 | _vdict["variant_name_tpl"] = "%(platform)s_%(compiler)s_%(config)s_" + \ |
| 214 | "%(build_type)s_%(bootloader)s" |
| 215 | |
| 216 | # Mofify the %(config)s parameter of the template |
| 217 | _vdict["config"] = "ConfigCoreIPCTfmLevel2" |
| 218 | _cfg["terminal_log"] = _cfg["terminal_log"] % _vdict |
| 219 | |
| 220 | # System supports two types of matching with |
| 221 | # test_case_id and result match group and only test_case_id |
| 222 | _cfg["test_rex"] = (r'\x1b\[1;34m\[Sec Thread\] ' |
| 223 | r'(?P<test_case_id>Secure image initializing!)\x1b\[0m' |
| 224 | ) |
| 225 | |
| 226 | # test_case_id capture group Should match test_cases entries |
| 227 | _cfg["test_cases"] = [ |
| 228 | 'Secure image initializing!', |
| 229 | ] |
| 230 | # Testing will stop if string is reached |
| 231 | _cfg["test_end_string"] = "Secure image initializing" |
| 232 | _cfg["simlimit"] = "1200" |