diff mbox series

[OSSTEST,1/2] other_revision_job_suffix: Take and pass referring runvar name

Message ID 20190930145712.31389-1-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series [OSSTEST,1/2] other_revision_job_suffix: Take and pass referring runvar name | expand

Commit Message

Ian Jackson Sept. 30, 2019, 2:57 p.m. UTC
We are going to need this to sort out bisection for freebsd's
recursive builds.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest.pm        |  6 +++---
 cs-bisection-step | 17 +++++++++--------
 2 files changed, 12 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/Osstest.pm b/Osstest.pm
index 7ce53fcb..561d584c 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -374,8 +374,8 @@  sub flight_otherjob ($$) {
            confess "$otherflightjob ?";
 }
 
-sub other_revision_job_suffix ($$) {
-    my ($jobfield, $separator) = @_;
+sub other_revision_job_suffix ($$$) {
+    my ($jobfield, $refrunvar, $separator) = @_;
     return <<END
       (CASE
        WHEN ($jobfield) LIKE 'build-%-prev' THEN '${separator}prev'
@@ -386,7 +386,7 @@  END
 
 sub main_revision_job_cond ($) {
     my ($jobfield) = @_;
-    return "(${\ other_revision_job_suffix($jobfield,'x') } = '')";
+    return "(${\ other_revision_job_suffix($jobfield,'x','x') } = '')";
 }
 
 sub get_harness_rev () {
diff --git a/cs-bisection-step b/cs-bisection-step
index 05bfaa0a..48208e46 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -232,7 +232,7 @@  END
         SELECT url.val AS uval,
 	       rev.val AS rval,
 	       url.job AS job,
-               ${\ other_revision_job_suffix('url.job',' ') } AS othrev,
+      ${\ other_revision_job_suffix('url.job','url.use',' ') } AS othrev,
 	       url.name AS longname
 
 	    FROM tmp_build_info AS rev
@@ -1135,9 +1135,9 @@  our %jobs_created;
 our %builds_investigated; # $builds_investigated{$popjob} = 0, or {..row..}
 our %recursion_track;
 
-sub preparejob ($$$);
-sub preparejob ($$$) {
-    my ($popjob, $copyflight, $cacheok) = @_;
+sub preparejob ($$$$);
+sub preparejob ($$$$) {
+    my ($popjob, $copyflight, $refrunvar, $cacheok) = @_;
     # runs in db_retry qw(flights)
 
     if (exists $jobs_created{$popjob}) {
@@ -1168,13 +1168,13 @@  END
         SELECT name FROM runvars
           WHERE  flight=? AND job=?
             AND  name = ?
-            AND  ${\ other_revision_job_suffix('job',' ') } = ?
+            AND  ${\ other_revision_job_suffix('job','?',' ') } = ?
 END
     foreach (my $i=0; $i<@treeinfos; $i++) {
         my $name= $treeinfos[$i]{Name};
 	my $othrev = $name =~ s{ (.+)$}{} ? $1 : '';
         my $treevar= 'tree_'.$name;
-        $treeq->execute($copyflight, $popjob, $treevar, $othrev);
+        $treeq->execute($copyflight, $popjob, $treevar, $refrunvar, $othrev);
         my ($treerow) = $treeq->fetchrow_array();
         $treeq->finish();
         next unless defined $treerow;
@@ -1312,7 +1312,8 @@  END
             print STDERR "Reusing $target for $subjob->{name}".
                 " in $popflight.$popjob\n";
         } else {
-            $target= preparejob($subjob->{job}, $subjob->{orgflight}, 1);
+            $target= preparejob($subjob->{job}, $subjob->{orgflight},
+				$subjob->{name}, 1);
         }
         $jobsetq->execute($target, $popflight, $popjob, $subjob->{name});
     }
@@ -1339,7 +1340,7 @@  END
     db_retry($popflight,'constructing', $dbh_tests,[qw(flights)], sub {
         print STDERR "Populating $popflight...\n";
 	undef %jobs_created;
-        preparejob($job, $latest_flight, 0);
+        preparejob($job, $latest_flight, '', 0);
         foreach my $hostspec (split /,/, $hosts) { # /
             $hostspec =~ m/=/;
             $addvar->execute($popflight, $job, $`, $'); # '