diff mbox series

[OSSTEST,32/82] plan_search: Use plan's Wear information rather than tracking it ourselves

Message ID 20201007180024.7932-33-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series Reuse test hosts | expand

Commit Message

Ian Jackson Oct. 7, 2020, 5:59 p.m. UTC
From: Ian Jackson <ian.jackson@eu.citrix.com>

There is no reason not to use this information from the plan.
Not computing it ourselves saves some confusing logic here.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/Executive.pm | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index dfa3710a..e17b6503 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -675,7 +675,6 @@  sub plan_search ($$$$) {
     my $reqix= 0;
     my $try_time= 0;
     my $confirmedok= 0;
-    my $share_wear;
     my $share_reuse= 0;
 
     for (;;) {
@@ -689,8 +688,7 @@  sub plan_search ($$$$) {
       PERIOD:
 	foreach (my $ix=0; $ix<@$events; $ix++) {
 	    $dbgprint->("PLAN LOOP reqs[$reqix]=$req->{Ident}".
-		" evtix=$ix try=$try_time confirmed=$confirmedok".
-		(defined($share_wear) ? " wear=$share_wear" : ""));
+		" evtix=$ix try=$try_time confirmed=$confirmedok");
 
 	    # check the period from $events[$ix] to next event
 	    my $startevt= $events->[$ix];
@@ -710,12 +708,8 @@  sub plan_search ($$$$) {
 			($req->{SharedMaxTasks}//'<undef>'));
 		return 0 unless defined $req->{Shared};
 		return 0 unless $req->{Shared} eq $eshare->{Type};
-		if (defined $share_wear) {
-		    $share_wear++ if $startevt->{Type} eq 'Start';
-		} else {
-		    $share_wear= $eshare->{Wear}+1;
-		}
-		return 0 if $share_wear > $req->{SharedMaxWear};
+		my $wear= $eshare->{Wear}+1;
+		return 0 if $wear > $req->{SharedMaxWear};
 		return 0 if $eshare->{Shares} != $req->{SharedMaxTasks};
 		$dbgprint->("PLAN LOOP   SHARE-COMPAT-OK Y");
 		return 1;
@@ -742,13 +736,11 @@  sub plan_search ($$$$) {
 	    # nope
 	    $try_time= $endevt->{Time};
 	    $confirmedok= 0;
-	    undef $share_wear;
 	    $share_reuse= 0;
 	    $dbgprint->("PLAN LOOP   OVERLAP BAD $try_time");
 	}
 	$dbgprint->("PLAN NEXT reqs[$reqix]=$req->{Ident}".
-	    " try=$try_time confirmed=$confirmedok reuse=$share_reuse".
-	    (defined($share_wear) ? " wear=$share_wear" : ""));
+	    " try=$try_time confirmed=$confirmedok reuse=$share_reuse");
 
 	$confirmedok++;
 	$share_reuse++ if defined $share_wear;