From 1b9024889384fc26d296ee4340ffca32e8c73017 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 15 Sep 2013 16:41:42 -0400 Subject: [SV 27374] Fatal immediately on unrecoverable fopen() errors. --- tests/test_driver.pl | 53 +++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'tests/test_driver.pl') diff --git a/tests/test_driver.pl b/tests/test_driver.pl index adc38ae..16ae889 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -653,38 +653,43 @@ sub compare_output local($answer,$logfile) = @_; local($slurp, $answer_matched) = ('', 0); - print "Comparing Output ........ " if $debug; + ++$tests_run; - $slurp = &read_file_into_string ($logfile); + if (! defined $answer) { + print "Ignoring output ........ " if $debug; + $answer_matched = 1; + } else { + print "Comparing Output ........ " if $debug; - # For make, get rid of any time skew error before comparing--too bad this - # has to go into the "generic" driver code :-/ - $slurp =~ s/^.*modification time .*in the future.*\n//gm; - $slurp =~ s/^.*Clock skew detected.*\n//gm; + $slurp = &read_file_into_string ($logfile); - ++$tests_run; + # For make, get rid of any time skew error before comparing--too bad this + # has to go into the "generic" driver code :-/ + $slurp =~ s/^.*modification time .*in the future.*\n//gm; + $slurp =~ s/^.*Clock skew detected.*\n//gm; - if ($slurp eq $answer) { - $answer_matched = 1; - } else { - # See if it is a slash or CRLF problem - local ($answer_mod, $slurp_mod) = ($answer, $slurp); + if ($slurp eq $answer) { + $answer_matched = 1; + } else { + # See if it is a slash or CRLF problem + local ($answer_mod, $slurp_mod) = ($answer, $slurp); - $answer_mod =~ tr,\\,/,; - $answer_mod =~ s,\r\n,\n,gs; + $answer_mod =~ tr,\\,/,; + $answer_mod =~ s,\r\n,\n,gs; - $slurp_mod =~ tr,\\,/,; - $slurp_mod =~ s,\r\n,\n,gs; + $slurp_mod =~ tr,\\,/,; + $slurp_mod =~ s,\r\n,\n,gs; - $answer_matched = ($slurp_mod eq $answer_mod); + $answer_matched = ($slurp_mod eq $answer_mod); - # If it still doesn't match, see if the answer might be a regex. - if (!$answer_matched && $answer =~ m,^/(.+)/$,) { - $answer_matched = ($slurp =~ /$1/); - if (!$answer_matched && $answer_mod =~ m,^/(.+)/$,) { - $answer_matched = ($slurp_mod =~ /$1/); + # If it still doesn't match, see if the answer might be a regex. + if (!$answer_matched && $answer =~ m,^/(.+)/$,) { + $answer_matched = ($slurp =~ /$1/); + if (!$answer_matched && $answer_mod =~ m,^/(.+)/$,) { + $answer_matched = ($slurp_mod =~ /$1/); + } + } } - } } if ($answer_matched && $test_passed) @@ -706,8 +711,6 @@ sub compare_output local($command) = "diff -c " . &get_basefile . " " . $logfile; &run_command_with_output(&get_difffile,$command); - } else { - &rmfiles (); } $suite_passed = 0; -- cgit v1.2.3