]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
sg-execute-flight: Lift db work into retry loop
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 9 Dec 2016 18:53:14 +0000 (18:53 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 9 Dec 2016 19:17:35 +0000 (19:17 +0000)
* Open $mro.new at the start of the loop, rather than during
  argument parsing.   So if we retry, it gets rewritten.
* Move the stdout output to the end of the script.

We tolerate that the html is moved into place even though we might be
about to rewrite it.

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

index c66525b17ce66155bb413619c0d45f1695687f52..7380981c290852cdce5c20fff8c78a5b0a0e4822 100755 (executable)
@@ -52,7 +52,6 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         $specver{$1}{$2}= $3;
     } elsif (m/^--machine-readable-output=(.*)$/) {
         $mro= $1;
-        open MRO, "> $mro.new" or die "$mro.new $!";
     } elsif (m/^--html-dir=(.*)$/) {
         $htmldir= $1;
     } elsif (m/^--info-headers$/) {
@@ -739,8 +738,6 @@ images: $c{Images}
 
 $c{ReportTrailer}
 END
-
-    print $header_text, "\n", $body_text;
 }
 
 our %heisenjustified;
@@ -1303,12 +1300,18 @@ END
     rename "$htmlout.new", $htmlout or die $!;
 }
 
-db_begin_work($dbh_tests, []);
-findspecflight();
-my $fi= examineflight($specflight);
-my @fails= justifyfailures($fi);
-printout($fi, @fails);
-htmlout($fi);
+db_retry($dbh_tests, [], sub {
+    if (defined $mro) {
+       open MRO, "> $mro.new" or die "$mro.new $!";
+    }
+    findspecflight();
+    my $fi= examineflight($specflight);
+    my @fails= justifyfailures($fi);
+    printout($fi, @fails);
+    htmlout($fi);
+});
+
+print $header_text, "\n", $body_text;
 
 if (defined $mro) {
     close MRO or die $!;