From b539908f7363af9a4c767c999c389f1c6f311648 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 5 Oct 2013 19:30:48 -0400 Subject: Clean up some tests for use on Windows. --- tests/ChangeLog | 5 + tests/scripts/features/default_names | 2 + tests/scripts/features/jobserver | 6 +- tests/test_driver.pl | 218 ++++++++++++++++++----------------- 4 files changed, 121 insertions(+), 110 deletions(-) (limited to 'tests') diff --git a/tests/ChangeLog b/tests/ChangeLog index 0ff5033..af7d087 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,10 @@ 2013-10-05 Paul Smith + * test_driver.pl (run_all_tests): Rewrite to be more clear. + * scripts/features/jobserver: Avoid using $ENV{HOME} as it doesn't + exist everywhere. + * scripts/features/default_names: End with 1; + * scripts/features/loadapi: Use new calling signatures. Verify the NOEXPAND flag works. Test with all valid function name characters. diff --git a/tests/scripts/features/default_names b/tests/scripts/features/default_names index 4ce90e5..2e83880 100644 --- a/tests/scripts/features/default_names +++ b/tests/scripts/features/default_names @@ -40,3 +40,5 @@ if ($case_sensitive) { compare_output("It chose Makefile\n",&get_logfile(1)); unlink("Makefile"); } + +1; diff --git a/tests/scripts/features/jobserver b/tests/scripts/features/jobserver index f2c6787..cedd4b3 100644 --- a/tests/scripts/features/jobserver +++ b/tests/scripts/features/jobserver @@ -43,10 +43,10 @@ unlink('inc.mk'); # Or Red Hat bug https://bugzilla.redhat.com/show_bug.cgi?id=885474 open(MAKEFILE,"> Makefile2"); -print MAKEFILE < 0) { - $status = "FAILED ($tests_passed/$tests_run passed)"; - } - elsif ($code < 0) { - $status = "N/A"; - --$categories_run; - } + elsif ($code != 1) { + # Bad result... this shouldn't really happen. Usually means that + # the suite forgot to end with "1;". + warn "\n*** Test returned $code\n"; + $status = "FAILED ($tests_passed/$tests_run passed)"; + } - # If the verbose option has been specified, then a short description - # of each test is printed before displaying the results of each test - # describing WHAT is being tested. + elsif ($tests_run > $tests_passed) { + # Lose! + $status = "FAILED ($tests_passed/$tests_run passed)"; + } - if ($verbose) - { - if ($detail) - { - print "\nWHAT IS BEING TESTED\n"; - print "--------------------"; - } - print "\n\n$description\n\n"; - } + else { + # Win! + ++$categories_passed; + $status = "ok ($tests_passed passed)"; + + # Clean up + for ($i = $num_of_tmpfiles; $i; $i--) { + rmfiles($tmp_filename . num_suffix($i)); + } + for ($i = $num_of_logfiles ? $num_of_logfiles : 1; $i; $i--) { + rmfiles($log_filename . num_suffix($i)); + rmfiles($base_filename . num_suffix($i)); + } + } - # If the detail option has been specified, then the details of HOW - # the test is testing what it says it is testing in the verbose output - # will be displayed here before the results of the test are displayed. + # If the verbose option has been specified, then a short description + # of each test is printed before displaying the results of each test + # describing WHAT is being tested. - if ($detail) - { - print "\nHOW IT IS TESTED\n"; - print "----------------"; - print "\n\n$details\n\n"; - } + if ($verbose) { + if ($detail) { + print "\nWHAT IS BEING TESTED\n"; + print "--------------------"; + } + print "\n\n$description\n\n"; + } - print "$status\n"; - } + # If the detail option has been specified, then the details of HOW + # the test is testing what it says it is testing in the verbose output + # will be displayed here before the results of the test are displayed. + + if ($detail) { + print "\nHOW IT IS TESTED\n"; + print "----------------"; + print "\n\n$details\n\n"; + } + + print "$status\n"; + } } # If the keep flag is not set, this subroutine deletes all filenames that @@ -713,7 +718,6 @@ sub compare_output &run_command_with_output(&get_difffile,$command); } - $suite_passed = 0; return 0; } -- cgit v1.2.3