summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/scripts/features/order_only47
-rw-r--r--tests/scripts/variables/automatic50
3 files changed, 98 insertions, 7 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index aa5f78d..fec5186 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2002-07-09 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/variables/automatic: Create a test for automatic variables.
+
+2002-07-08 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/features/order_only: Test new order-only prerequisites.
+
2002-07-07 Paul D. Smith <psmith@gnu.org>
* scripts/functions/eval: Test new function.
diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only
index 81284c5..e324d68 100644
--- a/tests/scripts/features/order_only
+++ b/tests/scripts/features/order_only
@@ -10,7 +10,6 @@ open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
foo: bar | baz
@echo '$$^ = $^'
- @echo '$$? = $?'
@echo '$$| = $|'
touch $@
@@ -26,7 +25,7 @@ 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";
+$answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n";
&compare_output($answer,&get_logfile(1));
@@ -47,7 +46,6 @@ open(MAKEFILE,"> $makefile2");
print MAKEFILE <<'EOF';
foo: bar | baz
@echo '$$^ = $^'
- @echo '$$? = $?'
@echo '$$| = $|'
touch $@
@@ -61,19 +59,54 @@ EOF
close(MAKEFILE);
-# TEST #3 -- just the syntax
+# TEST #3 -- Make sure the order-only prereq was promoted to normal.
&run_make_with_options($makefile2, "", &get_logfile);
-$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$? = bar baz\n\$| = baz\ntouch foo\n";
+$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \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
+# TEST #4 -- now we do it again
&run_make_with_options($makefile2, "", &get_logfile);
-$answer = "touch baz\$^ = bar baz\n\$? = baz\n\$| = baz\ntouch foo\n";
+$answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";
&compare_output($answer,&get_logfile(1));
unlink(qw(foo bar baz));
+# Test empty normal prereqs
+
+$makefile3 = &get_tmpfile;
+
+open(MAKEFILE,"> $makefile3");
+
+print MAKEFILE <<'EOF';
+foo:| baz
+ @echo '$$^ = $^'
+ @echo '$$| = $|'
+ touch $@
+
+.PHONY: baz
+
+baz:
+ touch $@
+EOF
+
+close(MAKEFILE);
+
+# TEST #5 -- make sure the parser was correct.
+
+&run_make_with_options($makefile3, "", &get_logfile);
+$answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n";
+&compare_output($answer,&get_logfile(1));
+
+
+# TEST #6 -- now we do it again: this time foo won't be built
+
+&run_make_with_options($makefile3, "", &get_logfile);
+$answer = "touch baz\n";
+&compare_output($answer,&get_logfile(1));
+
+unlink(qw(foo baz));
+
1;
diff --git a/tests/scripts/variables/automatic b/tests/scripts/variables/automatic
new file mode 100644
index 0000000..b80d478
--- /dev/null
+++ b/tests/scripts/variables/automatic
@@ -0,0 +1,50 @@
+# -*-perl-*-
+
+$description = "Test automatic variable setting.";
+
+$details = "";
+
+use Cwd;
+
+$dir = cwd;
+$dir =~ s,.*/([^/]+)$,../$1,;
+
+open(MAKEFILE, "> $makefile");
+print MAKEFILE "dir = $dir\n";
+print MAKEFILE <<'EOF';
+.SUFFIXES:
+.SUFFIXES: .x .y .z
+$(dir)/foo.x : baz.z $(dir)/bar.y baz.z
+ @echo '$$@ = $@, $$(@D) = $(@D), $$(@F) = $(@F)'
+ @echo '$$* = $*, $$(*D) = $(*D), $$(*F) = $(*F)'
+ @echo '$$< = $<, $$(<D) = $(<D), $$(<F) = $(<F)'
+ @echo '$$^ = $^, $$(^D) = $(^D), $$(^F) = $(^F)'
+ @echo '$$+ = $+, $$(+D) = $(+D), $$(+F) = $(+F)'
+ @echo '$$? = $?, $$(?D) = $(?D), $$(?F) = $(?F)'
+ touch $@
+
+$(dir)/bar.y baz.z : ; touch $@
+EOF
+close(MAKEFILE);
+
+# TEST #1 -- simple test
+# -------
+
+&touch(qw(foo.x baz.z));
+
+sleep(1);
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "touch $dir/bar.y
+\$\@ = $dir/foo.x, \$(\@D) = $dir, \$(\@F) = foo.x
+\$* = $dir/foo, \$(*D) = $dir, \$(*F) = foo
+\$< = baz.z, \$(<D) = ., \$(<F) = baz.z
+\$^ = baz.z $dir/bar.y, \$(^D) = . $dir, \$(^F) = baz.z bar.y
+\$+ = baz.z $dir/bar.y baz.z, \$(+D) = . $dir ., \$(+F) = baz.z bar.y baz.z
+\$? = $dir/bar.y, \$(?D) = $dir, \$(?F) = bar.y
+touch $dir/foo.x\n";
+&compare_output($answer, &get_logfile(1));
+
+unlink(qw(foo.x bar.y baz.z));
+
+1;