-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve nixos test debug #26736
Improve nixos test debug #26736
Conversation
…he sub Allows test functions to output diagnostic information on failure.
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.
… the last attempt machine: Last chance to match /(?^:BALICE)/ on the screen, which currently contains: machine: performing optical character recognition machine: sending monitor command: screendump /tmp/nix-build-vm-test-run-sddm.drv-0/ocrin.ppm machine: Session Layout O O 0 1 : 0 9 Wednesday, June 21, 2017 |_ I Select your user and enter password
…the final check machine: must succeed: xwininfo -root -tree | sed 's/.*0x[0-9a-f]* \"\([^\"]*\)\".*/\1/; t; d' machine: exit status 0 machine: Last chance to match /(?^:dfiirst configuration)/ on the the window list, which currently contains: machine: [i3 con] container around 0xf8a5f0, i3: first configuration, [i3 con] floatingcon around 0xf8c260, [i3 con] container around 0xf8a380, i3bar for output Virtual-1, [i3 con] bottom dockarea Virtual-1, [i3 con] workspace 1, [i3 con] content Virtual-1, [i3 con] top dockarea Virtual-1, [i3 con] output Virtual-1, [i3 con] workspace __i3_scratch, [i3 con] content __i3, [i3 con] pseudo-output __i3, i3
I would also like to pick this to 17.03 |
Ps I don't really know perl 😬
…On Tue, Jun 20, 2017 at 9:24 PM Graham Christensen ***@***.***> wrote:
I would also like to pick this to 17.03
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26736 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAErrFfNg_NCyQbw2X602XX8iy1YELTZks5sGHDdgaJpZM4OAWL0>
.
|
@@ -572,6 +572,12 @@ sub waitForText { | |||
my ($self, $regexp) = @_; | |||
$self->nest("waiting for $regexp to appear on the screen", sub { | |||
retry sub { | |||
my ($retries_remaining) = @_; | |||
if ($retries_remaining == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: Instead of unpacking the array, you could simply use $_[0]
here as well.
@@ -219,8 +219,8 @@ sub waitForMonitorPrompt { | |||
sub retry { | |||
my ($coderef) = @_; | |||
my $n; | |||
for ($n = 0; $n < 900; $n++) { | |||
return if &$coderef; | |||
for ($n = 899; $n >=0; $n--) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Missing space after >=
.
Motivation for this change
NixOS tests that examine the windows, screen, or tty are hard to debug -- what was there?? Who knows. ... Now you know!
First commit: Retry now counts down to 0, and passes remaining attempts to to the sub
Second: waitUntilTTYMatches: Log TTY contents on last try
If the test has not passed yet, on the last attempt it now outputs:
to help debug the problem. Notice the "logine" typo in my check.
Third: waitForText: output the detected screen content prior to the last attempt
Fourth: nixos tests: waitForWindow: output a list of windows we see prior to the final check
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)I've tested on a few tests and it looks okay to me.
cc @volth @edolstra