diff options
author | Patrick Hilhorst <git@hilhorst.be> | 2022-01-07 16:04:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 16:04:43 +0100 |
commit | 0c3f1cf4206e12e1e8e846151c652284850387c2 (patch) | |
tree | 09b82c6bc697ef1a2f318092aa59a67643636991 /nixos | |
parent | 269dacdf88dafd2f9105f2ee2f857ff51d3509f6 (diff) | |
parent | d4dc638d77fc31aaa3000090e50a69fa6096fb86 (diff) | |
download | nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.tar nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.tar.gz nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.tar.bz2 nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.tar.lz nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.tar.xz nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.tar.zst nixpkgs-0c3f1cf4206e12e1e8e846151c652284850387c2.zip |
Merge pull request #153273 from Synthetica9/passthru-driverInteractive
Diffstat (limited to 'nixos')
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 f8729820179..4c399586eb5 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 17003cbcbfd..8348ab56deb 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 -> +[...] +>>> </programlisting> <para> You can then take any Python statement, e.g. </para> <programlisting language="python"> -> 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 </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 365e2271457..a6704046813 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -17,7 +17,7 @@ rec { inherit pkgs; # 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}"; @@ -34,7 +34,7 @@ rec { ''; passthru = driver.passthru // { - inherit driver; + inherit driver driverInteractive; }; inherit pos; # for better debugging @@ -224,7 +224,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 // { |