automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] test driver: a preparatory refactoring (2)


From: Stefano Lattarini
Subject: [PATCH 2/3] test driver: a preparatory refactoring (2)
Date: Sat, 6 Aug 2011 21:47:27 +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      |    7 +++++++
 lib/tap-driver |   26 +++++++++++++++-----------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 033daec..3ca5076 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-08-06  Stefano Lattarini  <address@hidden>
 
+       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  <address@hidden>
+
        tap driver: a preparatory refactoring (1)
        * lib/tap-driver (finish): Do not flush the TAP stream nor
        fetch the exit status of the TAP producer if running with
diff --git a/lib/tap-driver b/lib/tap-driver
index a874320..c9dbe19 100755
--- a/lib/tap-driver
+++ b/lib/tap-driver
@@ -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";
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]