diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2023-11-12 14:58:49 -0500 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2023-11-12 15:04:38 -0500 |
commit | 1a2f2cf95da1fae9e029c5cccba5130f5614278d (patch) | |
tree | a56b065bb59b0e65e34ee5de5a2b77bd631b18a4 | |
parent | d638da8b6a17041483d90ba9af6c3b5e30b4fbcc (diff) | |
download | nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.tar nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.tar.gz nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.tar.bz2 nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.tar.lz nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.tar.xz nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.tar.zst nixpkgs-1a2f2cf95da1fae9e029c5cccba5130f5614278d.zip |
nixos/test-instrumentation: Fix backdoor ordering
In #256226, `backdoor.service` was changed to be part of `sysinit.target` instead of having default dependencies. This broke several tests that relied on `backdoor.service` starting after default targets. For example, `systemd-boot.update` expects `/boot` to be mounted as soon as the backdoor is running. These tests really ought to be declaring their dependencies properly with things like `machine.wait_for_unit("local-fs.target")`, because it's useful for the backdoor to start as early as possible. But for now, let's just order it the way it was before in stage 2, and use the earlier ordering in the new stage 1 context.
-rw-r--r-- | nixos/modules/testing/test-instrumentation.nix | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index abe68dd6eae..9ee77cd79a9 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -11,10 +11,6 @@ let qemu-common = import ../../lib/qemu-common.nix { inherit lib pkgs; }; backdoorService = { - wantedBy = [ "sysinit.target" ]; - unitConfig.DefaultDependencies = false; - conflicts = [ "shutdown.target" "initrd-switch-root.target" ]; - before = [ "shutdown.target" "initrd-switch-root.target" ]; requires = [ "dev-hvc0.device" "dev-${qemu-common.qemuSerialDevice}.device" ]; after = [ "dev-hvc0.device" "dev-${qemu-common.qemuSerialDevice}.device" ]; script = @@ -80,7 +76,12 @@ in } ]; - systemd.services.backdoor = backdoorService; + systemd.services.backdoor = lib.mkMerge [ + backdoorService + { + wantedBy = [ "multi-user.target" ]; + } + ]; boot.initrd.systemd = lib.mkMerge [ { @@ -104,7 +105,21 @@ in "/bin/true" ]; - services.backdoor = backdoorService; + services.backdoor = lib.mkMerge [ + backdoorService + { + # TODO: Both stage 1 and stage 2 should use these same + # settings. But a lot of existing tests rely on + # backdoor.service having default orderings, + # e.g. systemd-boot.update relies on /boot being mounted + # as soon as backdoor starts. But it can be useful for + # backdoor to start even earlier. + wantedBy = [ "sysinit.target" ]; + unitConfig.DefaultDependencies = false; + conflicts = [ "shutdown.target" "initrd-switch-root.target" ]; + before = [ "shutdown.target" "initrd-switch-root.target" ]; + } + ]; contents."/usr/bin/env".source = "${pkgs.coreutils}/bin/env"; }) |