summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Hilhorst <git@hilhorst.be>2022-01-02 23:48:56 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2022-01-07 15:09:00 +0000
commit7ae962ca8c07ef43bde268cb259f76aeea37581c (patch)
treef84a757d1dfbc0d286a1f4dede3715576e788494
parentMerge pull request #153755 from NixOS/backport-153745-to-release-21.11 (diff)
downloadnixpkgs-origin/backport-153273-to-release-21.11.tar.gz
nixos/test-driver: also passthru driverInteractiveorigin/backport-153273-to-release-21.11
(cherry picked from commit d4dc638d77fc31aaa3000090e50a69fa6096fb86)
-rw-r--r--nixos/doc/manual/development/running-nixos-tests-interactively.section.md14
-rw-r--r--nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xml14
-rw-r--r--nixos/lib/testing-python.nix6
3 files changed, 17 insertions, 17 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 f87298201791..4c399586eb52 100644
--- a/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
+++ b/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
@@ -4,19 +4,19 @@ The test itself can be run interactively. This is particularly useful
when developing or debugging a test:
```ShellSession
-$ nix-build nixos/tests/login.nix -A driverInteractive
+$ nix-build . -A nixosTests.login.driverInteractive
$ ./result/bin/nixos-test-driver --interactive
-starting VDE switch for network 1
->
+[...]
+>>>
```
You can then take any Python statement, e.g.
```py
-> start_all()
-> test_script()
-> machine.succeed("touch /tmp/foo")
-> print(machine.succeed("pwd")) # Show stdout of command
+>>> start_all()
+>>> test_script()
+>>> machine.succeed("touch /tmp/foo")
+>>> print(machine.succeed("pwd")) # Show stdout of command
```
The function `test_script` executes the entire test script and drops you
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 17003cbcbfdc..8348ab56deb3 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
@@ -5,19 +5,19 @@
useful when developing or debugging a test:
</para>
<programlisting>
-$ nix-build nixos/tests/login.nix -A driverInteractive
+$ nix-build . -A nixosTests.login.driverInteractive
$ ./result/bin/nixos-test-driver --interactive
-starting VDE switch for network 1
-&gt;
+[...]
+&gt;&gt;&gt;
</programlisting>
<para>
You can then take any Python statement, e.g.
</para>
<programlisting language="python">
-&gt; start_all()
-&gt; test_script()
-&gt; machine.succeed(&quot;touch /tmp/foo&quot;)
-&gt; print(machine.succeed(&quot;pwd&quot;)) # Show stdout of command
+&gt;&gt;&gt; start_all()
+&gt;&gt;&gt; test_script()
+&gt;&gt;&gt; machine.succeed(&quot;touch /tmp/foo&quot;)
+&gt;&gt;&gt; print(machine.succeed(&quot;pwd&quot;)) # Show stdout of command
</programlisting>
<para>
The function <literal>test_script</literal> executes the entire test
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index 4306d102b2d6..c51d16c03a80 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -76,7 +76,7 @@ rec {
};
# Run an automated test suite in the given virtual network.
- runTests = { driver, pos }:
+ runTests = { driver, driverInteractive, pos }:
stdenv.mkDerivation {
name = "vm-test-run-${driver.testName}";
@@ -93,7 +93,7 @@ rec {
'';
passthru = driver.passthru // {
- inherit driver;
+ inherit driver driverInteractive;
};
inherit pos; # for better debugging
@@ -275,7 +275,7 @@ rec {
passMeta = drv: drv // lib.optionalAttrs (t ? meta) {
meta = (drv.meta or { }) // t.meta;
};
- in passMeta (runTests { inherit driver pos; });
+ in passMeta (runTests { inherit driver pos driverInteractive; });
in
test // {