]> xenbits.xensource.com Git - osstest.git/commitdiff
sg-report-job-history: Refactor "ALL" handling
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 10 Aug 2020 14:43:33 +0000 (15:43 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 19 Aug 2020 10:41:18 +0000 (11:41 +0100)
* Make an explicit entry ALL in @branches, rather than implicitly
  processing ALL as well.

* Consequently, put explicit ALL entries in @tasks too, rather than
  putting in entries without a branch name.

* Pass ALL to processjobbranch rather than undef, and turn it into
  the internally-used undef at the start.

When used with --flight (findflight), this has no functional change.
When used with --job, ALL must now be included in the branch
list passed to --branches.  The only in-tree call is with --flight.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
sg-report-job-history

index 3b45992f7820702f3289ea6bd9edd18e4dd6d125..8932458e2921cc4e734931cd7617a4253ec565b3 100755 (executable)
@@ -72,7 +72,7 @@ sub findflight () {
         SELECT branch FROM flights WHERE flight=?
 END
     die "$flight ? @$branches ?" if @$branches!=1;
-    @branches= @$branches;
+    @branches= ('ALL', @$branches);
 
     my $selectq= db_prepare(<<END);
         SELECT job FROM jobs WHERE flight=? ORDER BY JOB
@@ -110,7 +110,10 @@ END
 }
 
 sub processjobbranch ($$$) {
-    my ($j,$bra,$html_file) = @_;
+    my ($j,$branch_or_all,$html_file) = @_;
+
+    my $bra = $branch_or_all;
+    undef $bra if $bra eq 'ALL';
 
     my $buildsq= db_prepare(<<END);
         SELECT * FROM runvars
@@ -294,14 +297,13 @@ END
 
 my @tasks;
 foreach my $j (@jobs) {
-    push @tasks, $j;
     push @tasks, "$j $_" foreach @branches;
 }
 
 parallel_by_fork('sg-report-job-history', $maxjobs, \@tasks, sub {
     my ($task) = @_;
     my ($job, $branch) = split / /, $task; # $branch might be undef
-    my $html_file = sprintf "history/%s/%s.html", $job, ($branch // 'ALL');
+    my $html_file = sprintf "history/%s/%s.html", $job, $branch;
     db_retry($dbh_tests, [], sub {
         processjobbranch($job, $branch, $html_file);
     });