Skip to content

Commit

Permalink
nixosTest: Fix infinite recursion involving hasContext testScript whe…
Browse files Browse the repository at this point in the history
…n useNixStoreImage = true

The involved test was nixosTests.nextcloud.basic21.

It has a testScript that is strict in nodes.nextcloud.config.system.build.vm,
in assertions about imagemagick being in the system closure.

The recursion was introduced in 329a446 from
NixOS#140792
  • Loading branch information
roberth authored and jsoo1 committed Oct 19, 2022
1 parent 925765b commit 16b2c54
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions nixos/lib/testing-python.nix
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,32 @@ rec {
extraConfigurations = extraConfigurations ++ (pkgs.lib.optional (qemu_pkg != null)
{
virtualisation.qemu.package = qemu_pkg;

# Make sure all derivations referenced by the test
# script are available on the nodes. When the store is
# accessed through 9p, this isn't important, since
# everything in the store is available to the guest,
# but when building a root image it is, as all paths
# that should be available to the guest has to be
# copied to the image.
virtualisation.additionalPaths =
lib.optional
# A testScript may evaluate nodes, which has caused
# infinite recursions. The demand cycle involves:
# testScript -->
# nodes -->
# toplevel -->
# additionalPaths -->
# hasContext testScript' -->
# testScript (ad infinitum)
# If we don't need to build an image, we can break this
# cycle by short-circuiting when useNixStoreImage is false.
(config.virtualisation.useNixStoreImage && builtins.hasContext testScript')
(pkgs.writeStringReferencesToFile testScript');

# Ensure we do not use aliases. Ideally this is only set
# when the test framework is used by Nixpkgs NixOS tests.
nixpkgs.config.allowAliases = false;
}
);
};
Expand Down

0 comments on commit 16b2c54

Please sign in to comment.