summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-11-08 14:44:16 +0000
committerGitHub <noreply@github.com>2017-11-08 14:44:16 +0000
commitb11ac5d29dcccdb7474a23ac1d8a6c40553adcd5 (patch)
tree4bbbdaf340bb84bbe572945c3fdc4379d2026ffc /nixos
parentc4dbbbd890519fb791c51b9dc985a445df0806e2 (diff)
parent4531ec59551fa3f3c9dfb442dff2ec669c467922 (diff)
downloadnixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.tar
nixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.tar.gz
nixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.tar.bz2
nixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.tar.lz
nixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.tar.xz
nixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.tar.zst
nixpkgs-b11ac5d29dcccdb7474a23ac1d8a6c40553adcd5.zip
Merge pull request #31198 from Lassulus/test-display
nixos/test-instrumentation: take DISPLAY from system-config
Diffstat (limited to 'nixos')
-rw-r--r--nixos/lib/test-driver/Machine.pm5
-rw-r--r--nixos/modules/testing/test-instrumentation.nix9
2 files changed, 9 insertions, 5 deletions
diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm
index a7ed5d1faa3..dbed242eb86 100644
--- a/nixos/lib/test-driver/Machine.pm
+++ b/nixos/lib/test-driver/Machine.pm
@@ -602,8 +602,11 @@ sub waitForX {
     $self->nest("waiting for the X11 server", sub {
         retry sub {
             my ($status, $out) = $self->execute("journalctl -b SYSLOG_IDENTIFIER=systemd | grep 'session opened'");
+            my $display = $ENV{'DISPLAY'};
+            $display =~ s/://;
+
             return 0 if $status != 0;
-            ($status, $out) = $self->execute("[ -e /tmp/.X11-unix/X0 ]");
+            ($status, $out) = $self->execute("[ -e /tmp/.X11-unix/X$display ]");
             return 1 if $status == 0;
         }
     });
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix
index 7f5b55d5cca..2465e99e9c1 100644
--- a/nixos/modules/testing/test-instrumentation.nix
+++ b/nixos/modules/testing/test-instrumentation.nix
@@ -5,9 +5,10 @@
 
 with lib;
 
-let kernel = config.boot.kernelPackages.kernel; in
-
-{
+let
+  display = (d: if d == null then 0 else d) config.services.xserver.display;
+  kernel = config.boot.kernelPackages.kernel;
+in {
 
   # This option is a dummy that if used in conjunction with
   # modules/virtualisation/qemu-vm.nix gets merged with the same option defined
@@ -28,7 +29,7 @@ let kernel = config.boot.kernelPackages.kernel; in
           ''
             export USER=root
             export HOME=/root
-            export DISPLAY=:0.0
+            export DISPLAY=:${toString display}
 
             source /etc/profile