summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/features/escape54
-rw-r--r--tests/scripts/functions/foreach18
-rw-r--r--tests/scripts/functions/origin44
-rw-r--r--tests/scripts/options/symlinks9
-rw-r--r--tests/scripts/variables/automatic19
5 files changed, 67 insertions, 77 deletions
diff --git a/tests/scripts/features/escape b/tests/scripts/features/escape
index 88b372a..97a2994 100644
--- a/tests/scripts/features/escape
+++ b/tests/scripts/features/escape
@@ -6,55 +6,53 @@ Make sure that escaping of `:' works in target names.
Make sure escaping of whitespace works in target names.
Make sure that escaping of '#' works.";
-open(MAKEFILE,"> $makefile");
-
-print MAKEFILE <<'EOF';
-$(path)foo : ; @echo cp $^ $@
-
-foo\ bar: ; @echo 'touch "$@"'
-
-sharp: foo\#bar.ext
-foo\#bar.ext: ; @echo foo\#bar.ext = '$@'
-EOF
close(MAKEFILE);
# TEST 1
-&run_make_with_options($makefile, "", &get_logfile);
-$answer = "cp foo\n";
-&compare_output($answer,&get_logfile(1));
+run_make_test('
+$(path)foo : ; @echo "touch ($@)"
+
+foo\ bar: ; @echo "touch ($@)"
+
+sharp: foo\#bar.ext
+foo\#bar.ext: ; @echo "foo#bar.ext = ($@)"',
+ '',
+ 'touch (foo)');
# TEST 2: This one should fail, since the ":" is unquoted.
-&run_make_with_options($makefile, "path=p:", &get_logfile, 512);
-$answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n";
-&compare_output($answer,&get_logfile(1));
+run_make_test(undef,
+ 'path=pre:',
+ "#MAKEFILE#:2: *** target pattern contains no `%'. Stop.",
+ 512);
# TEST 3: This one should work, since we escape the ":".
-&run_make_with_options($makefile, "'path=p\\:'", &get_logfile, 0);
-$answer = "cp p:foo\n";
-&compare_output($answer,&get_logfile(1));
+run_make_test(undef,
+ "'path=pre\\:'",
+ 'touch (pre:foo)');
# TEST 4: This one should fail, since the escape char is escaped.
-&run_make_with_options($makefile, "'path=p\\\\:'", &get_logfile, 512);
-$answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n";
-&compare_output($answer,&get_logfile(1));
+run_make_test(undef,
+ "'path=pre\\\\:'",
+ "#MAKEFILE#:2: *** target pattern contains no `%'. Stop.",
+ 512);
# TEST 5: This one should work
-&run_make_with_options($makefile, "'foo bar'", &get_logfile, 0);
-$answer = "touch \"foo bar\"\n";
-&compare_output($answer,&get_logfile(1));
+run_make_test(undef,
+ "'foo bar'",
+ 'touch (foo bar)');
# TEST 6: Test escaped comments
-&run_make_with_options($makefile, "sharp", &get_logfile, 0);
-$answer = "foo#bar.ext = foo#bar.ext\n";
-&compare_output($answer,&get_logfile(1));
+run_make_test(undef,
+ 'sharp',
+ 'foo#bar.ext = (foo#bar.ext)');
# This tells the test driver that the perl test script executed properly.
1;
diff --git a/tests/scripts/functions/foreach b/tests/scripts/functions/foreach
index 904c160..9d1c464 100644
--- a/tests/scripts/functions/foreach
+++ b/tests/scripts/functions/foreach
@@ -1,10 +1,7 @@
# -*-perl-*-
+# $Id$
-# Updated 16 June 1993 variable "MAKE" is default was environment override
-# For make 3.63 and above
-
-$description = "The following test creates a makefile to verify
-test the foreach function.";
+$description = "Test the foreach function.";
$details = "This is a test of the foreach function in gnu make.
This function starts with a space separated list of
@@ -16,14 +13,12 @@ types of foreach loops are tested\n";
# TEST 0
-# On WIN32 systems, the user's path is found in %Path% ($Path)
-#
-$pathvar = (($port_type eq 'Windows') ? "Path" : "PATH");
+# Set an environment variable that we can test in the makefile.
+$extraENV{FOOFOO} = 'foo foo';
-run_make_test("
+run_make_test("space = ' '".'
null :=
-space = ' '
-auto_var = udef space CC null $pathvar".' MAKE foo CFLAGS WHITE @ <
+auto_var = udef space CC null FOOFOO MAKE foo CFLAGS WHITE @ <
foo = bletch null @ garf
av = $(foreach var, $(auto_var), $(origin $(var)) )
override WHITE := BLACK
@@ -36,6 +31,7 @@ for2: ; @echo $(fe)',
"undefined file default file environment default file command line override automatic automatic
foo.o bletch.o null.o @.o garf.o .o .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o");
+delete $extraENV{FOOFOO};
# TEST 1: Test that foreach variables take precedence over global
# variables in a global scope (like inside an eval). Tests bug #11913
diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin
index 49e6f38..f7b7eb8 100644
--- a/tests/scripts/functions/origin
+++ b/tests/scripts/functions/origin
@@ -18,34 +18,24 @@ defined per the following list:
# Set an environment variable
$extraENV{MAKETEST} = 1;
-open(MAKEFILE,"> $makefile");
-
-print MAKEFILE <<EOF;
+run_make_test('
foo := bletch garf
-auto_var = udef CC MAKETEST MAKE foo CFLAGS WHITE \@
-av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
+auto_var = undefined CC MAKETEST MAKE foo CFLAGS WHITE @
+av = $(foreach var, $(auto_var), $(origin $(var)) )
override WHITE := BLACK
all: auto
-\t\@echo \$(origin undefined)
-\t\@echo \$(origin CC)
-\t\@echo \$(origin MAKETEST)
-\t\@echo \$(origin MAKE)
-\t\@echo \$(origin foo)
-\t\@echo \$(origin CFLAGS)
-\t\@echo \$(origin WHITE)
-\t\@echo \$(origin \@)
+ @echo $(origin undefined)
+ @echo $(origin CC)
+ @echo $(origin MAKETEST)
+ @echo $(origin MAKE)
+ @echo $(origin foo)
+ @echo $(origin CFLAGS)
+ @echo $(origin WHITE)
+ @echo $(origin @)
auto :
-\t\@echo \$(av)
-EOF
-
-close(MAKEFILE);
-
-&run_make_with_options($makefile,
- "-e WHITE=WHITE CFLAGS=",
- &get_logfile);
-
-# Create the answer to what should be produced by this Makefile
-$answer = "undefined default environment default file command line override automatic
+ @echo $(av)',
+ '-e WHITE=WHITE CFLAGS=',
+ 'undefined default environment default file command line override automatic
undefined
default
environment
@@ -53,9 +43,9 @@ default
file
command line
override
-automatic\n";
-
+automatic');
-&compare_output($answer,&get_logfile(1));
+# Reset an environment variable
+delete $extraENV{MAKETEST};
1;
diff --git a/tests/scripts/options/symlinks b/tests/scripts/options/symlinks
index 70cba3c..40d2564 100644
--- a/tests/scripts/options/symlinks
+++ b/tests/scripts/options/symlinks
@@ -10,7 +10,10 @@ $details = "Verify that symlink handling with and without -L works properly.";
# (in that the symlink() function doesn't fail) but it really doesn't, so
# check for it explicitly.
-if ($port_type ne 'W32' && eval { symlink("",""); 1 }) {
+if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) {
+ # This test is N/A
+ -1;
+} else {
# Set up a symlink sym -> dep
# We'll make both dep and targ older than sym
@@ -60,6 +63,6 @@ if ($port_type ne 'W32' && eval { symlink("",""); 1 }) {
rmfiles('targ', 'sym');
-}
-1;
+ 1;
+}
diff --git a/tests/scripts/variables/automatic b/tests/scripts/variables/automatic
index 847c836..7237fe2 100644
--- a/tests/scripts/variables/automatic
+++ b/tests/scripts/variables/automatic
@@ -95,14 +95,17 @@ mbr.src: ; @:',
# Make sure that nonexistent prerequisites are listed in $?, since they are
# considered reasons for the target to be rebuilt.
#
-touch('foo');
+# This was undone due to Savannah bug #16002. We'll re-do it in the next
+# release. See Savannah bug #16051.
-run_make_test('
-foo: bar ; @echo "\$$? = $?"
-bar: ;',
- '',
- '$? = bar');
-
-unlink('foo');
+#touch('foo');
+#
+#run_make_test('
+#foo: bar ; @echo "\$$? = $?"
+#bar: ;',
+# '',
+# '$? = bar');
+#
+#unlink('foo');
1;