Merge pull request #31198 from Lassulus/test-display

nixos/test-instrumentation: take DISPLAY from system-config
This commit is contained in:
Jörg Thalheim 2017-11-08 14:44:16 +00:00 committed by GitHub
commit b11ac5d29d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -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;
}
});

View file

@ -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