|
5 | 5 | # Copyright The Mbed TLS Contributors |
6 | 6 | # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
7 | 7 |
|
| 8 | +import inspect |
8 | 9 | import re |
9 | 10 | import sys |
10 | 11 | from typing import Iterable, Iterator, List, Optional, Tuple |
@@ -164,12 +165,20 @@ class ConfigTestGenerator(test_data_generation.TestGenerator): |
164 | 165 | """Generate test cases for configuration reporting.""" |
165 | 166 |
|
166 | 167 | def __init__(self, settings): |
167 | | - self.mbedtls_config = config.MbedTLSConfig() |
168 | | - self.targets['test_suite_config.mbedtls_boolean'] = \ |
169 | | - lambda: enumerate_boolean_setting_cases(self.mbedtls_config) |
170 | | - self.psa_config = config.CryptoConfig() |
171 | | - self.targets['test_suite_config.psa_boolean'] = \ |
172 | | - lambda: enumerate_boolean_setting_cases(self.psa_config) |
| 168 | + # pylint: disable=no-member |
| 169 | + config_members = dict(inspect.getmembers(config)) |
| 170 | + if 'MbedTLSConfig' in config_members: |
| 171 | + self.mbedtls_config = config.MbedTLSConfig() |
| 172 | + self.targets['test_suite_config.mbedtls_boolean'] = \ |
| 173 | + lambda: enumerate_boolean_setting_cases(self.mbedtls_config) |
| 174 | + if 'CryptoConfig' in config_members: |
| 175 | + self.psa_config = config.CryptoConfig() |
| 176 | + self.targets['test_suite_config.psa_boolean'] = \ |
| 177 | + lambda: enumerate_boolean_setting_cases(self.psa_config) |
| 178 | + elif 'TFPSACryptoConfig' in config_members: |
| 179 | + self.psa_config = config.TFPSACryptoConfig() |
| 180 | + self.targets['test_suite_config.psa_boolean'] = \ |
| 181 | + lambda: enumerate_boolean_setting_cases(self.psa_config) |
173 | 182 | super().__init__(settings) |
174 | 183 |
|
175 | 184 |
|
|
0 commit comments