From: Ian Jackson Date: Wed, 8 Nov 2017 16:29:07 +0000 (+0000) Subject: plan_search: Track last sharing state to determine $share_reuse X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ea6e17b3c278346ef69c5fe8046b6c266e94c378;p=people%2Faperard%2Fosstest.git plan_search: Track last sharing state to determine $share_reuse What matters for the purpose of $share_reuse is not whether the host is actually being _shared_ (ie, there are other concurrent allocations and therefore a concurrent Event with Share information). What we really want to know is whether the *last* use of this host was a suitable sharing setup - because we actually want to know if we will be able to skip our setup. So track that explicitly. (The slightly odd structure, where there are two loops in one, means that we reset $last_eshare when we go onto the next $req ie the next host to check.) Signed-off-by: Ian Jackson --- diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index 4083ae6b..5f59c44e 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -676,6 +676,7 @@ sub plan_search ($$$$) { my $try_time= 0; my $confirmedok= 0; my $share_reuse= 0; + my $last_eshare; for (;;) { my $req= $requestlist->[$reqix]; @@ -715,6 +716,10 @@ sub plan_search ($$$$) { # this period is entirely after the proposed slot; # so no need to check this or any later periods + $last_eshare = $startevt->{ + $startevt->{Type} eq 'Unshare' ? 'PreviousShare' : 'Share' + }; + next PERIOD if $endevt->{Time} <= $try_time; # this period is entirely before the proposed slot; # it doesn't overlap, but must check subsequent periods @@ -743,9 +748,10 @@ sub plan_search ($$$$) { " try=$try_time confirmed=$confirmedok reuse=$share_reuse"); $confirmedok++; - $share_reuse++ if defined $share_wear; + $share_reuse++ if $last_eshare and $share_compat_ok->($last_eshare); $reqix++; $reqix %= @$requestlist; + undef $last_eshare; last if $confirmedok==@$requestlist; }