Remove argparser default for directory
This reverts commit Adds a
comment to explain reasoning for current implementation.
@@ -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)
