Skip to contentSkip to conversation

bisection: Skip some useless repros

PATCH New Ian Jackson 1 participant 5 messages Jun 4, 2020

lore
Share & tools
lore
#0 lore raw

cover bisection: Skip some useless repros

This arranges for an ongoing bisection to be able to restart more efficiently when the staging tip advances, and yet the test being bisected still fails.

This will speed up the current osstest bisection of the smoke test libvirt failure.

There are no code changes outside the bisector and the bisector is not itself subject to the osstest self-test. I am therefore going to force-push these four changes straight into osstest production. (Obviously I have tested them locally and seen that bisection still basically works and also that this fixes the issue.)

Ian Jackson (4):
cs-bisection-step: need_repro_sequence: Provide info to callback
cs-bisection-step: need_repro: Provision for $xinfo
cs-bisection-step: need_repro: Support $consider_parents
cs-bisection-step: Do not needlessly repro on tip

 cs-bisection-step | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

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

This will be used by the callback in a moment.

No functional change yet.

---
 cs-bisection-step | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
cs-bisection-step +4 -2
index 478baa5b..35085e89 100755
@@ -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");
         });
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/4 cs-bisection-step: need_repro: Provision for $xinfo

In reply to Ian Jackson

This becomes part of the message but right now it is juse "".

So no functional change yet.

---
 cs-bisection-step | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cs-bisection-step +2 -1
index 35085e89..90e0601a 100755
@@ -828,6 +828,7 @@ sub need_repro ($$$) {
     return 1 if conflicted_warning($n, $what);
 
     my $fl= $n->{Flights} || [];
+    my $xinfo='';
     foreach my $f (sort { $a->{Flight} <=> $b->{Flight} } @$fl) {
         next unless $f->{Flight} > $repro_lastflight;
 	if ($f->{Result} ne $st) {
@@ -837,7 +838,7 @@ sub need_repro ($$$) {
 	}
         print STDERR " ".
             ($repro_count ? "Repro" : "Result").
-            " found: flight $f->{Flight} ($st), for $what\n";
+            " found: flight $f->{Flight} ($st), for $what$xinfo\n";
         $repro_lastflight= $f->{Flight};
         $repro_firstflight ||= $f->{Flight};
         return 0;
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/4 cs-bisection-step: need_repro: Support $consider_parents

In reply to Ian Jackson

This flag tells need_repro to look at parent commits of the indicated rtuple node, as well as the node itself. We walk up the tree. If there are multiple parents, we stop; likewise if we find any rtuple which doesn't have the expected results.

---
 cs-bisection-step | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
cs-bisection-step +20 -2
index 90e0601a..bc6fb794 100755
@@ -822,13 +822,31 @@ sub need_repro_sequence ($$) {
     }
 }
 
-sub need_repro ($$$) {
-    my ($st, $n, $what) = @_;
+sub need_repro ($$$;$) {
+    my ($st, $n, $what, $consider_parents) = @_;
 
     return 1 if conflicted_warning($n, $what);
 
     my $fl= $n->{Flights} || [];
     my $xinfo='';
+    if ($consider_parents) {
+        $fl = [ @$fl ];
+	my $nloop = $n;
+	my $iters = 0;
+	for (;;) {
+	    last unless @{ $nloop->{Parents} } == 1;
+	    $nloop = $nloop->{Parents}[0];
+	    $iters++;
+	    $xinfo = " (at ancestor ~$iters)";
+	    my @others = grep { $_->{Result} ne $st } @{ $nloop->{Flights} };
+	    if (@others) {
+	        print STDERR
+ " For $what, parent search stopping at $nloop->{Rtuple}, results @others";
+	    }
+	    push @$fl, @{ $nloop->{Flights} };
+	}
+    }
+
     foreach my $f (sort { $a->{Flight} <=> $b->{Flight} } @$fl) {
         next unless $f->{Flight} > $repro_lastflight;
 	if ($f->{Result} ne $st) {
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/4 cs-bisection-step: Do not needlessly repro on tip

In reply to Ian Jackson

If we were halfway through bisecting, we treat the incident failure as the basis failure. But our previous bisection results can count as indications that things are really failing - we don't need to repro on the very final commit.

---
 cs-bisection-step | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cs-bisection-step +2 -1
index bc6fb794..9a0fee39 100755
@@ -873,7 +873,8 @@ sub search () {
         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");
+            need_repro('fail', $nodes{"@latest_rtuple"}, "basis failure",
+		       !$is_last_repro);
         });
 
     foreach my $startfail (@failures) {
Signature · 1 line
2.20.1