]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
sg-report-flight: Make bodyprint[f] defer the output
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 30 Jun 2015 10:11:00 +0000 (11:11 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 1 Jul 2015 12:34:49 +0000 (13:34 +0100)
Provide and use variables $header_text and $body_text.

Still no functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
sg-report-flight

index f9f6e24f93dd280dbaf32d4f65f9abed6e5874b0..bfc87874245a4f97bb20517a5a59948b4fa196b5 100755 (executable)
@@ -490,8 +490,11 @@ END
     };
 }
 
-sub bodyprint { print @_ or die $!; }
-sub bodyprintf { printf @_ or die $!; }
+our $header_text;
+our $body_text;
+
+sub bodyprint { $body_text .= $_ foreach @_; }
+sub bodyprintf { my $fmt = shift @_; $body_text .= sprintf $fmt, @_; }
 
 sub printversions ($) {
     my ($thisthat) = @_;
@@ -544,9 +547,12 @@ sub print_pushgate_summary () {
 
 sub printout {
     my ($r, @failures) = @_;
-    bodyprint <<END;
-$r->{Flight}: $r->{OutcomeSummary}
+    $header_text = '';
+    $body_text = '';
 
+    # Caller expects to provide `Subject: ', so this must come first.
+    $header_text .= <<END or die $!;
+$r->{Flight}: $r->{OutcomeSummary}
 END
     foreach my $include (@includebeginfiles) {
         STDOUT->flush();
@@ -656,6 +662,8 @@ images: $c{Images}
 
 $c{ReportTrailer}
 END
+
+    print $header_text, "\n", $body_text;
 }
 
 our %heisenjustified;