[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
 Osstest/Executive.pm | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

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;
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.