mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-22 08:30:57 +00:00
nixos-test-driver: reintroduce --test-script flag
Restore the ability to pass a test script on the command line through:
```
--test-script [PATH]
```
which was possible prior to its removal in: f1bcb61731
I have found the flag to be quite practical for NixOS test iteration and propose
hereby to reintroduce it again.
While it is still possible without this flag to pass an external test
script, it now needs to be done through the indirection of a `--config`
configuration file - which now has to have configuration which points towards
the test script, which adds enough friction as to not make it ergonomic anymore.
The `--test-script` flag overwrites the configuration from the test config.
This commit is contained in:
@@ -88,6 +88,11 @@ def main() -> None:
|
||||
type=Path,
|
||||
required=True,
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--test-script",
|
||||
help="path to a test script to run, taking precedence over the one defined in the config file",
|
||||
type=Path,
|
||||
)
|
||||
arg_parser.add_argument(
|
||||
"--keep-vm-state",
|
||||
help=argparse.SUPPRESS,
|
||||
@@ -162,8 +167,12 @@ def main() -> None:
|
||||
if args.debug_hook_attach is not None:
|
||||
debugger = Debug(logger, args.debug_hook_attach)
|
||||
|
||||
config = load_driver_configuration(args.config)
|
||||
if args.test_script is not None:
|
||||
config.test_script = args.test_script
|
||||
|
||||
with Driver(
|
||||
config=load_driver_configuration(args.config),
|
||||
config=config,
|
||||
out_dir=output_directory,
|
||||
logger=logger,
|
||||
keep_machine_state=args.keep_machine_state,
|
||||
|
||||
Reference in New Issue
Block a user