]> xenbits.xensource.com Git - osstest.git/commitdiff
Other-revision-jobs: Provide other_revision_job_suffix
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 28 Aug 2015 14:17:09 +0000 (15:17 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 28 Aug 2015 16:28:50 +0000 (17:28 +0100)
This is a string, a function of the job name, that identifies the
class of `other revisions'.  It is empty for main-revision jobs
and currently there is only `<delimiter>prev' for build-*-prev.

We are going to use this in the bisector.

Reimplement main_revision_job_cond in terms of this.  No functional
change, except that the SQL optimiser may have more work to do.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Osstest.pm

index 55e1aa16ccaab2a6bf52e6312db6d898d565d947..1fe16fc8a1fab1e11c38e19bb425cd70378e19ee 100644 (file)
@@ -35,7 +35,7 @@ BEGIN {
                       getmethod
                       postfork
                       flight_otherjob
-                      main_revision_job_cond
+                      main_revision_job_cond other_revision_job_suffix
                       $dbh_tests db_retry db_retry_retry db_retry_abort
                       db_begin_work db_prepare
                       ensuredir get_filecontents_core_quiet system_checked
@@ -318,9 +318,19 @@ sub flight_otherjob ($$) {
            die "$otherflightjob ?";
 }
 
+sub other_revision_job_suffix ($$) {
+    my ($jobfield, $separator) = @_;
+    return <<END
+      (CASE
+       WHEN ($jobfield) LIKE 'build-%-prev' THEN '${separator}prev'
+       ELSE                                      ''
+       END)
+END
+}
+
 sub main_revision_job_cond ($) {
     my ($jobfield) = @_;
-    return "(($jobfield) NOT LIKE 'build-%-prev')";
+    return "(${\ other_revision_job_suffix($jobfield,'x') } = '')";
 }
 
 sub get_filecontents_core_quiet ($) { # ENOENT => undef