summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Hilhorst <git@hilhorst.be>2022-01-26 20:24:57 +0100
committerGitHub <noreply@github.com>2022-01-26 20:24:57 +0100
commit2774f31f40ddef84cc658dd4c15912a08a68becd (patch)
tree382a994ac5379725992fc271ed2d5ac62b4344e0
parent0b2d7180bdf3648adef83bc64c70064cd492de6c (diff)
parent411bb3c35f729ea88f84c35150e7b67727d8d075 (diff)
Merge pull request #156697 from marijanp/fix-146169
-rw-r--r--nixos/doc/manual/development/running-nixos-tests-interactively.section.md4
-rw-r--r--nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xml4
-rwxr-xr-xnixos/lib/test-driver/test_driver/__init__.py2
-rw-r--r--nixos/lib/testing-python.nix5
4 files changed, 9 insertions, 6 deletions
diff --git a/nixos/doc/manual/development/running-nixos-tests-interactively.section.md b/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
index 4c399586eb52..a1431859ff59 100644
--- a/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
+++ b/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
@@ -5,7 +5,7 @@ when developing or debugging a test:
```ShellSession
$ nix-build . -A nixosTests.login.driverInteractive
-$ ./result/bin/nixos-test-driver --interactive
+$ ./result/bin/nixos-test-driver
[...]
>>>
```
@@ -28,7 +28,7 @@ You can re-use the VM states coming from a previous run by setting the
`--keep-vm-state` flag.
```ShellSession
-$ ./result/bin/nixos-test-driver --interactive --keep-vm-state
+$ ./result/bin/nixos-test-driver --keep-vm-state
```
The machine state is stored in the `$TMPDIR/vm-state-machinename`
diff --git a/nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xml b/nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xml
index 8348ab56deb3..0e47350a0d24 100644
--- a/nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xml
+++ b/nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xml
@@ -6,7 +6,7 @@
</para>
<programlisting>
$ nix-build . -A nixosTests.login.driverInteractive
-$ ./result/bin/nixos-test-driver --interactive
+$ ./result/bin/nixos-test-driver
[...]
&gt;&gt;&gt;
</programlisting>
@@ -30,7 +30,7 @@ $ ./result/bin/nixos-test-driver --interactive
the <literal>--keep-vm-state</literal> flag.
</para>
<programlisting>
-$ ./result/bin/nixos-test-driver --interactive --keep-vm-state
+$ ./result/bin/nixos-test-driver --keep-vm-state
</programlisting>
<para>
The machine state is stored in the
diff --git a/nixos/lib/test-driver/test_driver/__init__.py b/nixos/lib/test-driver/test_driver/__init__.py
index 498a4f56c55b..61d91c9ed654 100755
--- a/nixos/lib/test-driver/test_driver/__init__.py
+++ b/nixos/lib/test-driver/test_driver/__init__.py
@@ -61,7 +61,7 @@ def main() -> None:
"-I",
"--interactive",
help="drop into a python repl and run the tests interactively",
- action="store_true",
+ action=argparse.BooleanOptionalAction,
)
arg_parser.add_argument(
"--start-scripts",
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index a67040468136..3d89e5484d16 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -51,6 +51,7 @@ rec {
, enableOCR ? false
, skipLint ? false
, passthru ? {}
+ , interactive ? false
}:
let
# Reifies and correctly wraps the python test driver for
@@ -139,7 +140,8 @@ rec {
wrapProgram $out/bin/nixos-test-driver \
--set startScripts "''${vmStartScripts[*]}" \
--set testScript "$out/test-script" \
- --set vlans '${toString vlans}'
+ --set vlans '${toString vlans}' \
+ ${lib.optionalString (interactive) "--add-flags --interactive"}
'');
# Make a full-blown test
@@ -217,6 +219,7 @@ rec {
testName = name;
qemu_pkg = pkgs.qemu;
nodes = nodes pkgs.qemu;
+ interactive = true;
};
test =