diff options
Diffstat (limited to 'tests/scripts/features')
-rw-r--r-- | tests/scripts/features/patternrules | 2 | ||||
-rw-r--r-- | tests/scripts/features/reinvoke | 69 |
2 files changed, 25 insertions, 46 deletions
diff --git a/tests/scripts/features/patternrules b/tests/scripts/features/patternrules index 0e2f281..c5bdf0a 100644 --- a/tests/scripts/features/patternrules +++ b/tests/scripts/features/patternrules @@ -104,7 +104,7 @@ run_make_test(' .PRECIOUS: %.bar -%.bar:; @touch $@ && false +%.bar:; @touch $@ && exit 1 $(dir)/foo.bar: diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke index a5a475c..9952ced 100644 --- a/tests/scripts/features/reinvoke +++ b/tests/scripts/features/reinvoke @@ -7,44 +7,40 @@ If the makefile or one it includes can be rebuilt then it is, and make is reinvoked. We create a rule to rebuild the makefile from a temp file, then touch the temp file to make it newer than the makefile."; -$makefile2 = &get_tmpfile; -$makefile_orig = &get_tmpfile; +$omkfile = $makefile; -open(MAKEFILE,"> $makefile"); +&utouch(-600, 'incl.mk'); +# For some reason if we don't do this then the test fails for systems +# with sub-second timestamps, maybe + NFS? Not sure. +&utouch(-1, 'incl-1.mk'); -print MAKEFILE <<EOM; +run_make_test(' +all: ; @echo running rules. -all: ; \@echo 'running rules.' +#MAKEFILE# incl.mk: incl-1.mk + @echo rebuilding $@ + @echo >> $@ -$makefile $makefile2: $makefile_orig - \@echo 'rebuilding \$\@.' - \@echo >> \$\@ +include incl.mk', + '', "rebuilding incl.mk\nrunning rules.\n"); -include $makefile2 +# Make sure updating the makefile itself also works -EOM +&utouch(-600, $omkfile); -close(MAKEFILE); +run_make_test(undef, '', "rebuilding #MAKEFILE#\nrunning rules.\n"); -&utouch(-10, $makefile, $makefile2); -&touch($makefile_orig); +&rmfiles('incl.mk', 'incl-1.mk'); -&run_make_with_options($makefile, "", &get_logfile, 0); - -# Create the answer to what should be produced by this Makefile - -$answer = "rebuilding $makefile2.\nrebuilding $makefile.\nrunning rules.\n"; - -&compare_output($answer,&get_logfile(1)) - && unlink "$makefile_orig"; # In this test we create an included file that's out-of-date, but then # the rule doesn't update it. Make shouldn't re-exec. -$makefile3 = &get_tmpfile; +&utouch(-600, 'b','a'); +#&utouch(-10, 'a'); +&touch('c'); -open(MAKEFILE, "> $makefile3"); -print MAKEFILE <<'EOM'; +run_make_test(' SHELL = /bin/sh all: ; @echo hello @@ -55,32 +51,15 @@ b : c ; [ -f $@ ] || echo >> $@ c: ; echo >> $@ -include $(F) -EOM - -close(MAKEFILE); - -&utouch(-20, 'b','a'); -#&utouch(-10, 'a'); -&touch('c'); - -# First try with the file that's not updated "once removed" from the -# file we're including. - -&run_make_with_options($makefile3, "F=a", &get_logfile, 0); - -$answer = "[ -f b ] || echo >> b\nhello\n"; -&compare_output($answer,&get_logfile(1)); +include $(F)', + 'F=a', "[ -f b ] || echo >> b\nhello\n"); # Now try with the file we're not updating being the actual file we're # including: this and the previous one test different parts of the code. -&run_make_with_options($makefile3, "F=b", &get_logfile, 0); - -$answer = "[ -f b ] || echo >> b\nhello\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n") -unlink('a','b','c'); +&rmfiles('a','b','c'); # This tells the test driver that the perl test script executed properly. 1; |