From d25f03919a3de57dc7e3492804ad25dcbf597eb2 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 8 Apr 2026 15:47:49 +0200 Subject: [PATCH] INTERNAL_TEST_CASES moved to a separate data-only module This way, when Mbed TLS's `analyze_outcomes.py` loads the python module from TF-PSA-Crypto (because it needs to know the value of `INTERNAL_TEST_CASES`), there's no risk that the subproject and the superproject will have different requirements on auxiliary modules such as `mbedtls_framework.outcome_analysis`. Signed-off-by: Gilles Peskine --- tests/scripts/analyze_outcomes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/scripts/analyze_outcomes.py b/tests/scripts/analyze_outcomes.py index 226ca54c14..7ce88f9921 100755 --- a/tests/scripts/analyze_outcomes.py +++ b/tests/scripts/analyze_outcomes.py @@ -22,7 +22,7 @@ from mbedtls_framework import typing_util class CryptoAnalyzeOutcomesType(typing_util.Protocol): - """Our expectations on tf-psa-crypto/tests/scripts/analyze_outcomes.py. + """Our expectations on tf-psa-crypto/tests/scripts/tf_psa_crypto_test_case_info.py. See CoverageTask_load_crypto_module(). """ @@ -225,17 +225,19 @@ class CoverageTask(outcome_analysis.CoverageTask): } def _load_crypto_module(self) -> None: - """Try to load the tf-psa-crypto submodule's outcome analysis Python module.""" + """Try to load the information about test cases from the tf-psa-crypto submodule..""" + # All this complexity is because we don't want to add the directory + # to the import path. if self.crypto_module is not None: return - crypto_script_path = 'tf-psa-crypto/tests/scripts/analyze_outcomes.py' + crypto_script_path = 'tf-psa-crypto/tests/scripts/tf_psa_crypto_test_case_info.py' if not os.path.exists(crypto_script_path): # During a transition period, while the crypto script is not # yet present in all branches we care about, allow it not to # exist. return crypto_spec = importlib.util.spec_from_file_location( - 'tf_psa_crypto.analyze_outcomes', + 'tf_psa_crypto_test_case_info', crypto_script_path) # Assertions to help mypy. assert crypto_spec is not None