]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test driver: a preparatory refactoring (2)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 6 Aug 2011 18:54:26 +0000 (20:54 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 6 Aug 2011 18:54:26 +0000 (20:54 +0200)
* lib/tap-driver (finish): Move code to fetch the message about
the exit status of the test being run to ...
(get_test_exit_message): ... this new subroutine.

ChangeLog
lib/tap-driver

index 033daec62a70bfa45f12f911f16fc818632421c5..3ca507668d41917cf91c46044f195d98cdd37776 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test driver: a preparatory refactoring (2)
+       * lib/tap-driver (finish): Move code to fetch the message about
+       the exit status of the test being run to ...
+       (get_test_exit_message): ... this new subroutine.
+
 2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tap driver: a preparatory refactoring (1)
index a8743202fb80dad9b12cb693498b84096a0408ee..c9dbe19ac960dc42e72299e4dfab33c40098fd68 100755 (executable)
@@ -96,6 +96,7 @@ sub extract_tap_comment ($);
 sub finish ();
 sub get_global_test_result ();
 sub get_tap_line ();
+sub get_test_exit_message ();
 sub get_test_results ();
 sub handle_tap_bailout ($);
 sub handle_tap_plan ($);
@@ -230,20 +231,23 @@ sub start (@)
   $parser->ignore_exit(1) if $cfg{"ignore-exit"};
 }
 
+sub get_test_exit_message ()
+{
+  # Flush all the remaining TAP stream, so that we can obtain the
+  # exit status of the TAP producer.
+  do {} while defined get_tap_line ();
+  # TODO: we should probably use $parser->wait here, to catch signals too
+  if ($parser->exit != 0)
+    {
+      return sprintf "exited with status %d", $parser->exit;
+    }
+}
+
 sub finish ()
 {
-  if (!$cfg{"ignore-exit"})
+  if (!$cfg{"ignore-exit"} and my $msg = get_test_exit_message)
     {
-      # Flush all the remaining TAP stream, so that we can obtain the
-      # exit status of the TAP producer.
-      do {} while defined get_tap_line ();
-      # TODO: we should probably use $parser->wait here, to catch
-      # TODO: signals too
-      if ($parser->exit != 0)
-        {
-          my $msg = sprintf "exited with status %d", $parser->exit;
-          testsuite_error $msg;
-        }
+      testsuite_error $msg;
     }
   write_test_results;
   close LOG or die "closing $log_file: $!\n";