+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)
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 ($);
$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";