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 committed Oct 31, 2021
1 parent 67e9f05 commit 56c4f9d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nixos/lib/testing-python.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ rec {
build-vms = import ./build-vms.nix {
inherit system lib pkgs minimal specialArgs;
extraConfigurations = extraConfigurations ++ [(
{ config, ... }:
{
virtualisation.qemu.package = qemu_pkg;

Expand All @@ -230,7 +231,17 @@ rec {
# copied to the image.
virtualisation.additionalPaths =
lib.optional
(builtins.hasContext testScript')
# 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
Expand Down

0 comments on commit 56c4f9d

Please sign in to comment.