diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 20 | ||||
-rw-r--r-- | tests/scripts/features/double_colon | 9 | ||||
-rw-r--r-- | tests/scripts/features/reinvoke | 3 | ||||
-rw-r--r-- | tests/scripts/functions/call | 18 | ||||
-rw-r--r-- | tests/scripts/options/dash-k | 107 |
5 files changed, 113 insertions, 44 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 4d859ad..55e56f8 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,8 +1,28 @@ +2000-03-27 Paul D. Smith <psmith@gnu.org> + + * scripts/features/reinvoke: Make more robust by touching "b" + first, to ensure it's not newer than "a". + Reported by Marco Franzen <Marco.Franzen@Thyron.com>. + + * scripts/functions/call: Whoops. The fix to PR/1527 caused + recursive invocations of $(call ...) to break. I can't come up + with any way to get both working at the same time, so I backed out + the fix to 1527 and added a test case for recursive calls. + + * scripts/features/double_colon: Test that circular dependencies + in double-colon rule sets are detected correctly (PR/1671). + 2000-03-26 Paul D. Smith <psmith@gnu.org> * scripts/targets/INTERMEDIATE: Test that make doesn't remove .INTERMEDIATE files when given on the command line (PR/1669). +2000-03-08 Paul D. Smith <psmith@gnu.org> + + * scripts/options/dash-k: Add a test for error detection by + multiple targets depending on the same prerequisite with -k. + For PR/1634. + 2000-02-07 Paul D. Smith <psmith@gnu.org> * scripts/features/escape: Add a test for backslash-escaped spaces diff --git a/tests/scripts/features/double_colon b/tests/scripts/features/double_colon index 75060c5..e0e53f0 100644 --- a/tests/scripts/features/double_colon +++ b/tests/scripts/features/double_colon @@ -36,6 +36,9 @@ two: ; @echo two f1.h f2.h: ; @echo $@ +d :: ; @echo ok +d :: d ; @echo oops + EOF close(MAKEFILE); @@ -95,6 +98,12 @@ $answer = "f2.h\nfoo SECOND\n"; $answer = "f2.h\nfoo SECOND\n"; &compare_output($answer, &get_logfile(1)); +# TEST 8: Test circular dependency check; PR/1671 + +&run_make_with_options($makefile, "d", &get_logfile, 0); +$answer = "ok\n$make_name: Circular d <- d dependency dropped.\noops\n"; +&compare_output($answer, &get_logfile(1)); + # TEST 8: I don't grok why this is different than the above, but it is... # # Hmm... further testing indicates this might be timing-dependent? diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke index 713580c..dacfd33 100644 --- a/tests/scripts/features/reinvoke +++ b/tests/scripts/features/reinvoke @@ -65,7 +65,8 @@ EOM close(MAKEFILE); -&touch('a','b'); +&touch('b'); +&touch('a'); sleep(2); &touch('c'); diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call index 8b6aa36..bdb8e89 100644 --- a/tests/scripts/functions/call +++ b/tests/scripts/functions/call @@ -26,23 +26,35 @@ my-notdir = $(call notdir,$(1)) my-foreach = $(foreach $(1),$(2),$(3)) my-if = $(if $(1),$(2),$(3)) +# Test recursive invocations of call with different arguments +# +one = $(1) $(2) $(3) +two = $(call one,$(1),foo,$(2)) + + all: ; @echo '$(call reverse,bar,foo)'; \ echo '$(call map,origin,MAKE reverse map)'; \ echo '$(call my-notdir,a/b c/d e/f)'; \ echo '$(call my-foreach)'; \ echo '$(call my-foreach,a,,,)'; \ - echo '$(call my-foreach,a,x y z,$(a)$(a))'; \ echo '$(call my-if,a,b,c)'; \ - echo '$(call my-if,,$(warning don't print this),ok)' + echo '$(call two,bar,baz)' EOMAKE +# These won't work until/unless PR/1527 is resolved. +# echo '$(call my-foreach,a,x y z,$(a)$(a))'; \ +# echo '$(call my-if,,$(warning don't print this),ok)' +# +# $answer = "xx yy zz\nok\n"; + # END of Contents of MAKEFILE close(MAKEFILE); &run_make_with_options($makefile, "", &get_logfile); -$answer = "foo bar\ndefault file file\nb d f\n\n\nxx yy zz\nb\nok\n"; +$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\n"; + &compare_output($answer, &get_logfile(1)); 1; diff --git a/tests/scripts/options/dash-k b/tests/scripts/options/dash-k index a5baaf7..fe5689e 100644 --- a/tests/scripts/options/dash-k +++ b/tests/scripts/options/dash-k @@ -1,36 +1,37 @@ -$description = "The following test creates a makefile to test the -k option.\n" - ."Normally, make gives up immediately if an error happens \n" - ."that make has not been told to ignore. However, if the -k\n" - ."option is specified, make continues to consider the other\n" - ."dependencies of the pending targets."; - -$details = "The makefile created in this test is a simulation of building \n" - ."a small product. However, the trick to this one is that one \n" - ."of the dependencies of the main target does not exist. \n" - ."Without the -k option, make would fail immediately and not \n" - ."build any part of the target. What we are looking for here, \n" - ."is that make builds the rest of the dependencies even though \n" - ."it knows that at the end it will fail to rebuild the main target."; +# -*-perl-*- + +$description = "Test the make -k (don't stop on error) option.\n"; + +$details = "\ +The makefile created in this test is a simulation of building +a small product. However, the trick to this one is that one +of the dependencies of the main target does not exist. +Without the -k option, make would fail immediately and not +build any part of the target. What we are looking for here, +is that make builds the rest of the dependencies even though +it knows that at the end it will fail to rebuild the main target."; open(MAKEFILE,"> $makefile"); # The Contents of the MAKEFILE ... -print MAKEFILE "VPATH = $workdir\n"; -print MAKEFILE "edit: main.o kbd.o commands.o display.o \n"; -print MAKEFILE "\t\@echo cc -o edit main.o kbd.o commands.o display.o \n"; +print MAKEFILE <<EOF; +VPATH = $workdir +edit: main.o kbd.o commands.o display.o +\t\@echo cc -o edit main.o kbd.o commands.o display.o -print MAKEFILE "main.o : main.c defs.h\n"; -print MAKEFILE "\t\@echo cc -c main.c\n"; +main.o : main.c defs.h +\t\@echo cc -c main.c -print MAKEFILE "kbd.o : kbd.c defs.h command.h\n"; -print MAKEFILE "\t\@echo cc -c kbd.c\n"; +kbd.o : kbd.c defs.h command.h +\t\@echo cc -c kbd.c -print MAKEFILE "commands.o : command.c defs.h command.h\n"; -print MAKEFILE "\t\@echo cc -c commands.c\n"; +commands.o : command.c defs.h command.h +\t\@echo cc -c commands.c -print MAKEFILE "display.o : display.c defs.h buffer.h\n"; -print MAKEFILE "\t\@echo cc -c display.c\n"; +display.o : display.c defs.h buffer.h +\t\@echo cc -c display.c +EOF # END of Contents of MAKEFILE @@ -45,29 +46,55 @@ close(MAKEFILE); &touch(@files_to_touch); -if ($vos) -{ - $error_code = 3307; +if ($vos) { + $error_code = 3307; } -else -{ - $error_code = 512; +else { + $error_code = 512; } -&run_make_with_options($makefile,"-k",&get_logfile,$error_code); +&run_make_with_options($makefile, "-k", &get_logfile, $error_code); # Create the answer to what should be produced by this Makefile -$answer = "cc -c main.c\n" - ."$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.\n" - ."cc -c commands.c\n" - ."cc -c display.c\n" - ."$make_name: Target `edit' not remade because of errors.\n"; +$answer = "cc -c main.c +$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'. +cc -c commands.c +cc -c display.c +$make_name: Target `edit' not remade because of errors.\n"; # COMPARE RESULTS -if (&compare_output($answer,&get_logfile(1))) -{ - unlink @files_to_touch; -} +&compare_output($answer, &get_logfile(1)); + +unlink(@files_to_touch) unless $keep; + + +# TEST 1: Make sure that top-level targets that depend on targets that +# previously failed to build, aren't attempted. Regression for PR/1634. + +$makefile2 = &get_tmpfile; + +open(MAKEFILE, "> $makefile2"); +print MAKEFILE <<'EOF'; +.SUFFIXES: + +all: exe1 exe2; @echo making $@ + +exe1 exe2: lib; @echo cp $^ $@ + +lib: foo.o; @echo cp $^ $@ + +foo.o: ; exit 1 +EOF + +close(MAKEFILE); + +&run_make_with_options($makefile2, "-k", &get_logfile, $error_code); + +$answer = "exit 1 +$make_name: *** [foo.o] Error 1 +$make_name: Target `all' not remade because of errors.\n"; + +&compare_output($answer, &get_logfile(1)); 1; |