summaryrefslogtreecommitdiff
path: root/tests/scripts/features
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-07-08 13:05:02 +0000
committerPaul Smith <psmith@gnu.org>2002-07-08 13:05:02 +0000
commit724925be2b9a48f7911ee6baa315b872bd86995c (patch)
treecc19b7c671850891cdc4ebde9d33dd897de3a1d2 /tests/scripts/features
parent2f20fc1cc71e0b59e2cd859e927fea6115a30f76 (diff)
downloadgunmake-724925be2b9a48f7911ee6baa315b872bd86995c.tar.gz
Various cleanups reported by people using the alpha release.
Incorporate "order-only" prerequisites patch. Wrote a test for it. The test shows what might be a bug in the code; I need to look at it more closely (anyway it doesn't behave as I expected). Also I haven't done the docs yet.
Diffstat (limited to 'tests/scripts/features')
-rw-r--r--tests/scripts/features/order_only79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only
new file mode 100644
index 0000000..81284c5
--- /dev/null
+++ b/tests/scripts/features/order_only
@@ -0,0 +1,79 @@
+# -*-perl-*-
+$description = "Test order-only prerequisites.";
+
+$details = "\
+Create makefiles with various combinations of normal and order-only
+prerequisites and ensure they behave properly. Test the \$| variable.";
+
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<'EOF';
+foo: bar | baz
+ @echo '$$^ = $^'
+ @echo '$$? = $?'
+ @echo '$$| = $|'
+ touch $@
+
+.PHONY: baz
+
+bar baz:
+ touch $@
+EOF
+
+close(MAKEFILE);
+
+
+# TEST #1 -- just the syntax
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "touch bar\ntouch baz\n\$^ = bar\n\$? = bar\n\$| = baz\ntouch foo\n";
+&compare_output($answer,&get_logfile(1));
+
+
+# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "touch baz\n";
+&compare_output($answer,&get_logfile(1));
+
+unlink(qw(foo bar baz));
+
+# Test prereqs that are both order and non-order
+
+$makefile2 = &get_tmpfile;
+
+open(MAKEFILE,"> $makefile2");
+
+print MAKEFILE <<'EOF';
+foo: bar | baz
+ @echo '$$^ = $^'
+ @echo '$$? = $?'
+ @echo '$$| = $|'
+ touch $@
+
+foo: baz
+
+.PHONY: baz
+
+bar baz:
+ touch $@
+EOF
+
+close(MAKEFILE);
+
+# TEST #3 -- just the syntax
+
+&run_make_with_options($makefile2, "", &get_logfile);
+$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$? = bar baz\n\$| = baz\ntouch foo\n";
+&compare_output($answer,&get_logfile(1));
+
+
+# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
+
+&run_make_with_options($makefile2, "", &get_logfile);
+$answer = "touch baz\$^ = bar baz\n\$? = baz\n\$| = baz\ntouch foo\n";
+&compare_output($answer,&get_logfile(1));
+
+unlink(qw(foo bar baz));
+
+1;