3
0
Fork 0
forked from mirrors/nixpkgs

nixos/test-instrumentation: softcode DISPLAY

This commit is contained in:
lassulus 2017-11-02 17:06:31 +01:00
parent a41342ba58
commit 4531ec5955
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 { $self->nest("waiting for the X11 server", sub {
retry sub { retry sub {
my ($status, $out) = $self->execute("journalctl -b SYSLOG_IDENTIFIER=systemd | grep 'session opened'"); my ($status, $out) = $self->execute("journalctl -b SYSLOG_IDENTIFIER=systemd | grep 'session opened'");
my $display = $ENV{'DISPLAY'};
$display =~ s/://;
return 0 if $status != 0; 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; return 1 if $status == 0;
} }
}); });

View file

@ -5,9 +5,10 @@
with lib; 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 # This option is a dummy that if used in conjunction with
# modules/virtualisation/qemu-vm.nix gets merged with the same option defined # 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 USER=root
export HOME=/root export HOME=/root
export DISPLAY=:0.0 export DISPLAY=:${toString display}
source /etc/profile source /etc/profile