nixos tests: retry: Count down to 0, and pass remaining attempts to the sub
Allows test functions to output diagnostic information on failure.
This commit is contained in:
parent
d04286be34
commit
56435c1404
|
@ -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--) {
|
||||
return if &$coderef($n);
|
||||
sleep 1;
|
||||
}
|
||||
die "action timed out after $n seconds";
|
||||
|
|
Loading…
Reference in New Issue