Skip to content

Commit

Permalink
Merge pull request #31198 from Lassulus/test-display
Browse files Browse the repository at this point in the history
nixos/test-instrumentation: take DISPLAY from system-config
  • Loading branch information
Mic92 committed Nov 8, 2017
2 parents c4dbbbd + 4531ec5 commit b11ac5d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion nixos/lib/test-driver/Machine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
Expand Down
9 changes: 5 additions & 4 deletions nixos/modules/testing/test-instrumentation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

2 comments on commit b11ac5d

@aszlig
Copy link
Member

@aszlig aszlig commented on b11ac5d Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mic92: I'd reckon you didn't test this, right?

On every test that uses waitForX:

machine: running command: journalctl -b SYSLOG_IDENTIFIER=systemd | grep 'session opened'
machine: exit status 0
Use of uninitialized value $display in substitution (s///) at /nix/store/j16w2646aj7czvn1m83g0xqq2j9qygx9-nixos-test-driver/lib/perl5/site_perl/Machine.pm line 606, <__ANONIO__> line 3821.
Use of uninitialized value $display in concatenation (.) or string at /nix/store/j16w2646aj7czvn1m83g0xqq2j9qygx9-nixos-test-driver/lib/perl5/site_perl/Machine.pm line 609, <__ANONIO__> line 3821.

@Mic92
Copy link
Member Author

@Mic92 Mic92 commented on b11ac5d Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aszlig I realize, I was on the wrong branch when testing this pull request and I just checked the tests build. I reverted it for now: 0034416

Please sign in to comment.