summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-02-10 00:10:57 +0000
committerPaul Smith <psmith@gnu.org>2005-02-10 00:10:57 +0000
commitc90f47e8320b41e3a5bfeb654543d9474f763e5d (patch)
treef1e18c8945deebecf1529c040d01602d9c997eaa /tests
parent939167cfc151eae77c0d2a9d01fe2e73cab1a1b1 (diff)
downloadgunmake-c90f47e8320b41e3a5bfeb654543d9474f763e5d.tar.gz
Flush stdout after printing directory info.
Fix references to MINGW #define constants. Remove WINDOWS32 ifdef from sub_proc.h. Only add variables to the command line for recursion once. New features in run_make_test: #PWD# and #MAKEPATH# replacements. Test the multi-variable fix in the recursion regression test.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog5
-rwxr-xr-xtests/run_make_tests.pl4
-rw-r--r--tests/scripts/features/recursion104
3 files changed, 58 insertions, 55 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9f68a05..ffaf1b1 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-09 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/features/recursion: Test command line variable settings:
+ only one instance of a given variable should be provided.
+
2004-11-30 Boris Kolpackov <boris@kolpackov.net>
* tests/scripts/functions/abspath: New file: test `abspath'
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 9b9104f..aeba4e8 100755
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -81,7 +81,9 @@ sub run_make_test
# Replace @MAKEFILE@ with the makefile name and @MAKE@ with the path to
# make
$makestring =~ s/#MAKEFILE#/$makefile/g;
+ $makestring =~ s/#MAKEPATH#/$mkpath/g;
$makestring =~ s/#MAKE#/$make_name/g;
+ $makestring =~ s/#PWD#/$pwd/g;
# Populate the makefile!
open(MAKEFILE, "> $makefile") || die "Failed to open $makefile: $!\n";
@@ -93,7 +95,9 @@ sub run_make_test
$answer && $answer !~ /\n$/s and $answer .= "\n";
$answer =~ s/#MAKEFILE#/$makefile/g;
+ $answer =~ s/#MAKEPATH#/$mkpath/g;
$answer =~ s/#MAKE#/$make_name/g;
+ $answer =~ s/#PWD#/$pwd/g;
&run_make_with_options($makefile, $options, &get_logfile(0), $err_code);
&compare_output($answer, &get_logfile(1));
diff --git a/tests/scripts/features/recursion b/tests/scripts/features/recursion
index 444f7ce..b9dfd4f 100644
--- a/tests/scripts/features/recursion
+++ b/tests/scripts/features/recursion
@@ -1,61 +1,55 @@
# -*-perl-*-
-$description = "The following test creates a makefile to ...\n";
+$description = "Test recursion.";
$details = "DETAILS";
-open(MAKEFILE,"> $makefile");
-
-# The Contents of the MAKEFILE ...
-
-print MAKEFILE "all: \n"
- ."\t\$(MAKE) -f $makefile foo \n"
- ."foo: \n"
- ."\t\@echo \$(MAKE) \n"
- ."\t\@echo MAKELEVEL = \$(MAKELEVEL)\n"
- ."\t\$(MAKE) -f $makefile last \n"
- ."last: \n"
- ."\t\@echo \$(MAKE) \n"
- ."\t\@echo MAKELEVEL = \$(MAKELEVEL) \n"
- ."\t\@echo THE END\n";
-
-# END of Contents of MAKEFILE
-
-close(MAKEFILE);
-
-if ($vos)
-{
- $answer = "$make_name: Entering directory \`$pwd\'\n"
- ."make 'CFLAGS=-O' -f $makefile foo \n"
- ."make CFLAGS=-O\n"
- ."MAKELEVEL = 0\n"
- ."make 'CFLAGS=-O' -f $makefile last \n"
- ."make CFLAGS=-O\n"
- ."MAKELEVEL = 0\n"
- ."THE END\n"
- ."$make_name: Leaving directory `$pwd'\n";
-}
-else
-{
- $answer = "$make_name: Entering directory `$pwd'\n"
- ."$mkpath -f $makefile foo \n"
- ."${make_name}[1]: Entering directory `$pwd'\n"
- ."$mkpath\n"
- ."MAKELEVEL = 1\n"
- ."$mkpath -f $makefile last \n"
- ."${make_name}[2]: Entering directory `$pwd'\n"
- ."$mkpath\n"
- ."MAKELEVEL = 2\n"
- ."THE END\n"
- ."${make_name}[2]: Leaving directory `$pwd'\n"
- ."${make_name}[1]: Leaving directory `$pwd'\n"
- ."$make_name: Leaving directory `$pwd'\n";
-}
-
-$mkoptions = "CFLAGS=-O -w";
-$mkoptions .= " -j 2" if ($parallel_jobs);
-
-&run_make_with_options($makefile,$mkoptions,&get_logfile,0);
-
-&compare_output($answer,&get_logfile(1));
+# Test some basic recursion.
+run_make_test('
+all:
+ $(MAKE) -f #MAKEFILE# foo
+foo:
+ @echo $(MAKE)
+ @echo MAKELEVEL = $(MAKELEVEL)
+ $(MAKE) -f #MAKEFILE# last
+last:
+ @echo $(MAKE)
+ @echo MAKELEVEL = $(MAKELEVEL)
+ @echo THE END
+',
+ ('CFLAGS=-O -w' . ($parallel_jobs ? '-j 2' : '')),
+ ($vos
+ ? "#MAKE#: Entering directory `#PWD#'
+make 'CFLAGS=-O' -f #MAKEFILE# foo
+make CFLAGS=-O
+MAKELEVEL = 0
+make 'CFLAGS=-O' -f #MAKEFILE# last
+make CFLAGS=-O
+MAKELEVEL = 0
+THE END
+#MAKE#: Leaving directory `#PWD#'"
+ : "#MAKE#: Entering directory `#PWD#'
+#MAKEPATH# -f #MAKEFILE# foo
+#MAKE#[1]: Entering directory `#PWD#'
+#MAKEPATH#
+MAKELEVEL = 1
+#MAKEPATH# -f #MAKEFILE# last
+#MAKE#[2]: Entering directory `#PWD#'
+#MAKEPATH#
+MAKELEVEL = 2
+THE END
+#MAKE#[2]: Leaving directory `#PWD#'
+#MAKE#[1]: Leaving directory `#PWD#'
+#MAKE#: Leaving directory `#PWD#'"));
+
+
+# Test command line overrides.
+run_make_test('
+recur: all ; @$(MAKE) --no-print-directory -f #MAKEFILE# a=AA all
+all: ; @echo "MAKEOVERRIDES = $(MAKEOVERRIDES)"
+',
+ 'a=ZZ',
+ 'MAKEOVERRIDES = a=ZZ
+MAKEOVERRIDES = a=AA
+');
1;