Do run not-supported test cases on not-implemented mechanisms

In automatically generated PSA test cases with automatically inferred
dependencies, we were systematically skipping test cases when a dependency
mentions a mechanism that is not supported, even when that dependency is
negated. Fix this.

This causes more not-supported test cases to run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2024-12-16 20:02:45 +01:00
parent 58cf9e90b8
commit fd0130576c
+10 -7
View File
@@ -13,11 +13,14 @@ from . import psa_information
from . import test_case
# 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 tests with negative dependencies, which will not be skipped here.
def read_implemented_dependencies(acc: Set[str], filename: str) -> None:
with open(filename) as input_stream:
for line in input_stream:
@@ -46,8 +49,8 @@ def find_dependencies_not_implemented(dependencies: List[str]) -> List[str]:
_implemented_dependencies = frozenset(acc)
return [dep
for dep in dependencies
if (dep.lstrip('!') not in _implemented_dependencies and
dep.lstrip('!').startswith('PSA_WANT'))]
if (dep not in _implemented_dependencies and
dep.startswith('PSA_WANT'))]
class TestCase(test_case.TestCase):