[OSSTEST PATCH 1/4] cs-bisection-step: need_repro_sequence: Provide info to callback

Ian Jackson posted 4 patches 5 years, 8 months ago
[OSSTEST PATCH 1/4] cs-bisection-step: need_repro_sequence: Provide info to callback
Posted by Ian Jackson 5 years, 8 months ago
This will be used by the callback in a moment.

No functional change yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 cs-bisection-step | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cs-bisection-step b/cs-bisection-step
index 478baa5b..35085e89 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -805,7 +805,8 @@ our $repro_count;
 sub need_repro_sequence ($$) {
     my ($need_each, $code) = @_;
     #
-    # $code->() should call, in turn for each required event,
+    # $code->($repro_count, $is_last_repro)
+    # should call, in turn for each required event,
     #    need_repro('pass', $nodes{SOMETHING}, $what) or
     #    need_repro('fail', $nodes{SOMETHING}, $what)
     # and return true as soon as any of the need_repro's return true.
@@ -817,7 +818,7 @@ sub need_repro_sequence ($$) {
     local ($repro_lastflight) = 0;
     local ($repro_count);
     for ($repro_count=0; $repro_count<$need_each; $repro_count++) {
-        return 1 if $code->();
+        return 1 if $code->($repro_count, $repro_count==$need_each-1);
     }
 }
 
@@ -851,6 +852,7 @@ sub search () {
 
     return if 
         need_repro_sequence(2, sub {
+            my ($repro_count, $is_last_repro) = @_;
             need_repro('pass', $nodes{"@basispass_rtuple"}, "basis pass") ||
             need_repro('fail', $nodes{"@latest_rtuple"},    "basis failure");
         });
-- 
2.20.1