From 00d02423a58eba33ddaa8d56c1c3ce06e607ba53 Mon Sep 17 00:00:00 2001 From: Werner Lewis Date: Wed, 14 Sep 2022 13:39:20 +0100 Subject: [PATCH] Remove argparser default for directory This reverts commit f156c43702bec949c80a56a993a0d5009e39ab17. Adds a comment to explain reasoning for current implementation. Signed-off-by: Werner Lewis --- scripts/mbedtls_dev/test_generation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/mbedtls_dev/test_generation.py b/scripts/mbedtls_dev/test_generation.py index 81af7ba27..87cb43ecd 100644 --- a/scripts/mbedtls_dev/test_generation.py +++ b/scripts/mbedtls_dev/test_generation.py @@ -137,7 +137,7 @@ class BaseTarget(metaclass=ABCMeta): class TestGenerator: """Generate test cases and write to data files.""" 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. # Each entry represents a file generated by the BaseTarget framework, # 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') parser.add_argument('--list-for-cmake', action='store_true', 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)') + # 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', help='Target file to generate (default: all; "-": none)') options = parser.parse_args(args)