summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-08-08 00:11:19 +0000
committerPaul Smith <psmith@gnu.org>2002-08-08 00:11:19 +0000
commitf2ceb0d68aa780e57641e50d972fac3b6e70bd58 (patch)
tree73853f27fe9a08b2ba2938057f1f3ccc51597d06 /tests
parentbccb277dda1a4dcc6729824a7c9d544086f147c3 (diff)
downloadgunmake-f2ceb0d68aa780e57641e50d972fac3b6e70bd58.tar.gz
Incorporate some VMS fixes.
Add -B option docs. Add .VARIABLES variable. Add a few new tests. Add a new translation: Swedish
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog13
-rw-r--r--tests/scripts/misc/general319
-rw-r--r--tests/scripts/options/dash-B43
-rw-r--r--tests/scripts/variables/special68
4 files changed, 140 insertions, 3 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 2dc997f..387c08f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,16 @@
+2002-08-07 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/misc/general3: Add a test for makefiles that don't end
+ in newlines.
+
+ * scripts/variables/special: Create tests for the special
+ variables (.VARIABLES and .TARGETS). Comment out .TARGETS test
+ for now as it's not yet supported.
+
+2002-08-01 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/options/dash-B: Add a test for the new -B option.
+
2002-07-11 Paul D. Smith <psmith@gnu.org>
* run_make_tests.pl (valid_option): Add support for Valgrind
diff --git a/tests/scripts/misc/general3 b/tests/scripts/misc/general3
index a265f71..2421ed4 100644
--- a/tests/scripts/misc/general3
+++ b/tests/scripts/misc/general3
@@ -5,12 +5,14 @@ This tests random features of the parser that need to be supported, and
which have either broken at some point in the past or seem likely to
break.";
+$makefile2 = &get_tmpfile;
+
open(MAKEFILE,"> $makefile");
# The contents of the Makefile ...
print MAKEFILE <<EOF;
-\# We want to allow both empty commands _and_ commands that resolve to empty.
+# We want to allow both empty commands _and_ commands that resolve to empty.
EMPTY =
.PHONY: all a1 a2 a3 a4
@@ -36,10 +38,21 @@ EOF
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
-
-# Create the answer to what should be produced by this Makefile
$answer = "$make_name: Nothing to be done for `all'.\n";
+&compare_output($answer,&get_logfile(1));
+
+
+# TEST 2
+# Make sure files without trailing newlines are handled properly.
+
+open(MAKEFILE, "> $makefile2");
+print MAKEFILE "all:;\@echo FOO = \$(FOO)\nFOO = foo";
+close(MAKEFILE);
+
+&run_make_with_options($makefile2,"",&get_logfile);
+$answer = "FOO = foo\n";
&compare_output($answer,&get_logfile(1));
+
1;
diff --git a/tests/scripts/options/dash-B b/tests/scripts/options/dash-B
new file mode 100644
index 0000000..94932e5
--- /dev/null
+++ b/tests/scripts/options/dash-B
@@ -0,0 +1,43 @@
+# -*-perl-*-
+
+$description = "Test make -B (always remake) option.\n";
+
+$details = "\
+Construct a simple makefile that builds a target.
+Invoke make once, so it builds everything. Invoke it again and verify
+that nothing is built. Then invoke it with -B and verify that everything
+is built again.";
+
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<'EOF';
+.SUFFIXES:
+
+.PHONY: all
+all: foo
+
+foo: bar.x
+ @echo cp $< $@
+ @touch $@
+EOF
+
+close(MAKEFILE);
+
+
+&touch('bar.x');
+
+&run_make_with_options($makefile, '', &get_logfile);
+$answer = "cp bar.x foo\n";
+&compare_output($answer, &get_logfile(1));
+
+&run_make_with_options($makefile, '', &get_logfile);
+$answer = "$make_name: Nothing to be done for `all'.\n";
+&compare_output($answer, &get_logfile(1));
+
+&run_make_with_options($makefile, '-B', &get_logfile);
+$answer = "cp bar.x foo\n";
+&compare_output($answer, &get_logfile(1));
+
+unlink('bar.x', 'foo') unless $keep;
+
+1;
diff --git a/tests/scripts/variables/special b/tests/scripts/variables/special
new file mode 100644
index 0000000..58c8655
--- /dev/null
+++ b/tests/scripts/variables/special
@@ -0,0 +1,68 @@
+# -*-perl-*-
+
+$description = "Test special GNU make variables.";
+
+$details = "";
+
+$makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE, "> $makefile");
+
+print MAKEFILE <<'EOF';
+
+X1 := $(sort $(filter FOO BAR,$(.VARIABLES)))
+
+FOO := foo
+
+X2 := $(sort $(filter FOO BAR,$(.VARIABLES)))
+
+BAR := bar
+
+all:
+ @echo X1 = $(X1)
+ @echo X2 = $(X2)
+ @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES)))
+
+EOF
+
+close(MAKEFILE);
+
+# TEST #1
+# -------
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "X1 =\nX2 = FOO\nLAST = BAR FOO\n";
+&compare_output($answer, &get_logfile(1));
+
+
+
+
+# open(MAKEFILE, "> $makefile2");
+
+# print MAKEFILE <<'EOF';
+
+# X1 := $(sort $(.TARGETS))
+
+# all: foo
+# @echo X1 = $(X1)
+# @echo X2 = $(X2)
+# @echo LAST = $(sort $(.TARGETS))
+
+# X2 := $(sort $(.TARGETS))
+
+# foo:
+
+# EOF
+
+# close(MAKEFILE);
+
+# # TEST #2
+# # -------
+
+# &run_make_with_options($makefile2, "", &get_logfile);
+# $answer = "X1 =\nX2 = all\nLAST = all foo\n";
+# &compare_output($answer, &get_logfile(1));
+
+
+1;