Skip to content

Commit

Permalink
generate_*_tests.py: simplify test_suite_directory handling
Browse files Browse the repository at this point in the history
test_suite_directory can be changed by a command line option in the
development branch but not in 2.28. Align the simplified version here with a
change in the development version
("generate_*_tests.py --directory: fix handling of relative path").

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
  • Loading branch information
gilles-peskine-arm committed Oct 14, 2022
1 parent bd5147c commit 4881540
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions scripts/mbedtls_dev/test_data_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ def generate_tests(cls) -> Iterator[test_case.TestCase]:

class TestGenerator:
"""Generate test cases and write to data files."""
def __init__(self, options) -> None:
self.test_suite_directory = self.get_option(options, 'directory',
'tests/suites')
def __init__(self, _options) -> None:
self.test_suite_directory = 'tests/suites'
# Update `targets` with an entry for each child class of BaseTarget.
# Each entry represents a file generated by the BaseTarget framework,
# and enables generating the .data files using the CLI.
Expand All @@ -150,11 +149,6 @@ def __init__(self, options) -> None:
for subclass in BaseTarget.__subclasses__()
})

@staticmethod
def get_option(options, name: str, default: T) -> T:
value = getattr(options, name, None)
return default if value is None else value

def filename_for(self, basename: str) -> str:
"""The location of the data file with the specified base name."""
return posixpath.join(self.test_suite_directory, basename + '.data')
Expand Down

0 comments on commit 4881540

Please sign in to comment.