Re: Test suite and autotest
Tim Landscheidt <[email protected]>
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Organization | <URI:http://www.tim-landscheidt.de/> |
| Message-ID | <[email protected]> |
I wrote: > [...] NB: tests/run_make_tests.pl deletes > tests/Makefile, [...] In fact, this is caused by tests/scripts/features/default_names. The attached patch converts this script so that "make check" will work flaw- lessly. Tim _______________________________________________ Make-alpha mailing list [email protected] https://lists.gnu.org/mailman/listinfo/make-alpha
0001-Convert-tests-scripts-features-default_names-to-auto.patch
(text/x-patch, 4.8 KB)
From 2b1796348621d8ad47352c61b4c2db4db54cca61 Mon Sep 17 00:00:00 2001 From: Tim Landscheidt <[email protected]> Date: Thu, 8 Mar 2012 14:03:00 +0000 Subject: [PATCH] Convert tests/scripts/features/default_names to autotest. --- tests/Makefile.am | 2 +- tests/features/default_names.at | 46 ++++++++++++++++++++++++++++++++++ tests/local.at | 2 +- tests/scripts/features/default_names | 41 ------------------------------ tests/testsuite.at | 1 + 5 files changed, 49 insertions(+), 43 deletions(-) create mode 100644 tests/features/default_names.at delete mode 100644 tests/scripts/features/default_names diff --git a/tests/Makefile.am b/tests/Makefile.am index dbefa42..3d33ecc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,6 +32,6 @@ clean-local: AUTOM4TE = $(SHELL) $(top_srcdir)/config/missing --run autom4te AUTOTEST = $(AUTOM4TE) --language=autotest -$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/local.at $(srcdir)/options/dash-n.at $(srcdir)/package.m4 +$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/local.at $(srcdir)/features/default_names.at $(srcdir)/options/dash-n.at $(srcdir)/package.m4 $(AUTOTEST) -I '$(srcdir)' -o [email protected] [email protected] mv [email protected] $@ diff --git a/tests/features/default_names.at b/tests/features/default_names.at new file mode 100644 index 0000000..0854e67 --- /dev/null +++ b/tests/features/default_names.at @@ -0,0 +1,46 @@ +# This test makes sure that make looks for default makefiles in the +# correct order (GNUmakefile, makefile, Makefile). + +AT_SETUP([Test default Makefile.]) + +AT_DATA([Makefile], [THIRD: ; @echo It chose Makefile +]) + +AT_TEST_MAKE([], [], [It chose Makefile +]) + +AT_CLEANUP + +AT_SETUP([Test precedence of GNUmakefile over makefile and Makefile.]) + +# DOS/WIN32 platforms preserve case, but Makefile is the same file as +# makefile. In this case, Makefile and makefile will be the same, but +# we are only interested in the precedence of GNUmakefile here. + +AT_DATA([GNUmakefile], [FIRST: ; @echo It chose GNUmakefile +]) +AT_DATA([makefile], [SECOND: ; @echo It chose makefile +]) +AT_DATA([Makefile], [THIRD: ; @echo It chose Makefile +]) + +AT_TEST_MAKE([], [], [It chose GNUmakefile +]) + +AT_CLEANUP + +AT_SETUP([Test precedence of makefile over Makefile.]) + +# DOS/WIN32 platforms preserve case, but Makefile is the same file as +# makefile. In this case, we skip the test. + +AT_DATA([makefile], [SECOND: ; @echo It chose makefile +]) +AT_SKIP_IF([test -e Makefile]) +AT_DATA([Makefile], [THIRD: ; @echo It chose Makefile +]) + +AT_TEST_MAKE([], [], [It chose makefile +]) + +AT_CLEANUP diff --git a/tests/local.at b/tests/local.at index f1f4618..51a71ce 100644 --- a/tests/local.at +++ b/tests/local.at @@ -2,7 +2,7 @@ # --------------------------------------- # Try MAKEFILE with OPTIONS and expect EXPOUT. m4_define([AT_TEST_MAKE], -[AT_CHECK([MAKELEVEL= ../../../make --no-print-directory $2 -f $1], 0, [$3], [])]) +[AT_CHECK([MAKELEVEL= ../../../make --no-print-directory $2]m4_if([$1], [], [], [ -f $1]), 0, [$3], [])]) # AT_TOUCH(FILE) # -------------- diff --git a/tests/scripts/features/default_names b/tests/scripts/features/default_names deleted file mode 100644 index e53127e..0000000 --- a/tests/scripts/features/default_names +++ /dev/null @@ -1,41 +0,0 @@ -# -*-perl-*- - -$description = "This script tests to make sure that Make looks for -default makefiles in the correct order (GNUmakefile,makefile,Makefile)"; - -# Create a makefile called "GNUmakefile" -$makefile = "GNUmakefile"; - -open(MAKEFILE,"> $makefile"); -print MAKEFILE "FIRST: ; \@echo It chose GNUmakefile\n"; -close(MAKEFILE); - -# DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile. -# Just test what we can here (avoid Makefile versus makefile test). - -if ($port_type eq 'UNIX') { - # Create another makefile called "makefile" - open(MAKEFILE,"> makefile"); - print MAKEFILE "SECOND: ; \@echo It chose makefile\n"; - close(MAKEFILE); -} - -# Create another makefile called "Makefile" -open(MAKEFILE,"> Makefile"); -print MAKEFILE "THIRD: ; \@echo It chose Makefile\n"; -close(MAKEFILE); - - -&run_make_with_options("","",&get_logfile); -&compare_output("It chose GNUmakefile\n",&get_logfile(1)); -unlink $makefile; - -if ($port_type eq 'UNIX') { - &run_make_with_options("","",&get_logfile); - &compare_output("It chose makefile\n",&get_logfile(1)); - unlink "makefile"; -} - -&run_make_with_options("","",&get_logfile); -&compare_output("It chose Makefile\n",&get_logfile(1)); -unlink "Makefile"; diff --git a/tests/testsuite.at b/tests/testsuite.at index 7ef2c23..da00c1b 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -1,3 +1,4 @@ AT_INIT +m4_include([features/default_names.at]) m4_include([options/dash-n.at]) -- 1.6.2.5