tests/check_test_cases: Use ssl-opt.sh -l option instead of parsing
* Use the newly added ssl-opt.sh -l option to list all the tests cases and their used parameters instead of having to parse the file to discover them. This avoids having to add further parsing complexity in the future as discussed in https://github.com/Mbed-TLS/mbedtls/pull/8080#issuecomment-1681064743 Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
This commit is contained in:
parent
24552ff84e
commit
754f8cd959
1 changed files with 7 additions and 11 deletions
|
@ -27,6 +27,8 @@ import os
|
|||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
class Results:
|
||||
"""Store file and line information about errors or warnings in test suites."""
|
||||
|
@ -100,17 +102,11 @@ state may override this method.
|
|||
def walk_ssl_opt_sh(self, file_name):
|
||||
"""Iterate over the test cases in ssl-opt.sh or a file with a similar format."""
|
||||
descriptions = self.new_per_file_state() # pylint: disable=assignment-from-none
|
||||
with open(file_name, 'rb') as file_contents:
|
||||
for line_number, line in enumerate(file_contents, 1):
|
||||
# Assume that all run_test calls have the same simple form
|
||||
# with the test description entirely on the same line as the
|
||||
# function name.
|
||||
m = re.match(br'\s*run_test\s+"((?:[^\\"]|\\.)*)"', line)
|
||||
if not m:
|
||||
continue
|
||||
description = m.group(1)
|
||||
self.process_test_case(descriptions,
|
||||
file_name, line_number, description)
|
||||
listed = subprocess.run(['tests/ssl-opt.sh', '-l'],
|
||||
capture_output=True)
|
||||
listed = set(map(lambda x: x.rstrip(), listed.stdout.splitlines()))
|
||||
for description in listed:
|
||||
self.process_test_case(descriptions, file_name, None, description)
|
||||
|
||||
def walk_compat_sh(self, file_name):
|
||||
"""Iterate over the test cases compat.sh with a similar format."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue