summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-06-25 20:00:24 +0000
committerPaul Smith <psmith@gnu.org>2005-06-25 20:00:24 +0000
commit1dd9ed1c0537cb2583e1de8367994560ad1470aa (patch)
treeb30f0c7714fdf3d7450cf4ddca8a485572ff7631 /tests
parent978819e1d6e9354b5b20d15c875bef98579873ae (diff)
downloadgunmake-1dd9ed1c0537cb2583e1de8367994560ad1470aa.tar.gz
Fix -W foo yielding infinite recursion in some cases of re-exec.
Added a -W test suite.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog2
-rw-r--r--tests/scripts/options/dash-W57
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 90fbf7d..be5169b 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -4,6 +4,8 @@
MAKE_RESTARTS variable.
* scripts/options/dash-B: Test re-exec doesn't loop infinitely.
Tests fix for Savannah bug #7566.
+ * scripts/options/dash-W: New file: test the -W flag, including
+ re-exec infinite looping.
2005-06-12 Paul D. Smith <psmith@gnu.org>
diff --git a/tests/scripts/options/dash-W b/tests/scripts/options/dash-W
new file mode 100644
index 0000000..9a12d9a
--- /dev/null
+++ b/tests/scripts/options/dash-W
@@ -0,0 +1,57 @@
+# -*-perl-*-
+
+$description = "Test make -W (what if) option.\n";
+
+# Basic build
+
+run_make_test('
+a.x: b.x
+a.x b.x: ; touch $@
+',
+ '', "touch b.x\ntouch a.x");
+
+# Run it again: nothing should happen
+
+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');
+
+# 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');
+
+# Clean up
+
+rmfiles('a.x', 'b.x');
+
+# Test -W with the re-exec feature: we don't want to re-exec forever
+# Savannah bug # 7566
+
+# First set it up with a normal build
+
+run_make_test('
+all: baz.x ; @:
+include foo.x
+foo.x: bar.x
+ @echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
+ @echo "touch $@"
+bar.x: ; touch $@
+baz.x: bar.x ; @echo "touch $@"
+',
+ '', '#MAKEFILE#:3: foo.x: No such file or directory
+touch bar.x
+touch foo.x
+restarts=1
+touch baz.x');
+
+# Now run with -W bar.x
+
+run_make_test(undef, '-W bar.x', "restarts=\ntouch foo.x\nrestarts=1\ntouch baz.x");
+
+rmfiles('foo.x', 'bar.x');
+
+1;