New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qemu_test: disable features that are not needed for tests (closure 641 -> 335.3M) #49403
Conversation
Success on x86_64-darwin (full log) Attempted: qemu_test Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: qemu_test Partial log (click to expand)
|
This removes the possibility to log in to testing machines interactively It also breaks |
Success on aarch64-linux (full log) Attempted: qemu_test Partial log (click to expand)
|
@xeji true, I haven't thought about them. Do we have some intermediate path that we can go without pulling in all those dependencies for all the tests? When iterating on things like libc, systemd, … it is a bit annoying to rebuild gtk, pulseaudio, and a few other packages. |
I'm not sure there is. Maybe it's better to have two variants |
The difference is that there will not be a g GTK window popping up. You can still connect to localhost via a vnclient to get the same output. |
After a bit of discussion with @xeji on IRC we think this might be fine for working on nixpkgs but we should implement something better for |
Just a quick hack on a potential solution for the mentioned diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix
index 42a0c60c7e1..758b45699e5 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -1,4 +1,4 @@
-{ system, minimal ? false, config ? {} }:
+{ system, minimal ? false, config ? {}, useQemuTest ? true }:
with import ./build-vms.nix { inherit system minimal config; };
with pkgs;
@@ -22,6 +22,9 @@ in rec {
preferLocalBuild = true;
installPhase =
+ let
+ qemu = if useQemuTest then pkgs.qemu_test else pkgs.qemu;
+ in
''
mkdir -p $out/bin
cp ${./test-driver/test-driver.pl} $out/bin/nixos-test-driver
@@ -33,7 +36,7 @@ in rec {
cp ${./test-driver/Logger.pm} $libDir/Logger.pm
wrapProgram $out/bin/nixos-test-driver \
- --prefix PATH : "${lib.makeBinPath [ qemu_test vde2 netpbm coreutils ]}" \
+ --prefix PATH : "${lib.makeBinPath [ qemu vde2 netpbm coreutils ]}" \
--prefix PERL5LIB : "${with perlPackages; lib.makePerlPath [ TermReadLineGnu XMLWriter IOTty FileSlurp ]}:$out/lib/perl5/site_perl"
'';
};
diff --git a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
index 4372d196261..c8547844d3d 100644
--- a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
+++ b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
@@ -6,4 +6,4 @@ let nodes = import networkExpr; in
with import ../../../../lib/testing.nix { inherit system; };
-(makeTest { inherit nodes; testScript = ""; }).driver
+(makeTest { inherit nodes; testScript = ""; useQemuTest = false; }).driver |
Thank you for your contributions.
|
I'd really like to see this. Not having to rebuild all of GTK and its dependencies, to run a VM test after a low-level change (like systemd or glibc) is a huge timesaver. |
Oh, awesome. I see this PR for the first time right now. Why wasn't it merged earlier? Was the difficulty of testing if the change breaks any existing tests a/the problem? |
No, the problem was that people want to see the GTK window when interactively debugging (via |
d213364
to
e61cde7
Compare
I've updated this PR to my latest work in this area. The current |
This allows much faster VM-test based systemd testing as the closure of qemu suddenly shrinks to reasonable sizes again.
Since we previously stripped down the features of `qemu_test` some of the features users are used to while running tests through the (impure) driver didn't work anymore. Most notably we lost support for graphical output and audio. With this change the `driver` attribute uses are more feature complete version of QEmu compared to the one used in the pure Nix builds. This gives us the best of both worlds. Users are able to see the graphical windows of VMs while CI and regular nix builds do not have to download all the (unnecessary) dependencies.
In our case systemd is only used to figure out if the unit files should be generated.
This allows us to get rid of the hack and the systemd dependency and thus reduces the rebuild closure whenever systemd changes.
While (currently) it is the same package it carries more information if we explicitly state that we want udev.
I updated the initial description: Motivation for this changeThis is an attempt to change the NixOS test runner in a way that allows faster iteration on lower-level parts of the system by reducing the number of packages that contribute to the test closure size. While One of the changes this introduces (based on the discussion when this PR was first opened) is that test drivers will now come without any graphical support by default. There is a new attribute to the tests ( Also, while running VM tests, we will use the QEMU Guest Agent from the corresponding QEMU package as otherwise we'd not have gained much. I removed Things done
|
@andir I also did successfully run IMHO, this should be good enough (tm) to merge. Do you want to squash 54e6cfc and 0a55c5d together? |
I would like to keep those two commits on iputils as is. It gives a bit more history on how this came to be. It might also be useful to revert the commit that applies the commit if upstream doesn't accept it (then we already have an alternative implementation). I did rebuild all the release tests and only had a +/-1 deviation from the regular amount of test failures. |
It seems this change has been applied to |
On 01:54 21.10.20, Michele Guerini Rocco wrote:
It seems this change has been applied to `nixos-rebuild build-vm` too.
I hope it's not intended because I found invaluable to simply start
the SDL screen without using a remote viewer.
Oh that is by accident. I'll have a look on how that can be fixed.
|
This is an attempt to fixup PR NixOS#49403.
@ofborg test installer.simple |
This is an attempt to fixup PR NixOS#49403.
Motivation for this change
This is an attempt to change the NixOS test runner in a way that allows faster iteration on lower-level parts of the system by reducing the number of packages that contribute to the test closure size.
While
qemu_test
has always been a bit slimmer then one of its siblings it wasn't really "slim" in comparison. With this PR we reduce the closure size ofqemu_test
to about 335MB from previously > 640MB.One of the changes this introduces (based on the discussion when this PR was first opened) is that test drivers will now come without any graphical support by default. There is a new attribute to the tests (
driverInteractive
) that comes with the full feature set of QEMU including the graphical output and sound.Also, while running VM tests, we will use the QEMU Guest Agent from the corresponding QEMU package as otherwise we'd not have gained much.
I removed
systemd
fromiputils
as that was only used to toggle the systemd unit generation (that we aren't using on systemd anyway). There are no references to systemd in the runtime closure. The required patch has been submitted upstream and is awaiting feedback.Things done