mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Do run not-supported test cases on not-implemented mechanisms
In automatically generated PSA test cases, we detect cryptographic mechanisms that are not implemented, and skip the corresponding test cases. Originally this detection was intended for mechanisms for which the PSA_WANT symbols were not implemented, but then it morphed into skipping mechanisms that are declared in crypto_values.h but not actually implemented. So it no longer makes sense to skip the test cases for which a negative dependency (!PSA_WANT_xxx) is not implemented. This causes more not-supported test cases to run. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@ -54,11 +54,13 @@ def automatic_dependencies(*expressions: str) -> List[str]:
|
||||
used.difference_update(SYMBOLS_WITHOUT_DEPENDENCY)
|
||||
return sorted(psa_want_symbol(name) for name in used)
|
||||
|
||||
# A temporary hack: at the time of writing, not all dependency symbols
|
||||
# are implemented yet. Skip test cases for which the dependency symbols are
|
||||
# not available. Once all dependency symbols are available, this hack must
|
||||
# be removed so that a bug in the dependency symbols properly leads to a test
|
||||
# failure.
|
||||
# Skip test cases for which the dependency symbols are not defined.
|
||||
# We assume that this means that a required mechanism is not implemented.
|
||||
# Note that if we erroneously skip generating test cases for
|
||||
# mechanisms that are not implemented, this should be caught
|
||||
# by the NOT_SUPPORTED test cases generated by generate_psa_tests.py
|
||||
# in test_suite_psa_crypto_not_supported and test_suite_psa_crypto_op_fail:
|
||||
# those emit negative tests, which will not be skipped here.
|
||||
def read_implemented_dependencies(filename: str) -> FrozenSet[str]:
|
||||
return frozenset(symbol
|
||||
for line in open(filename)
|
||||
@ -73,7 +75,6 @@ def hack_dependencies_not_implemented(dependencies: List[str]) -> None:
|
||||
_implemented_dependencies = _implemented_dependencies.union(
|
||||
read_implemented_dependencies('include/mbedtls/config_psa.h'))
|
||||
for dep in dependencies:
|
||||
dep = dep.lstrip('!')
|
||||
if dep.startswith('PSA_WANT') and dep not in _implemented_dependencies:
|
||||
dependencies.append('DEPENDENCY_NOT_IMPLEMENTED_YET_' + dep)
|
||||
dependencies.sort()
|
||||
|
Reference in New Issue
Block a user