From a43fe58f8bafcaca019a33d578a5ebeab2e6da0f Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 21 Nov 2024 20:07:53 +0100 Subject: [PATCH] psa_test_cases: automatically skip test cases Automatically skip test cases with not-implemented automatic dependencies. No changes to the generated output. Signed-off-by: Gilles Peskine --- scripts/mbedtls_framework/psa_test_case.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/mbedtls_framework/psa_test_case.py b/scripts/mbedtls_framework/psa_test_case.py index aa9a49d85..eea969f7a 100644 --- a/scripts/mbedtls_framework/psa_test_case.py +++ b/scripts/mbedtls_framework/psa_test_case.py @@ -113,12 +113,18 @@ class TestCase(test_case.TestCase): def set_arguments(self, arguments: List[str]) -> None: """Set test case arguments and automatically infer dependencies.""" super().set_arguments(arguments) - self.automatic_dependencies.update(self.infer_dependencies(arguments)) + dependencies = self.infer_dependencies(arguments) + self.skip_if_any_not_implemented(dependencies) + self.automatic_dependencies.update(dependencies) def set_dependencies(self, dependencies: List[str]) -> None: - """Override any previously added automatic or manual dependencies.""" + """Override any previously added automatic or manual dependencies. + + Also override any previous instruction to skip the test case. + """ self.manual_dependencies = dependencies self.automatic_dependencies.clear() + self.skip_reasons = [] def add_dependencies(self, dependencies: List[str]) -> None: """Add manual dependencies.""" @@ -135,6 +141,5 @@ class TestCase(test_case.TestCase): def skip_if_any_not_implemented(self, dependencies: List[str]) -> None: """Skip the test case if any of the given dependencies is not implemented.""" not_implemented = find_dependencies_not_implemented(dependencies) - if not_implemented: - self.skip_because('not implemented: ' + - ' '.join(not_implemented)) + for dep in not_implemented: + self.skip_because('not implemented: ' + dep)