Remove argparser default for directory

This reverts commit f156c43702. Adds a
comment to explain reasoning for current implementation.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-09-14 13:39:20 +01:00
parent 858cffde1e
commit 00d02423a5

View file

@ -137,7 +137,7 @@ class BaseTarget(metaclass=ABCMeta):
class TestGenerator: class TestGenerator:
"""Generate test cases and write to data files.""" """Generate test cases and write to data files."""
def __init__(self, options) -> None: def __init__(self, options) -> None:
self.test_suite_directory = getattr(options, 'directory') self.test_suite_directory = getattr(options, 'directory', 'tests/suites')
# Update `targets` with an entry for each child class of BaseTarget. # Update `targets` with an entry for each child class of BaseTarget.
# Each entry represents a file generated by the BaseTarget framework, # Each entry represents a file generated by the BaseTarget framework,
# and enables generating the .data files using the CLI. # and enables generating the .data files using the CLI.
@ -179,8 +179,12 @@ def main(args, generator_class: Type[TestGenerator] = TestGenerator):
help='List available targets and exit') help='List available targets and exit')
parser.add_argument('--list-for-cmake', action='store_true', parser.add_argument('--list-for-cmake', action='store_true',
help='Print \';\'-separated list of available targets and exit') help='Print \';\'-separated list of available targets and exit')
parser.add_argument('--directory', default="tests/suites", metavar='DIR', parser.add_argument('--directory', metavar='DIR',
help='Output directory (default: tests/suites)') help='Output directory (default: tests/suites)')
# The `--directory` option is interpreted relative to the directory from
# which the script is invoked, but the default is relative to the root of
# the mbedtls tree. The default should not be set above, but instead after
# `build_tree.chdir_to_root()` is called.
parser.add_argument('targets', nargs='*', metavar='TARGET', parser.add_argument('targets', nargs='*', metavar='TARGET',
help='Target file to generate (default: all; "-": none)') help='Target file to generate (default: all; "-": none)')
options = parser.parse_args(args) options = parser.parse_args(args)