From: Ian Jackson Subject: [OSSTEST PATCH 2/5] cs-bisection-step: Detect flailing Date: Tue, 12 May 2015 12:11:39 +0100 Message-ID: <1431429102-4014-3-git-send-email-ian.jackson@eu.citrix.com> References: <1431429102-4014-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Ys86I-00021Z-0C for xen-devel@lists.xenproject.org; Tue, 12 May 2015 11:11:50 +0000 In-Reply-To: <1431429102-4014-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Specifically, search for previous identical flights (on the same branch with the relevant blessings). Here `identical' means it has exactly the same set of runvars (and, hence, the same set of jobs, assuming each job has at least one runvar). This detects various forms of looping which aren't stopped any other way. Specifically, one relevant situation occurs if attempts to build revision (A,B,C) actually build (A,B,C') due to bugs in the build machinery (which could be bugs in osstest or in the software under test). In this case the bisector would never spot its previous attempts as relevant; instead, it would disregard them due to the mismatched versions. It would then retry the same version, until something happened to stop it. As written here, we do not consider osstest revision as a relevant factor in `identical'. So if reason for the looping is a bug in osstest we would need to manually un-bless affected flights, as well as removing the stamp files which are used to record completion of attempted bisection. Signed-off-by: Ian Jackson --- cs-bisection-step | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/cs-bisection-step b/cs-bisection-step index 192bbe7..99dbcf2 100755 --- a/cs-bisection-step +++ b/cs-bisection-step @@ -1200,8 +1200,99 @@ END $addhost->execute($popflight, $job, $`, $'); # ' } }); +} + +sub checkrepetition () { + return unless $popflight && defined $choose; + + # Repetition check: check that there are not too many recent + # identical flights on this branch. We do this in a separate + # transaction so that we leave the broken flight in the database + # for debugging purposes. + + my $runvarsqt= sub { + return + "(SELECT job,name,val FROM runvars". + " WHERE runvars.flight=$_[0] AND NOT synth)"; +END + }; + + my $maxequalflights = 4; + + my $runvarsqt1 = $runvarsqt->('?'); + my $runvarsqt2 = $runvarsqt->('flights.flight'); + + # The SELECT 1 subquery looks for differing runvars: the two inner + # subqueries fetch all the runvars for the two flights to be + # compared and then the full outer join produces a complete list + # of all mentioned runvars (identified by (job,name)) with their + # values in each flight. The IS NOT TRUE is there so that when + # one side is NULL (runvar was missing) it still counts. + my $equalflightsqt = <= ? + ORDER BY flight DESC + LIMIT $maxequalflights + 1; +END + + print DEBUG "equalflightsq:\n$equalflightsqt"; + my $equalflightsq = $dbh_tests->prepare($equalflightsqt); - print STDERR "Flight $popflight ready to go.\n"; + db_retry($popflight,'constructing', $dbh_tests,[qw(flights)], sub { + print STDERR "Checking for flail...\n"; + + my ($minflight) = $dbh_tests->selectrow_array(<execute($branch, $popflight, $minflight); + my $nequalflights = 0; + my $explanation = ''; + while (my $identical = $equalflightsq->fetchrow_hashref()) { + $explanation .= sprintf + " %s started %s blessed %s\n", + $identical->{flight}, + show_abs_time($identical->{started}), + $identical->{blessing}; + $nequalflights++; + } + chomp $explanation; + print DEBUG "nequalflights=$nequalflights\n$explanation\n"; + if ($nequalflights > $maxequalflights) { + summary_report(<$nequalflights identical flights to no useful effect +END +Bisector is flailing: >$nequalflights identical flights generated. +Perhaps machinery for building correct version is broken ? +Problem occurs when attempting to test this revision: + $choose->{Rtuple} + +Identical previous flights on this branch: +$explanation + $popflight just generated +END + $choose = undef; + + $dbh_tests->do(<