Skip to contentSkip to conversation

timeout: adjust timeout when running nested tests

PATCH In review Roger Pau Monne 2 participants 4 messages Apr 1, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timeout: adjust timeout when running nested tests

Expand the timeouts when the host is nested. The current algorithm uses base_timeout * 2 ^ nesting_level.

This fixes the issues reported by the nested tests on elbling boxes:

http://logs.test-lab.xenproject.org/osstest/logs/149283/

---
 Osstest/TestSupport.pm | 4 ++++
 1 file changed, 4 insertions(+)
Osstest/TestSupport.pm +4 -0
index 1c13e2af..ff749a32 100644
@@ -436,6 +436,7 @@ END
 
 sub target_adjust_timeout ($$) {
     my ($ho,$timeoutref) = @_; # $ho might be a $gho
+    my $nestinglvl = $ho->{NestingLevel} || $ho->{Host}{NestingLevel};
     my $adjust = sub {
 	my ($factor, $what) = @_;
 	return unless defined $factor;
@@ -450,6 +451,9 @@ sub target_adjust_timeout ($$) {
 	$adjust->(guest_var($ho,$guest_var), "guest variable $guest_var");
     }
     $adjust->(get_target_property($ho,"TimeoutFactor"), "target TimeoutFactor");
+    if ($nestinglvl) {
+        $adjust->(1 << $nestinglvl, "nesting level");
+    }
 }
 
 #---------- running commands eg on targets ----------
Signature · 1 line
2.26.0
#1 lore raw

Roger Pau Monne writes ("[PATCH] timeout: adjust timeout when running nested tests"):

Quoted 3 lines

sub target_adjust_timeout ($$) {
my ($ho,$timeoutref) = @_; # $ho might be a $gho
+ my $nestinglvl = $ho->{NestingLevel} || $ho->{Host}{NestingLevel};

I think this wannts to be // not ||. If you agree I will fix this up and commit.

Since what this does otherwise is to take all baremetal hosts and give them an empty Host hash due to autovivification.

Osstest/TestSupport.pm sub target_adjust_timeout ($$) { · line 456

Quoted 3 lines
Osstest/TestSupport.pm +3 -0
+    if ($nestinglvl) {
+        $adjust->(1 << $nestinglvl, "nesting level");
+    }

I still think the use of << is very odd and I can't resist moaning about it. But you're the patch author so I will let you choose the style here.

Ian.

#2 lore raw
Quoted 7 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH] timeout: adjust timeout when running nested tests"):

Quoted 3 lines

sub target_adjust_timeout ($$) {
my ($ho,$timeoutref) = @_; # $ho might be a $gho
+ my $nestinglvl = $ho->{NestingLevel} || $ho->{Host}{NestingLevel};

I think this wannts to be // not ||. If you agree I will fix this up and commit.

Yes, I agree.

Quoted 10 lines

Since what this does otherwise is to take all baremetal hosts and give them an empty Host hash due to autovivification.

Osstest/TestSupport.pm sub target_adjust_timeout ($$) { · line 456

Quoted 3 lines
Osstest/TestSupport.pm +3 -0
+    if ($nestinglvl) {
+        $adjust->(1 << $nestinglvl, "nesting level");
+    }

I still think the use of << is very odd and I can't resist moaning about it. But you're the patch author so I will let you choose the style here.

Feel free to change to 2 ** $nestinglvl at commit, you are the maintainer so it's important that you can read the code easily.

Thanks, Roger.

#3 lore raw

Roger Pau Monne writes ("Re: [PATCH] timeout: adjust timeout when running nested tests"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

I think this wannts to be // not ||. If you agree I will fix this up and commit.

Yes, I agree.

Thanks, done and pushed.

Quoted 7 lines
Quoted 7 lines

Since what this does otherwise is to take all baremetal hosts and give them an empty Host hash due to autovivification.

Quoted 3 lines
Osstest/TestSupport.pm +3 -0
+    if ($nestinglvl) {
+        $adjust->(1 << $nestinglvl, "nesting level");
+    }
Quoted 6 lines
Quoted 3 lines

I still think the use of << is very odd and I can't resist moaning about it. But you're the patch author so I will let you choose the style here.

Feel free to change to 2 ** $nestinglvl at commit, you are the maintainer so it's important that you can read the code easily.

I'll keep the version you tested rather than messing about with it...

Ian.