From 13985566e7dff89bbfe8055118714773fca828f0 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 3 Oct 2024 19:11:27 +0200 Subject: [PATCH] check_test_cases.py: make 3.6 identical with development To prepare for the move of check_test_cases.py to the version-independent framework repository, make the file in mbedtls-3.6 identical to the file in development. In development, check_test_cases.py now looks for tests under tf-psa-crypto. This is useless but harmless in mbedtls-3.6. Signed-off-by: Gilles Peskine --- tests/scripts/check_test_cases.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/scripts/check_test_cases.py b/tests/scripts/check_test_cases.py index d67e6781b4..6809dd5e77 100755 --- a/tests/scripts/check_test_cases.py +++ b/tests/scripts/check_test_cases.py @@ -16,6 +16,9 @@ import re import subprocess import sys +import scripts_path # pylint: disable=unused-import +from mbedtls_framework import build_tree + class ScriptOutputError(ValueError): """A kind of ValueError that indicates we found the script doesn't list test cases in an expected @@ -130,13 +133,10 @@ option""" @staticmethod def collect_test_directories(): """Get the relative path for the TLS and Crypto test directories.""" - if os.path.isdir('tests'): - tests_dir = 'tests' - elif os.path.isdir('suites'): - tests_dir = '.' - elif os.path.isdir('../suites'): - tests_dir = '..' - directories = [tests_dir] + mbedtls_root = build_tree.guess_mbedtls_root() + directories = [os.path.join(mbedtls_root, 'tests'), + os.path.join(mbedtls_root, 'tf-psa-crypto', 'tests')] + directories = [os.path.relpath(p) for p in directories] return directories def walk_all(self): @@ -149,7 +149,8 @@ option""" for sh_file in ['ssl-opt.sh', 'compat.sh']: sh_file = os.path.join(directory, sh_file) - self.collect_from_script(sh_file) + if os.path.isfile(sh_file): + self.collect_from_script(sh_file) class TestDescriptions(TestDescriptionExplorer): """Collect the available test cases."""