diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 7 | ||||
-rw-r--r-- | tests/scripts/features/patternrules | 2 | ||||
-rw-r--r-- | tests/scripts/features/reinvoke | 69 | ||||
-rw-r--r-- | tests/scripts/options/dash-W | 14 |
4 files changed, 39 insertions, 53 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 9d80d94..a7ceaaa 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,12 @@ 2005-06-27 Paul D. Smith <psmith@gnu.org> + * scripts/options/dash-W: Use 'echo >>' instead of touch to update + files. + * scripts/features/reinvoke: Rewrite to be safer on systems with + subsecond timestamps. + * scripts/features/patternrules: False exits with different error + codes on different systems (for example, Linux => 1, Solaris => 255). + * scripts/options/dash-W: Set the timestamp to foo.x in the future, to be sure it will be considered updated when it's remade. 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; diff --git a/tests/scripts/options/dash-W b/tests/scripts/options/dash-W index 2864711..baa04a5 100644 --- a/tests/scripts/options/dash-W +++ b/tests/scripts/options/dash-W @@ -6,9 +6,9 @@ $description = "Test make -W (what if) option.\n"; run_make_test(' a.x: b.x -a.x b.x: ; touch $@ +a.x b.x: ; echo >> $@ ', - '', "touch b.x\ntouch a.x"); + '', "echo >> b.x\necho >> a.x"); # Run it again: nothing should happen @@ -16,13 +16,13 @@ run_make_test(undef, '', "#MAKE#: `a.x' is up to date."); # Now run it with -W b.x: should rebuild a.x -run_make_test(undef, '-W b.x', 'touch a.x'); +run_make_test(undef, '-W b.x', 'echo >> a.x'); # Put the timestamp for a.x into the future; it should still be remade. utouch(1000, 'a.x'); run_make_test(undef, '', "#MAKE#: `a.x' is up to date."); -run_make_test(undef, '-W b.x', 'touch a.x'); +run_make_test(undef, '-W b.x', 'echo >> a.x'); # Clean up @@ -39,11 +39,11 @@ include foo.x foo.x: bar.x @echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@ @echo "touch $@" -bar.x: ; touch $@ +bar.x: ; echo >> $@ baz.x: bar.x ; @echo "touch $@" ', '', '#MAKEFILE#:3: foo.x: No such file or directory -touch bar.x +echo >> bar.x touch foo.x restarts=1 touch baz.x'); @@ -51,7 +51,7 @@ touch baz.x'); # Now run with -W bar.x # Tweak foo.x's timestamp so the update will change it. -utouch(1000, 'foo.x'); +&utouch(1000, 'foo.x'); run_make_test(undef, '-W bar.x', "restarts=\ntouch foo.x\nrestarts=1\ntouch baz.x"); |