aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/testing/test-instrumentation.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/testing/test-instrumentation.nix')
-rw-r--r--nixpkgs/nixos/modules/testing/test-instrumentation.nix27
1 files changed, 7 insertions, 20 deletions
diff --git a/nixpkgs/nixos/modules/testing/test-instrumentation.nix b/nixpkgs/nixos/modules/testing/test-instrumentation.nix
index 1baeab53b0c..c0ec76e8a3a 100644
--- a/nixpkgs/nixos/modules/testing/test-instrumentation.nix
+++ b/nixpkgs/nixos/modules/testing/test-instrumentation.nix
@@ -1,22 +1,13 @@
# This module allows the test driver to connect to the virtual machine
# via a root shell attached to port 514.
-{ config, lib, pkgs, ... }:
+{ options, config, lib, pkgs, ... }:
with lib;
with import ../../lib/qemu-flags.nix { inherit pkgs; };
{
- # This option is a dummy that if used in conjunction with
- # modules/virtualisation/qemu-vm.nix gets merged with the same option defined
- # there and only is declared here because some modules use
- # test-instrumentation.nix but not qemu-vm.nix.
- #
- # One particular example are the boot tests where we want instrumentation
- # within the images but not other stuff like setting up 9p filesystems.
- options.virtualisation.qemu = { };
-
config = {
systemd.services.backdoor =
@@ -55,7 +46,12 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
systemd.services."serial-getty@hvc0".enable = false;
# Only use a serial console, no TTY.
- virtualisation.qemu.consoles = [ qemuSerialDevice ];
+ # NOTE: optionalAttrs
+ # test-instrumentation.nix appears to be used without qemu-vm.nix, so
+ # we avoid defining consoles if not possible.
+ # TODO: refactor such that test-instrumentation can import qemu-vm
+ # or declare virtualisation.qemu.console option in a module that's always imported
+ virtualisation = lib.optionalAttrs (options ? virtualisation.qemu.consoles) { qemu.consoles = [ qemuSerialDevice ]; };
boot.initrd.preDeviceCommands =
''
@@ -78,15 +74,8 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
# OOM killer randomly get rid of processes, since this leads
# to failures that are hard to diagnose.
echo 2 > /proc/sys/vm/panic_on_oom
-
- # Coverage data is written into /tmp/coverage-data.
- mkdir -p /tmp/xchg/coverage-data
'';
- # If the kernel has been built with coverage instrumentation, make
- # it available under /proc/gcov.
- boot.kernelModules = [ "gcov-proc" ];
-
# Panic if an error occurs in stage 1 (rather than waiting for
# user intervention).
boot.kernelParams =
@@ -115,8 +104,6 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
networking.defaultGateway = mkOverride 150 "";
networking.nameservers = mkOverride 150 [ ];
- systemd.globalEnvironment.GCOV_PREFIX = "/tmp/xchg/coverage-data";
-
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "SERIAL_8250_CONSOLE")
(isYes "SERIAL_8250")