From: Stefano Lattarini Date: Sat, 6 Aug 2011 18:54:26 +0000 (+0200) Subject: test driver: a preparatory refactoring (2) X-Git-Tag: ng-0.5a~89^2~141^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f8d51bd31b870b4af9dac5b4030bf3a5c155262;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 033daec62..3ca507668 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-08-06 Stefano Lattarini + + 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 tap driver: a preparatory refactoring (1) diff --git a/lib/tap-driver b/lib/tap-driver index a8743202f..c9dbe19ac 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";