summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2007-11-04 21:54:00 +0000
committerPaul Smith <psmith@gnu.org>2007-11-04 21:54:00 +0000
commit43d81ff8669c3705ca3c61270af4a5c7218c2fe6 (patch)
treeabaa4fc983ce53dc44d006bb66d76a9e99505329 /tests
parentc1f71b0336fbeb105363a389dec27902ff9f280e (diff)
downloadgunmake-43d81ff8669c3705ca3c61270af4a5c7218c2fe6.tar.gz
New special variable: .RECIPEPREFIX
Allows the user to reset the prefix character for introducing recipe lines from the default (tab) to any other single character, and back again. Also, reworked the manual to consistently use the word "recipe" to describe the set of commands we use to update a target, instead of the various phrases used in the past: "commands", "command lines", "command scripts", etc.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog13
-rw-r--r--tests/scripts/functions/eval2
-rw-r--r--tests/scripts/misc/close_stdout2
-rw-r--r--tests/scripts/variables/special63
-rw-r--r--tests/test_driver.pl16
5 files changed, 90 insertions, 6 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9a515a3..d9a0488 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,16 @@
+2007-11-04 Paul Smith <psmith@gnu.org>
+
+ * scripts/functions/eval: Update error message for command -> recipe.
+
+ * test_driver.pl (compare_output): Allow the answer to be a regex,
+ if surrounded by '/'.
+ * scripts/misc/close_stdout: Use a regex for the answer, since
+ sometimes the error will have a description and sometimes it won't.
+
+2007-09-10 Paul Smith <psmith@gnu.org>
+
+ * scripts/variables/special: Add tests for .RECIPEPREFIX variable.
+
2007-08-15 Paul Smith <psmith@gnu.org>
These test cases were contributed by
diff --git a/tests/scripts/functions/eval b/tests/scripts/functions/eval
index 6f02a7a..90513bd 100644
--- a/tests/scripts/functions/eval
+++ b/tests/scripts/functions/eval
@@ -163,7 +163,7 @@ world');
# See Savannah bug # 12124.
run_make_test('deps: ; $(eval deps: foo)', '',
- '#MAKEFILE#:1: *** prerequisites cannot be defined in command scripts. Stop.',
+ '#MAKEFILE#:1: *** prerequisites cannot be defined in recipes. Stop.',
512);
1;
diff --git a/tests/scripts/misc/close_stdout b/tests/scripts/misc/close_stdout
index 688942e..18606c3 100644
--- a/tests/scripts/misc/close_stdout
+++ b/tests/scripts/misc/close_stdout
@@ -3,7 +3,7 @@
$description = "Make sure make exits with an error if stdout is full.";
if (-e '/dev/full') {
- run_make_test('', '-v > /dev/full', '#MAKE#: write error', 256);
+ run_make_test('', '-v > /dev/full', '/^#MAKE#: write error/', 256);
}
1;
diff --git a/tests/scripts/variables/special b/tests/scripts/variables/special
index 77b355c..a1e15c2 100644
--- a/tests/scripts/variables/special
+++ b/tests/scripts/variables/special
@@ -50,5 +50,68 @@ all:
# $answer = "X1 =\nX2 = all\nLAST = all foo\n";
# &compare_output($answer, &get_logfile(1));
+# Test the .RECIPEPREFIX variable
+&run_make_test('
+define foo
+: foo-one \
+foo-two
+: foo-three
+ : foo-four
+endef
+
+orig: ; : orig-one
+ : orig-two \
+orig-three \
+ orig-four \
+ orig-five \\\\
+ : orig-six
+ $(foo)
+
+.RECIPEPREFIX = >
+test: ; : test-one
+>: test-two \
+test-three \
+>test-four \
+> test-five \\\\
+>: test-six
+>$(foo)
+
+.RECIPEPREFIX =
+reset: ; : reset-one
+ : reset-two \
+reset-three \
+ reset-four \
+ reset-five \\\\
+ : reset-six
+ $(foo)
+',
+ 'orig test reset',
+ ': orig-one
+: orig-two \
+orig-three \
+orig-four \
+ orig-five \\\\
+: orig-six
+: foo-one foo-two
+: foo-three
+: foo-four
+: test-one
+: test-two \
+test-three \
+test-four \
+ test-five \\\\
+: test-six
+: foo-one foo-two
+: foo-three
+: foo-four
+: reset-one
+: reset-two \
+reset-three \
+reset-four \
+ reset-five \\\\
+: reset-six
+: foo-one foo-two
+: foo-three
+: foo-four');
1;
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index bea9816..dd30320 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -661,15 +661,23 @@ sub compare_output
$answer_matched = 1;
} else {
# See if it is a slash or CRLF problem
- local ($answer_mod) = $answer;
+ local ($answer_mod, $slurp_mod) = ($answer, $slurp);
$answer_mod =~ tr,\\,/,;
$answer_mod =~ s,\r\n,\n,gs;
- $slurp =~ tr,\\,/,;
- $slurp =~ s,\r\n,\n,gs;
+ $slurp_mod =~ tr,\\,/,;
+ $slurp_mod =~ s,\r\n,\n,gs;
- $answer_matched = ($slurp eq $answer_mod);
+ $answer_matched = ($slurp_mod eq $answer_mod);
+
+ # If it still doesn't match, see if the answer might be a regex.
+ if (!$answer_matched && $answer =~ m,^/(.+)/$,) {
+ $answer_matched = ($slurp =~ /$1/);
+ if (!$answer_matched && $answer_mod =~ m,^/(.+)/$,) {
+ $answer_matched = ($slurp_mod =~ /$1/);
+ }
+ }
}
if ($answer_matched && $test_passed)