summaryrefslogtreecommitdiff
path: root/tests/scripts/features/reinvoke
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/features/reinvoke')
-rw-r--r--tests/scripts/features/reinvoke69
1 files changed, 24 insertions, 45 deletions
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;