diff --git a/lib/test-driver/test-driver.pl b/lib/test-driver/test-driver.pl index 0fdcf97af67..43f74cf404b 100644 --- a/lib/test-driver/test-driver.pl +++ b/lib/test-driver/test-driver.pl @@ -68,6 +68,14 @@ sub startAll { } +# Wait until all VMs have terminated. +sub joinAll { + $log->nest("waiting for all VMs to finish", sub { + $_->waitForShutdown foreach values %vms; + }); +} + + # In interactive tests, this allows the non-interactive test script to # be executed conveniently. sub testScript { diff --git a/lib/testing.nix b/lib/testing.nix index 704ee4025a5..6a39df8c865 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -157,7 +157,7 @@ rec { ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms wrapProgram $out/bin/nixos-run-vms \ --add-flags "$vms" \ - --set tests '"startAll; sleep 1e9;"' \ + --set tests '"startAll; joinAll;"' \ --set VLANS '"${toString vlans}"' ''; # " diff --git a/modules/installer/cd-dvd/installation-cd-base.nix b/modules/installer/cd-dvd/installation-cd-base.nix index ae227dbcb80..375941d2447 100644 --- a/modules/installer/cd-dvd/installation-cd-base.nix +++ b/modules/installer/cd-dvd/installation-cd-base.nix @@ -66,5 +66,5 @@ in # To speed up installation a little bit, include the complete stdenv # in the Nix store on the CD. - isoImage.storeContents = [ pkgs.stdenv pkgs.klibc pkgs.klibcShrunk ]; + isoImage.storeContents = [ pkgs.stdenv pkgs.busybox ]; } diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index cf76151c2ae..7b050f8dd6a 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -205,9 +205,7 @@ in else [ config.boot.kernelPackages.aufs ]; - boot.initrd.availableKernelModules = [ "aufs" "squashfs" "iso9660" ]; - - boot.initrd.kernelModules = [ "loop" ]; + boot.initrd.kernelModules = [ "aufs" "squashfs" "iso9660" "loop" ]; boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars"; diff --git a/modules/installer/cd-dvd/system-tarball-pc.nix b/modules/installer/cd-dvd/system-tarball-pc.nix index 035b6dd6c0a..ddad520c446 100644 --- a/modules/installer/cd-dvd/system-tarball-pc.nix +++ b/modules/installer/cd-dvd/system-tarball-pc.nix @@ -123,7 +123,7 @@ in # To speed up further installation of packages, include the complete stdenv # in the Nix store of the tarball. - tarball.storeContents = pkgs2storeContents [ pkgs.stdenv pkgs.klibc pkgs.klibcShrunk ]; + tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ]; tarball.contents = [ { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index b71de50ad39..4e07714eabc 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -325,8 +325,7 @@ echo /sbin/modprobe > /proc/sys/kernel/modprobe # Start stage 2. `switch_root' deletes all files in the ramfs on the -# current root. It also moves the /proc, /sys and /dev mounts over to -# the new root. Note that $stage2Init might be an absolute symlink, +# current root. Note that $stage2Init might be an absolute symlink, # in which case "-e" won't work because we're not in the chroot yet. if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then echo "stage 2 init script ($targetRoot/$stage2Init) not found" @@ -335,7 +334,9 @@ fi mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run -# `switch_root' doesn't move /run yet, so we have to do it ourselves. +mount --bind /proc $targetRoot/proc +mount --bind /sys $targetRoot/sys +mount --bind /dev $targetRoot/dev mount --bind /run $targetRoot/run exec switch_root "$targetRoot" "$stage2Init" diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix index 468a3030ca6..ce9c1cea743 100644 --- a/modules/testing/test-instrumentation.nix +++ b/modules/testing/test-instrumentation.nix @@ -5,20 +5,6 @@ with pkgs.lib; -let - - # Urgh, `socat' sets the SIGCHLD to ignore. This wreaks havoc with - # some programs. - rootShell = pkgs.writeScript "shell.pl" - '' - #! ${pkgs.perl}/bin/perl - $SIG{CHLD} = 'DEFAULT'; - print "\n"; - exec "/bin/sh"; - ''; - -in - { config = { @@ -38,7 +24,8 @@ in exec < /dev/hvc0 > /dev/hvc0 2> /dev/ttyS0 echo "connecting to host..." >&2 stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion - ${pkgs.socat}/bin/socat stdio exec:${rootShell} + echo + PS1= /bin/sh ''; };