Adapt check_test_cases.py

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2024-07-12 19:29:55 +02:00
parent 635a2beb74
commit 77d6ac24a7

View File

@ -16,6 +16,9 @@ import re
import subprocess import subprocess
import sys import sys
import scripts_path # pylint: disable=unused-import
from mbedtls_framework import build_tree
class ScriptOutputError(ValueError): class ScriptOutputError(ValueError):
"""A kind of ValueError that indicates we found """A kind of ValueError that indicates we found
the script doesn't list test cases in an expected the script doesn't list test cases in an expected
@ -130,13 +133,11 @@ option"""
@staticmethod @staticmethod
def collect_test_directories(): def collect_test_directories():
"""Get the relative path for the TLS and Crypto test directories.""" """Get the relative path for the TLS and Crypto test directories."""
if os.path.isdir('tests'): mbedtls_root = build_tree.guess_mbedtls_root()
tests_dir = 'tests' directories = [os.path.join(mbedtls_root, 'tests'),
elif os.path.isdir('suites'): os.path.join(mbedtls_root, 'tf-psa-crypto', 'tests')]
tests_dir = '.' for index, value in enumerate(directories):
elif os.path.isdir('../suites'): directories[index] = os.path.relpath(value)
tests_dir = '..'
directories = [tests_dir]
return directories return directories
def walk_all(self): def walk_all(self):
@ -149,6 +150,7 @@ option"""
for sh_file in ['ssl-opt.sh', 'compat.sh']: for sh_file in ['ssl-opt.sh', 'compat.sh']:
sh_file = os.path.join(directory, sh_file) sh_file = os.path.join(directory, sh_file)
if os.path.isfile(sh_file):
self.collect_from_script(sh_file) self.collect_from_script(sh_file)
class TestDescriptions(TestDescriptionExplorer): class TestDescriptions(TestDescriptionExplorer):