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 {
|
sub retry {
|
||||||
my ($coderef) = @_;
|
my ($coderef) = @_;
|
||||||
my $n;
|
my $n;
|
||||||
for ($n = 0; $n < 900; $n++) {
|
for ($n = 899; $n >=0; $n--) {
|
||||||
return if &$coderef;
|
return if &$coderef($n);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
}
|
}
|
||||||
die "action timed out after $n seconds";
|
die "action timed out after $n seconds";
|
||||||
|
|
Loading…
Reference in a new issue