git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #31198 from Lassulus/test-display

nixos/test-instrumentation: take DISPLAY from system-config

commitb11ac5d29dcccdb7474a23ac1d8a6c40553adcd5 authorJörg Thalheim <Mic92@users.noreply.github.com> dateWed 8 Nov 2017, 14:44 (9 years ago) parentc4dbbbd4531ec5
2 files changed+9−5
nixos/lib/test-driver/Machine.pm+4−1 nixos/modules/testing/test-instrumentation.nix+5−4
nixos/lib/test-driver/Machine.pm+4−1
@@ -602,8 +602,11 @@ sub waitForX {
602602 $self->nest("waiting for the X11 server", sub {
603603 retry sub {
604604 my ($status, $out) = $self->execute("journalctl -b SYSLOG_IDENTIFIER=systemd | grep 'session opened'");
605+ my $display = $ENV{'DISPLAY'};
606+ $display =~ s/://;
607+
605608 return 0 if $status != 0;
606− ($status, $out) = $self->execute("[ -e /tmp/.X11-unix/X0 ]");
609+ ($status, $out) = $self->execute("[ -e /tmp/.X11-unix/X$display ]");
607610 return 1 if $status == 0;
608611 }
609612 });
nixos/modules/testing/test-instrumentation.nix+5−4
@@ -5,9 +5,10 @@
55
66with lib;
77
8−let kernel = config.boot.kernelPackages.kernel; in
9−
10−{
8+let
9+ display = (d: if d == null then 0 else d) config.services.xserver.display;
10+ kernel = config.boot.kernelPackages.kernel;
11+in {
1112
1213 # This option is a dummy that if used in conjunction with
1314 # modules/virtualisation/qemu-vm.nix gets merged with the same option defined
@@ -28,7 +29,7 @@ let kernel = config.boot.kernelPackages.kernel; in
2829 ''
2930 export USER=root
3031 export HOME=/root
31− export DISPLAY=:0.0
32+ export DISPLAY=:${toString display}
3233
3334 source /etc/profile
3435