diff options
60 files changed, 165 insertions, 103 deletions
diff --git a/README.md b/README.md index c8aef8515749..a09b7d92e3e5 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ system, [Hydra](https://hydra.nixos.org/). Artifacts successfully built with Hydra are published to cache at https://cache.nixos.org/. When successful build and test criteria are met, the Nixpkgs expressions are distributed via [Nix -channels](https://nixos.org/nix/manual/#sec-channels). +channels](https://nixos.org/manual/nix/stable/package-management/channels.html). # Contributing diff --git a/doc/using/overlays.chapter.md b/doc/using/overlays.chapter.md index d2e3b49a6aa9..df152bc14e7b 100644 --- a/doc/using/overlays.chapter.md +++ b/doc/using/overlays.chapter.md @@ -112,7 +112,7 @@ self: super: This overlay uses Intel's MKL library for both BLAS and LAPACK interfaces. Note that the same can be accomplished at runtime using `LD_LIBRARY_PATH` of `libblas.so.3` and `liblapack.so.3`. For instance: ```ShellSession -$ LD_LIBRARY_PATH=$(nix-build -A mkl)/lib:$LD_LIBRARY_PATH nix-shell -p octave --run octave +$ LD_LIBRARY_PATH=$(nix-build -A mkl)/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH nix-shell -p octave --run octave ``` Intel MKL requires an `openmp` implementation when running with multiple processors. By default, `mkl` will use Intel's `iomp` implementation if no other is specified, but this is a runtime-only dependency and binary compatible with the LLVM implementation. To use that one instead, Intel recommends users set it with `LD_PRELOAD`. Note that `mkl` is only available on `x86_64-linux` and `x86_64-darwin`. Moreover, Hydra is not building and distributing pre-compiled binaries using it. diff --git a/nixos/doc/manual/development/writing-nixos-tests.section.md b/nixos/doc/manual/development/writing-nixos-tests.section.md index bf80099f1a27..a8c54aa66762 100644 --- a/nixos/doc/manual/development/writing-nixos-tests.section.md +++ b/nixos/doc/manual/development/writing-nixos-tests.section.md @@ -159,6 +159,10 @@ The following methods are available on machine objects: `execute` : Execute a shell command, returning a list `(status, stdout)`. + If the command detaches, it must close stdout, as `execute` will wait + for this to consume all output reliably. This can be achieved by + redirecting stdout to stderr `>&2`, to `/dev/console`, `/dev/null` or + a file. Takes an optional parameter `check_return` that defaults to `True`. Setting this parameter to `False` will not check for the return code and return -1 instead. This can be used for commands that shut down @@ -179,6 +183,8 @@ The following methods are available on machine objects: - Dereferencing unset variables fail the command. + - It will wait for stdout to be closed. See `execute`. + `fail` : Like `succeed`, but raising an exception if the command returns a zero diff --git a/nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml b/nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml index a3b63422433e..e0fd90f2bac2 100644 --- a/nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml +++ b/nixos/doc/manual/from_md/development/writing-nixos-tests.section.xml @@ -266,7 +266,12 @@ start_all() <listitem> <para> Execute a shell command, returning a list - <literal>(status, stdout)</literal>. Takes an optional + <literal>(status, stdout)</literal>. If the command detaches, + it must close stdout, as <literal>execute</literal> will wait + for this to consume all output reliably. This can be achieved + by redirecting stdout to stderr <literal>>&2</literal>, + to <literal>/dev/console</literal>, + <literal>/dev/null</literal> or a file. Takes an optional parameter <literal>check_return</literal> that defaults to <literal>True</literal>. Setting this parameter to <literal>False</literal> will not check for the return code @@ -306,6 +311,12 @@ start_all() Dereferencing unset variables fail the command. </para> </listitem> + <listitem> + <para> + It will wait for stdout to be closed. See + <literal>execute</literal>. + </para> + </listitem> </itemizedlist> </listitem> </varlistentry> diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index 743384f2ffc3..741d238f6bf8 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -425,6 +425,23 @@ <itemizedlist> <listitem> <para> + The NixOS VM test framework, + <literal>pkgs.nixosTest</literal>/<literal>make-test-python.nix</literal>, + now requires non-terminating commands such as + <literal>succeed("foo &")</literal> to close + stdout. This can be done with a redirect such as + <literal>succeed("foo >&2 &")</literal>. + This breaking change was necessitated by a race condition + causing tests to fail or hang. It applies to all methods that + invoke commands on the nodes, including + <literal>execute</literal>, <literal>succeed</literal>, + <literal>fail</literal>, + <literal>wait_until_succeeds</literal>, + <literal>wait_until_fails</literal>. + </para> + </listitem> + <listitem> + <para> The <literal>services.wakeonlan</literal> option was removed, and replaced with <literal>networking.interfaces.<name>.wakeOnLan</literal>. diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index 18e61c230c96..5bb72e16ed23 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -128,6 +128,10 @@ In addition to numerous new and upgraded packages, this release has the followin ## Backward Incompatibilities {#sec-release-21.11-incompatibilities} +- The NixOS VM test framework, `pkgs.nixosTest`/`make-test-python.nix`, now requires non-terminating commands such as `succeed("foo &")` to close stdout. + This can be done with a redirect such as `succeed("foo >&2 &")`. This breaking change was necessitated by a race condition causing tests to fail or hang. + It applies to all methods that invoke commands on the nodes, including `execute`, `succeed`, `fail`, `wait_until_succeeds`, `wait_until_fails`. + - The `services.wakeonlan` option was removed, and replaced with `networking.interfaces.<name>.wakeOnLan`. - The `security.wrappers` option now requires to always specify an owner, group and whether the setuid/setgid bit should be set. diff --git a/nixos/tests/containers-imperative.nix b/nixos/tests/containers-imperative.nix index 361160b1fdc2..34103ef7586b 100644 --- a/nixos/tests/containers-imperative.nix +++ b/nixos/tests/containers-imperative.nix @@ -119,7 +119,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: { with subtest("Stop a container early"): machine.succeed(f"nixos-container stop {id1}") - machine.succeed(f"nixos-container start {id1} &") + machine.succeed(f"nixos-container start {id1} >&2 &") machine.wait_for_console_text("Stage 2") machine.succeed(f"nixos-container stop {id1}") machine.wait_for_console_text(f"Container {id1} exited successfully") diff --git a/nixos/tests/croc.nix b/nixos/tests/croc.nix index 75a8fc991d47..5d709eb3d1cb 100644 --- a/nixos/tests/croc.nix +++ b/nixos/tests/croc.nix @@ -38,7 +38,7 @@ in { sender.execute("echo Hello World > testfile01.txt") sender.execute("echo Hello Earth > testfile02.txt") sender.execute( - "croc --pass ${pass} --relay relay send --code topSecret testfile01.txt testfile02.txt &" + "croc --pass ${pass} --relay relay send --code topSecret testfile01.txt testfile02.txt >&2 &" ) # receive the testfiles and check them diff --git a/nixos/tests/emacs-daemon.nix b/nixos/tests/emacs-daemon.nix index 58bcd095990a..e12da56021da 100644 --- a/nixos/tests/emacs-daemon.nix +++ b/nixos/tests/emacs-daemon.nix @@ -33,7 +33,7 @@ import ./make-test-python.nix ({ pkgs, ...} : { ) # connects to the daemon - machine.succeed("emacsclient --create-frame $EDITOR &") + machine.succeed("emacsclient --create-frame $EDITOR >&2 &") # checks that Emacs shows the edited filename machine.wait_for_text("emacseditor") diff --git a/nixos/tests/enlightenment.nix b/nixos/tests/enlightenment.nix index 4623574ce92e..c5f0e208906b 100644 --- a/nixos/tests/enlightenment.nix +++ b/nixos/tests/enlightenment.nix @@ -88,7 +88,7 @@ import ./make-test-python.nix ({ pkgs, ...} : machine.screenshot("wizard12") with subtest("Run Terminology"): - machine.succeed("terminology &") + machine.succeed("terminology >&2 &") machine.sleep(5) machine.send_chars("ls --color -alF\n") machine.sleep(2) diff --git a/nixos/tests/etesync-dav.nix b/nixos/tests/etesync-dav.nix index da5c056f5349..6a747e23f76f 100644 --- a/nixos/tests/etesync-dav.nix +++ b/nixos/tests/etesync-dav.nix @@ -13,7 +13,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { '' machine.wait_for_unit("multi-user.target") machine.succeed("etesync-dav --version") - machine.execute("etesync-dav &") + machine.execute("etesync-dav >&2 &") machine.wait_for_open_port(37358) with subtest("Check that the web interface is accessible"): assert "Add User" in machine.succeed("curl -s http://localhost:37358/.web/add/") diff --git a/nixos/tests/firefox.nix b/nixos/tests/firefox.nix index dcaf369b62bd..7216ad43b8e9 100644 --- a/nixos/tests/firefox.nix +++ b/nixos/tests/firefox.nix @@ -91,7 +91,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: { with subtest("Wait until Firefox has finished loading the Valgrind docs page"): machine.execute( - "xterm -e 'firefox file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' &" + "xterm -e 'firefox file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &" ) machine.wait_for_window("Valgrind") machine.sleep(40) @@ -99,7 +99,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: { with subtest("Check whether Firefox can play sound"): with audio_recording(machine): machine.succeed( - "firefox file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga &" + "firefox file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &" ) wait_for_sound(machine) machine.copy_from_vm("/tmp/record.wav") diff --git a/nixos/tests/ft2-clone.nix b/nixos/tests/ft2-clone.nix index c877054234ec..71eda43e2b24 100644 --- a/nixos/tests/ft2-clone.nix +++ b/nixos/tests/ft2-clone.nix @@ -22,7 +22,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { # Add a dummy sound card, or the program won't start machine.execute("modprobe snd-dummy") - machine.execute("ft2-clone &") + machine.execute("ft2-clone >&2 &") machine.wait_for_window(r"Fasttracker") machine.sleep(5) diff --git a/nixos/tests/hibernate.nix b/nixos/tests/hibernate.nix index 508e7aa64c0d..4f05b99a5a11 100644 --- a/nixos/tests/hibernate.nix +++ b/nixos/tests/hibernate.nix @@ -110,7 +110,7 @@ in makeTest { ) # Hibernate machine - hibernate.execute("systemctl hibernate &", check_return=False) + hibernate.execute("systemctl hibernate >&2 &", check_return=False) hibernate.wait_for_shutdown() # Restore machine from hibernation, validate our ramfs file is there. diff --git a/nixos/tests/keepassxc.nix b/nixos/tests/keepassxc.nix index 98902187f6ac..685a200b3187 100644 --- a/nixos/tests/keepassxc.nix +++ b/nixos/tests/keepassxc.nix @@ -26,7 +26,7 @@ import ./make-test-python.nix ({ pkgs, ...} : machine.wait_for_x() # start KeePassXC window - machine.execute("su - alice -c keepassxc &") + machine.execute("su - alice -c keepassxc >&2 &") machine.wait_for_text("KeePassXC ${pkgs.keepassxc.version}") machine.screenshot("KeePassXC") diff --git a/nixos/tests/kexec.nix b/nixos/tests/kexec.nix index 9768d6d2108e..010f3da49846 100644 --- a/nixos/tests/kexec.nix +++ b/nixos/tests/kexec.nix @@ -13,7 +13,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { '' machine.wait_for_unit("multi-user.target") machine.succeed('kexec --load /run/current-system/kernel --initrd /run/current-system/initrd --command-line "$(</proc/cmdline)"') - machine.execute("systemctl kexec &", check_return=False) + machine.execute("systemctl kexec >&2 &", check_return=False) machine.connected = False machine.connect() machine.wait_for_unit("multi-user.target") diff --git a/nixos/tests/keymap.nix b/nixos/tests/keymap.nix index a18a05f90c6d..4306a9ae2cf9 100644 --- a/nixos/tests/keymap.nix +++ b/nixos/tests/keymap.nix @@ -46,7 +46,7 @@ let # set up process that expects all the keys to be entered machine.succeed( - "{} {} {} {} &".format( + "{} {} {} {} >&2 &".format( cmd, "${testReader}", len(inputs), diff --git a/nixos/tests/libreswan.nix b/nixos/tests/libreswan.nix index 17ae60af8eed..56ab908aed9a 100644 --- a/nixos/tests/libreswan.nix +++ b/nixos/tests/libreswan.nix @@ -89,7 +89,7 @@ in """ Sends a message as Alice to Bob """ - bob.execute("nc -lu ::0 1234 >/tmp/msg &") + bob.execute("nc -lu ::0 1234 >/tmp/msg >&2 &") alice.sleep(1) alice.succeed(f"echo '{msg}' | nc -uw 0 bob 1234") bob.succeed(f"grep '{msg}' /tmp/msg") @@ -100,7 +100,7 @@ in Starts eavesdropping on Alice and Bob """ match = "src host alice and dst host bob" - eve.execute(f"tcpdump -i br0 -c 1 -Avv {match} >/tmp/log &") + eve.execute(f"tcpdump -i br0 -c 1 -Avv {match} >/tmp/log >&2 &") start_all() @@ -120,7 +120,7 @@ in alice.succeed("ipsec verify 1>&2") with subtest("Alice and Bob can start the tunnel"): - alice.execute("ipsec auto --start tunnel &") + alice.execute("ipsec auto --start tunnel >&2 &") bob.succeed("ipsec auto --start tunnel") # apparently this is needed to "wake" the tunnel bob.execute("ping -c1 alice") diff --git a/nixos/tests/lorri/default.nix b/nixos/tests/lorri/default.nix index c33c7503993d..147ae999fdb1 100644 --- a/nixos/tests/lorri/default.nix +++ b/nixos/tests/lorri/default.nix @@ -14,7 +14,7 @@ import ../make-test-python.nix { ) # Start the daemon and wait until it is ready - machine.execute("lorri daemon > lorri.stdout 2> lorri.stderr &") + machine.execute("lorri daemon > lorri.stdout 2> lorri.stderr >&2 &") machine.wait_until_succeeds("grep --fixed-strings 'ready' lorri.stdout") # Ping the daemon diff --git a/nixos/tests/magic-wormhole-mailbox-server.nix b/nixos/tests/magic-wormhole-mailbox-server.nix index afdf7124fdc5..54088ac60f28 100644 --- a/nixos/tests/magic-wormhole-mailbox-server.nix +++ b/nixos/tests/magic-wormhole-mailbox-server.nix @@ -29,7 +29,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { # Create a secret file and send it to Bob client_alice.succeed("echo mysecret > secretfile") - client_alice.succeed("wormhole --relay-url=ws://server:4000/v1 send -0 secretfile &") + client_alice.succeed("wormhole --relay-url=ws://server:4000/v1 send -0 secretfile >&2 &") # Retrieve a secret file from Alice and check its content client_bob.succeed("wormhole --relay-url=ws://server:4000/v1 receive -0 --accept-file") diff --git a/nixos/tests/minecraft.nix b/nixos/tests/minecraft.nix index 3225ebac392a..1c34f04b4df2 100644 --- a/nixos/tests/minecraft.nix +++ b/nixos/tests/minecraft.nix @@ -20,7 +20,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: { let user = nodes.client.config.users.users.alice; in '' client.wait_for_x() - client.execute("su - alice -c minecraft-launcher &") + client.execute("su - alice -c minecraft-launcher >&2 &") client.wait_for_text("Create a new Microsoft account") client.sleep(10) client.screenshot("launcher") diff --git a/nixos/tests/mpv.nix b/nixos/tests/mpv.nix index 9e44862cb1b4..a4803f3cb5b5 100644 --- a/nixos/tests/mpv.nix +++ b/nixos/tests/mpv.nix @@ -21,7 +21,7 @@ in }; testScript = '' - machine.execute("set -m; mpv --script-opts=webui-port=${port} --idle=yes &") + machine.execute("set -m; mpv --script-opts=webui-port=${port} --idle=yes >&2 &") machine.wait_for_open_port(${port}) assert "<title>simple-mpv-webui" in machine.succeed("curl -s localhost:${port}") |