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 <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2026-04-08 15:47:49 +02:00
parent 16a90a556e
commit d25f03919a

View File

@@ -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