Skip to content

Commit

Permalink
nixos tests: waitUntilTTYMatches: Log TTY contents on last try
Browse files Browse the repository at this point in the history
If the test has not passed yet, on the last attempt it now outputs:

    machine: Last chance to match /logine: / on TTY2, which currently contains:
    machine: running command: fold -w$(stty -F /dev/tty2 size | awk '{print $2}') /dev/vcs2
    machine: exit status 0
    machine:

    <<< Welcome to NixOS 17.09.git.a804ef4 (x86_64) - tty2 >>>

    machine login:

to help debug the problem. Notice the "logine" typo in my check.
  • Loading branch information
grahamc committed Jun 21, 2017
1 parent 56435c1 commit 348785e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nixos/lib/test-driver/Machine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,12 @@ sub waitUntilTTYMatches {

$self->nest("waiting for $regexp to appear on tty $tty", sub {
retry sub {
my ($retries_remaining) = @_;
if ($retries_remaining == 0) {
$self->log("Last chance to match /$regexp/ on TTY$tty, which currently contains:");
$self->log($self->getTTYText($tty));
}

return 1 if $self->getTTYText($tty) =~ /$regexp/;
}
});
Expand Down

0 comments on commit 348785e

Please sign in to comment.