summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/ChangeLog.12
-rw-r--r--tests/NEWS2
-rw-r--r--tests/README2
-rwxr-xr-xtests/config_flags_pm.com2
-rwxr-xr-xtests/mkshadow2
-rwxr-xr-xtests/run_make_tests.com8
-rw-r--r--tests/run_make_tests.pl23
-rw-r--r--tests/scripts/features/archives180
-rw-r--r--tests/scripts/features/conditionals16
-rw-r--r--tests/scripts/features/double_colon60
-rw-r--r--tests/scripts/features/errors22
-rw-r--r--tests/scripts/features/include64
-rw-r--r--tests/scripts/features/jobserver52
-rw-r--r--tests/scripts/features/load2
-rw-r--r--tests/scripts/features/output-sync26
-rw-r--r--tests/scripts/features/parallelism13
-rw-r--r--tests/scripts/features/patternrules7
-rw-r--r--tests/scripts/features/vpath38
-rw-r--r--tests/scripts/features/vpathplus7
-rw-r--r--tests/scripts/functions/call54
-rw-r--r--tests/scripts/functions/error10
-rw-r--r--tests/scripts/functions/file43
-rw-r--r--tests/scripts/functions/foreach24
-rw-r--r--tests/scripts/functions/shell32
-rw-r--r--tests/scripts/functions/sort22
-rw-r--r--tests/scripts/functions/warning30
-rw-r--r--tests/scripts/misc/bs-nl98
-rw-r--r--tests/scripts/misc/fopen-fail5
-rw-r--r--tests/scripts/misc/general32
-rw-r--r--tests/scripts/options/dash-B6
-rw-r--r--tests/scripts/options/dash-W7
-rw-r--r--tests/scripts/options/dash-k5
-rw-r--r--tests/scripts/options/dash-n2
-rw-r--r--tests/scripts/options/dash-q9
-rw-r--r--tests/scripts/options/print-directory4
-rw-r--r--tests/scripts/targets/DELETE_ON_ERROR22
-rw-r--r--tests/scripts/targets/POSIX3
-rw-r--r--tests/scripts/variables/MAKEFLAGS4
-rw-r--r--tests/scripts/variables/MAKE_RESTARTS9
-rw-r--r--tests/scripts/variables/SHELL3
-rw-r--r--tests/scripts/variables/special22
-rw-r--r--tests/scripts/vms/library73
-rw-r--r--tests/test_driver.pl2
44 files changed, 825 insertions, 166 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 00000000..a30a6895
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,2 @@
+config-flags.pm
+work
diff --git a/tests/ChangeLog.1 b/tests/ChangeLog.1
index 9abe731c..684af03d 100644
--- a/tests/ChangeLog.1
+++ b/tests/ChangeLog.1
@@ -1413,7 +1413,7 @@
ChangeLog file for the test suite created.
-Copyright (C) 1992-2014 Free Software Foundation, Inc.
+Copyright (C) 1992-2016 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
diff --git a/tests/NEWS b/tests/NEWS
index 584f4a4f..f55e4ba8 100644
--- a/tests/NEWS
+++ b/tests/NEWS
@@ -162,7 +162,7 @@ Changes from 0.1 to 0.2 (5-4-92):
-------------------------------------------------------------------------------
-Copyright (C) 1992-2014 Free Software Foundation, Inc.
+Copyright (C) 1992-2016 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
diff --git a/tests/README b/tests/README
index 3b699eec..0213159f 100644
--- a/tests/README
+++ b/tests/README
@@ -7,7 +7,7 @@ This entire test suite, including all test files, are copyright and
distributed under the following terms:
-----------------------------------------------------------------------------
- Copyright (C) 1992-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2016 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
diff --git a/tests/config_flags_pm.com b/tests/config_flags_pm.com
index 3f5adffe..a4271b61 100755
--- a/tests/config_flags_pm.com
+++ b/tests/config_flags_pm.com
@@ -3,7 +3,7 @@ $! config_flags_pm.com - Build config-flags.pm on VMS.
$!
$! Just good enough to run the self tests for now.
$!
-$! Copyright (C) 2014 Free Software Foundation, Inc.
+$! Copyright (C) 2014-2016 Free Software Foundation, Inc.
$! This file is part of GNU Make.
$!
$! GNU Make is free software; you can redistribute it and/or modify it under
diff --git a/tests/mkshadow b/tests/mkshadow
index aa9b3bcd..23c7ab0c 100755
--- a/tests/mkshadow
+++ b/tests/mkshadow
@@ -3,7 +3,7 @@
# Simple script to make a "shadow" test directory, using symbolic links.
# Typically you'd put the shadow in /tmp or another local disk
#
-# Copyright (C) 1992-2014 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
diff --git a/tests/run_make_tests.com b/tests/run_make_tests.com
index 2f17f7f5..de79a91c 100755
--- a/tests/run_make_tests.com
+++ b/tests/run_make_tests.com
@@ -4,7 +4,7 @@ $! This is a wrapper for the GNU make perl test programs on VMS.
$!
$! Parameter "-help" for description on how to use described below.
$!
-$! Copyright (C) 2014 Free Software Foundation, Inc.
+$! Copyright (C) 2014-2016 Free Software Foundation, Inc.
$! This file is part of GNU Make.
$!
$! GNU Make is free software; you can redistribute it and/or modify it under
@@ -238,18 +238,18 @@ $!
$ if no_gnv .or. no_perl then exit 44
$!
$!
-$ make := $bin:make.exe
$ default = f$environment("DEFAULT")
+$ default_dev = f$element(0, ":", default) + ":"
$ this = f$environment("PROCEDURE")
$ on error then goto all_error
-$ set default 'f$parse(this,,,"DEVICE")''f$parse(this,,,"DIRECTORY")'
+$ set default 'default_dev''f$parse(this,,,"DIRECTORY")'
$!
$! Need to make sure that the config-flags.pm exists.
$ if f$search("config-flags.pm") .eqs. ""
$ then
$ @config_flags_pm.com
$ endif
-$ define/user bin 'default',gnv$gnu:[bin]
+$ define/user bin 'default_dev'[-],gnv$gnu:[bin]
$ define/user decc$filename_unix_noversion enable
$ define/user decc$filename_unix_report enable
$ define/user decc$readdir_dropdotnotype enable
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 9468faba..916f3467 100644
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -11,7 +11,7 @@
# [-make <make prog>]
# (and others)
-# Copyright (C) 1992-2014 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
@@ -140,6 +140,7 @@ sub subst_make_string
sub run_make_test
{
local ($makestring, $options, $answer, $err_code, $timeout) = @_;
+ my @call = caller;
# If the user specified a makefile string, create a new makefile to contain
# it. If the first value is not defined, use the last one (if there is
@@ -171,7 +172,7 @@ sub run_make_test
}
run_make_with_options($makefile, $options, &get_logfile(0),
- $err_code, $timeout);
+ $err_code, $timeout, @call);
&compare_output($answer, &get_logfile(1));
$old_makefile = $makefile;
@@ -180,7 +181,8 @@ sub run_make_test
# The old-fashioned way...
sub run_make_with_options {
- local ($filename,$options,$logname,$expected_code,$timeout) = @_;
+ my ($filename,$options,$logname,$expected_code,$timeout,@call) = @_;
+ @call = caller unless @call;
local($code);
local($command) = $make_path;
@@ -231,7 +233,11 @@ sub run_make_with_options {
$command .= " $options";
}
- $command_string = "$command\n";
+ $command_string = "";
+ if (@call) {
+ $command_string = "#$call[1]:$call[2]\n";
+ }
+ $command_string .= "$command\n";
if ($valgrind) {
print VALGRIND "\n\nExecuting: $command\n";
@@ -359,6 +365,12 @@ sub set_more_defaults
elsif ($osname =~ m%OS/2%) {
$port_type = 'OS/2';
}
+
+ # VMS has a GNV Unix mode or a DCL mode.
+ # The SHELL environment variable should not be defined in VMS-DCL mode.
+ elsif ($osname eq 'VMS' && !defined $ENV{"SHELL"}) {
+ $port_type = 'VMS-DCL';
+ }
# Everything else, right now, is UNIX. Note that we should integrate
# the VOS support into this as well and get rid of $vos; we'll do
# that next time.
@@ -377,6 +389,7 @@ sub set_more_defaults
# Find the full pathname of Make. For DOS systems this is more
# complicated, so we ask make itself.
if ($osname eq 'VMS') {
+ $port_type = 'VMS-DCL' unless defined $ENV{"SHELL"};
# On VMS pre-setup make to be found with simply 'make'.
$make_path = 'make';
} else {
@@ -458,6 +471,8 @@ sub set_more_defaults
# Set up for valgrind, if requested.
+ $make_command = $make_path;
+
if ($valgrind) {
my $args = $valgrind_args;
open(VALGRIND, "> valgrind.out")
diff --git a/tests/scripts/features/archives b/tests/scripts/features/archives
index b0acfecb..a064dd44 100644
--- a/tests/scripts/features/archives
+++ b/tests/scripts/features/archives
@@ -9,89 +9,205 @@ This only works on systems that support it.";
exists $FEATURES{archives} or return -1;
# Create some .o files to work with
-utouch(-60, qw(a1.o a2.o a3.o));
+if ($osname eq 'VMS') {
+ use Cwd;
+ my $pwd = getcwd;
+ # VMS AR needs real object files at this time.
+ foreach $afile ('a1', 'a2', 'a3') {
+ # Use non-standard extension to prevent implicit rules from recreating
+ # objects when the test tampers with the timestamp.
+ 1 while unlink "$afile.c1";
+ 1 while unlink "$afile.o";
+ open (MYFILE, ">$afile.c1");
+ print MYFILE "int $afile(void) {return 1;}\n";
+ close MYFILE;
+ system("cc $afile.c1 /object=$afile.o");
+ }
+} else {
+ utouch(-60, qw(a1.o a2.o a3.o));
+}
my $ar = $CONFIG_FLAGS{AR};
+# Fallback if configure did not find AR, such as VMS
+# which does not run configure.
+$ar = 'ar' if $ar eq '';
+
+my $redir = '2>&1';
+$redir = '' if $osname eq 'VMS';
+
+my $arflags = 'rv';
+my $arvar = "AR=$ar";
+
+# Newer versions of binutils can be built with --enable-deterministic-archives
+# which forces all timestamps (among other things) to always be 0, defeating
+# GNU make's archive support. See if ar supports the U option to disable it.
+unlink('libxx.a');
+$_ = `$ar U$arflags libxx.a a1.o $redir`;
+if ($? == 0) {
+ $arflags = 'Urv';
+ $arvar = "$arvar ARFLAGS=$arflags";
+}
+
# Some versions of ar print different things on creation. Find out.
-my $created = `$ar rv libxx.a a1.o 2>&1`;
+unlink('libxx.a');
+my $created = `$ar $arflags libxx.a a1.o $redir`;
# Some versions of ar print different things on add. Find out.
-my $add = `$ar rv libxx.a a2.o 2>&1`;
+my $add = `$ar $arflags libxx.a a2.o $redir`;
$add =~ s/a2\.o/#OBJECT#/g;
# Some versions of ar print different things on replacement. Find out.
-my $repl = `$ar rv libxx.a a2.o 2>&1`;
+my $repl = `$ar $arflags libxx.a a2.o $redir`;
$repl =~ s/a2\.o/#OBJECT#/g;
unlink('libxx.a');
# Very simple
-run_make_test('all: libxx.a(a1.o)',
- '', "$ar rv libxx.a a1.o\n$created");
+my $answer = "$ar $arflags libxx.a a1.o\n$created";
+if ($port_type eq 'VMS-DCL') {
+ $answer = 'library /replace libxx.a a1.o';
+}
+run_make_test('all: libxx.a(a1.o)', $arvar, $answer);
# Multiple .o's. Add a new one to the existing library
($_ = $add) =~ s/#OBJECT#/a2.o/g;
-run_make_test('all: libxx.a(a1.o a2.o)',
- '', "$ar rv libxx.a a2.o\n$_");
+
+$answer = "$ar $arflags libxx.a a2.o\n$_";
+if ($port_type eq 'VMS-DCL') {
+ $answer = 'library /replace libxx.a a2.o';
+}
+run_make_test('all: libxx.a(a1.o a2.o)', $arvar, $answer);
# Touch one of the .o's so it's rebuilt
-utouch(-40, 'a1.o');
+if ($port_type eq 'VMS-DCL') {
+ # utouch is not changing what VMS library compare is testing for.
+ # So do a real change by regenerating the file.
+ 1 while unlink('a1.o');
+ # Later time stamp than last insertion.
+ sleep(2);
+ system('cc a1.c1 /object=a1.o');
+ # Next insertion will have a later timestamp.
+ sleep(2);
+} else {
+ utouch(-40, 'a1.o');
+}
+
($_ = $repl) =~ s/#OBJECT#/a1.o/g;
-run_make_test(undef, '', "$ar rv libxx.a a1.o\n$_");
+$answer = "$ar $arflags libxx.a a1.o\n$_";
+if ($port_type eq 'VMS-DCL') {
+ $answer = 'library /replace libxx.a a1.o';
+}
+run_make_test(undef, $arvar, $answer);
# Use wildcards
-run_make_test('all: libxx.a(*.o)',
- '', "#MAKE#: Nothing to be done for 'all'.\n");
+$answer = "#MAKE#: Nothing to be done for 'all'.\n";
+run_make_test('all: libxx.a(*.o)', $arvar, $answer);
# Touch one of the .o's so it's rebuilt
-utouch(-30, 'a1.o');
+if ($port_type eq 'VMS-DCL') {
+ # utouch is not changing what VMS library compare is testing for.
+ # So do a real change by regenerating the file.
+ 1 while unlink('a1.o');
+ # Make timestamp later than last insertion.
+ sleep(2);
+ system('cc a1.c1 /object=a1.o');
+} else {
+ utouch(-30, 'a1.o');
+}
($_ = $repl) =~ s/#OBJECT#/a1.o/g;
-run_make_test(undef, '', "$ar rv libxx.a a1.o\n$_");
+$answer = "$ar $arflags libxx.a a1.o\n$_";
+if ($port_type eq 'VMS-DCL') {
+ $answer = 'library /replace libxx.a a1.o';
+}
+run_make_test(undef, $arvar, $answer);
# Use both wildcards and simple names
-utouch(-50, 'a2.o');
+if ($port_type eq 'VMS-DCL') {
+ # utouch is not changing what VMS library compare is testing for.
+ # So do a real change by regenerating the file.
+ 1 while unlink('a2.o');
+ sleep(2);
+ system('cc a2.c1 /object=a2.o');
+} else {
+ utouch(-50, 'a2.o');
+}
($_ = $add) =~ s/#OBJECT#/a3.o/g;
-$_ .= "$ar rv libxx.a a2.o\n";
+$_ .= "$ar $arflags libxx.a a2.o\n";
($_ .= $repl) =~ s/#OBJECT#/a2.o/g;
-run_make_test('all: libxx.a(a3.o *.o)', '',
- "$ar rv libxx.a a3.o\n$_");
+$answer = "$ar $arflags libxx.a a3.o\n$_";
+if ($port_type eq 'VMS-DCL') {
+ $answer = 'library /replace libxx.a a3.o';
+}
+
+run_make_test('all: libxx.a(a3.o *.o)', $arvar, $answer);
# Check whitespace handling
-utouch(-40, 'a2.o');
+if ($port_type eq 'VMS-DCL') {
+ # utouch is not changing what VMS library compare is testing for.
+ # So do a real change by regenerating the file.
+ 1 while unlink('a2.o');
+ sleep(2);
+ system('cc a2.c1 /object=a2.o');
+} else {
+ utouch(-40, 'a2.o');
+}
($_ = $repl) =~ s/#OBJECT#/a2.o/g;
-run_make_test('all: libxx.a( a3.o *.o )', '',
- "$ar rv libxx.a a2.o\n$_");
+$answer = "$ar $arflags libxx.a a2.o\n$_";
+if ($port_type eq 'VMS-DCL') {
+ $answer = 'library /replace libxx.a a2.o';
+}
+run_make_test('all: libxx.a( a3.o *.o )', $arvar, $answer);
-rmfiles(qw(a1.o a2.o a3.o libxx.a));
+rmfiles(qw(a1.c1 a2.c1 a3.c1 a1.o a2.o a3.o libxx.a));
# Check non-archive targets
# See Savannah bug #37878
-run_make_test(q!
+$mk_string = q!
all: foo(bar).baz
foo(bar).baz: ; @echo '$@'
-!,
- '', "foo(bar).baz\n");
+!;
+
+if ($port_type eq 'VMS-DCL') {
+ $mk_string =~ s/echo/write sys\$\$output/;
+ $mk_string =~ s/\'/\"/g;
+}
+run_make_test($mk_string, $arvar, "foo(bar).baz\n");
# Check renaming of archive targets.
# See Savannah bug #38442
mkdir('artest', 0777);
touch('foo.vhd');
-
-run_make_test(q!
+$mk_string = q!
DIR = artest
vpath % $(DIR)
default: lib(foo)
(%): %.vhd ; @cd $(DIR) && touch $(*F) && $(AR) $(ARFLAGS) $@ $(*F) >/dev/null 2>&1 && rm $(*F)
.PHONY: default
-!,
- '', "");
-
-run_make_test(undef, '', "#MAKE#: Nothing to be done for 'default'.\n");
+!;
+if ($port_type eq 'VMS-DCL') {
+ $mk_string =~ s#= artest#= sys\$\$disk:\[.artest\]#;
+ $mk_string =~ s#lib\(foo\)#lib.tlb\(foo\)#;
+ $mk_string =~ s#; \@cd#; pipe SET DEFAULT#;
+ $mk_string =~
+ s#touch \$\(\*F\)#touch \$\(\*F\) && library/create/text sys\$\$disk:\$\@#;
+ $mk_string =~
+ s#library#if f\$\$search(\"\$\@\") \.eqs\. \"\" then library#;
+ # VMS needs special handling for null extension
+ $mk_string =~ s#\@ \$\(\*F\)#\@ \$\(\*F\)\.#;
+ $mk_string =~ s#>/dev/null 2>&1 ##;
+}
+run_make_test($mk_string, $arvar, "");
+
+run_make_test(undef, $arvar, "#MAKE#: Nothing to be done for 'default'.\n");
unlink('foo.vhd');
-remove_directory_tree('artest');
+if ($osname eq 'VMS') {
+ remove_directory_tree("$pwd/artest");
+} else {
+ remove_directory_tree('artest');
+}
# This tells the test driver that the perl test script executed properly.
1;
diff --git a/tests/scripts/features/conditionals b/tests/scripts/features/conditionals
index 2ece60bb..78344b93 100644
--- a/tests/scripts/features/conditionals
+++ b/tests/scripts/features/conditionals
@@ -141,6 +141,22 @@ all: ; @:',
'',
'success');
+# SV 47960 : ensure variable assignments in non-taken legs don't cause problems
+run_make_test('
+ifneq ($(FOO),yes)
+target:
+else
+BAR = bar
+target:
+endif
+ @echo one
+',
+ '', "one\n");
+
# This tells the test driver that the perl test script executed properly.
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/features/double_colon b/tests/scripts/features/double_colon
index 1097775b..58f126f6 100644
--- a/tests/scripts/features/double_colon
+++ b/tests/scripts/features/double_colon
@@ -151,8 +151,7 @@ two');
unlink('result','one','two');
-# TEST 10: check for proper backslash handling
-# Savannah bug #33399
+# TEST 10: SV 33399 : check for proper backslash handling
run_make_test('
a\ xb :: ; @echo one
@@ -160,5 +159,62 @@ a\ xb :: ; @echo two
',
'', "one\ntwo\n");
+# Test 11: SV 44742 : All double-colon rules should be run in parallel build.
+
+run_make_test('result :: 01
+ @echo update
+ @touch $@
+result :: 02
+ @echo update
+ @touch $@
+result :: 03
+ @echo update
+ @touch $@
+result :: 04
+ @echo update
+ @touch $@
+result :: 05
+ @echo update
+ @touch $@
+01 02 03 04 05:
+ @touch 01 02 03 04 05
+',
+ '-j10 result', "update\nupdate\nupdate\nupdate\nupdate\n");
+
+unlink('result', '01', '02', '03', '04', '05');
+
+# Test 12: SV 44742 : Double-colon rules with parallelism
+
+run_make_test('
+root: all
+ echo root
+all::
+ echo all_one
+all:: 3
+ echo all_two
+%:
+ sleep $*
+',
+ '-rs -j2 1 2 root', "all_one\nall_two\nroot\n");
+
+# SV 47995 : Parallel double-colon rules with FORCE
+
+run_make_test('
+all:: ; @echo one
+
+all:: joe ; @echo four
+
+joe: FORCE ; touch joe-is-forced
+
+FORCE:
+',
+ '-j5', "one\ntouch joe-is-forced\nfour\n");
+
+unlink('joe-is-forced');
+
# This tells the test driver that the perl test script executed properly.
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/features/errors b/tests/scripts/features/errors
index c0339cb6..ebd43831 100644
--- a/tests/scripts/features/errors
+++ b/tests/scripts/features/errors
@@ -30,7 +30,7 @@ open(MAKEFILE,"> $makefile");
print MAKEFILE "clean:\n"
."\t-$rm_command cleanit\n"
."\t$rm_command foo\n"
- ."clean2: \n"
+ ."clean2: \n"
."\t$rm_command cleanit\n"
."\t$rm_command foo\n";
@@ -50,8 +50,7 @@ $delete_error_code = $? >> 8;
$answer = "$rm_command cleanit
$cleanit_error
-$makefile:2: recipe for target 'clean' failed
-$make_name: [clean] Error $delete_error_code (ignored)
+$make_name: [$makefile:2: clean] Error $delete_error_code (ignored)
$rm_command foo\n";
&run_make_with_options($makefile,"",&get_logfile);
@@ -78,8 +77,7 @@ if (!$vos)
$answer = "$rm_command cleanit
$cleanit_error
-$makefile:5: recipe for target 'clean2' failed
-$make_name: [clean2] Error $delete_error_code (ignored)
+$make_name: [$makefile:5: clean2] Error $delete_error_code (ignored)
$rm_command foo\n";
&run_make_with_options($makefile,"clean2 -i",&get_logfile);
@@ -92,4 +90,18 @@ if (!$vos) {
&compare_output($answer,&get_logfile(1));
}
+# Test that error line offset works
+
+run_make_test(q!
+all:
+ @echo hi
+ @echo there
+ @exit 1
+!,
+ '', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512);
+
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/features/include b/tests/scripts/features/include
index ee014bd8..f78563f9 100644
--- a/tests/scripts/features/include
+++ b/tests/scripts/features/include
@@ -165,6 +165,70 @@ baz: end
#MAKE#: *** No rule to make target 'end', needed by 'baz'. Stop.\n",
512);
+# Test include of make-able file doesn't show an error (Savannah #102)
+run_make_test(q!
+.PHONY: default
+default:; @echo DONE
+
+inc1:; echo > $@
+include inc1
+include inc2
+inc2:; echo > $@
+!,
+ '', "echo > inc2\necho > inc1\nDONE\n");
+
+rmfiles('inc1', 'inc2');
+
+# Test include of non-make-able file does show an error (Savannah #102)
+run_make_test(q!
+.PHONY: default
+default:; @echo DONE
+
+inc1:; echo > $@
+include inc1
+include inc2
+!,
+ '', "#MAKEFILE#:7: inc2: No such file or directory\n#MAKE#: *** No rule to make target 'inc2'. Stop.\n", 512);
+
+rmfiles('inc1');
+
+# Include same file multiple times
+
+run_make_test(q!
+default:; @echo DEFAULT
+include inc1
+inc1:; echo > $@
+include inc1
+!,
+ '', "echo > inc1\nDEFAULT\n");
+
+rmfiles('inc1');
+
+# Included file has a prerequisite that fails to build
+
+run_make_test(q!
+default:; @echo DEFAULT
+include inc1
+inc1: foo; echo > $@
+foo:; exit 1
+!,
+ '', "exit 1\n#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** [#MAKEFILE#:5: foo] Error 1\n", 512);
+
+rmfiles('inc1');
+
+# Included file has a prerequisite we don't know how to build
+
+run_make_test(q!
+default:; @echo DEFAULT
+include inc1
+inc1: foo; echo > $@
+!,
+ '', "#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** No rule to make target 'foo', needed by 'inc1'. Stop.\n", 512);
+
+rmfiles('inc1');
+
+# include a directory
+
if ($all_tests) {
# Test that include of a rebuild-able file doesn't show a warning
# Savannah bug #102
diff --git a/tests/scripts/features/jobserver b/tests/scripts/features/jobserver
index cedd4b34..7da4a654 100644
--- a/tests/scripts/features/jobserver
+++ b/tests/scripts/features/jobserver
@@ -12,7 +12,49 @@ if (!$parallel_jobs) {
return -1;
}
-# Don't put --jobserver-fds into a re-exec'd MAKEFLAGS.
+# Shorthand
+my $np = '--no-print-directory';
+
+# Simple test of MAKEFLAGS settings
+run_make_test(q!
+SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
+recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
+all:;@echo $@: "/$(SHOW)/"
+!,
+ "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
+
+# Setting parallelism with the environment
+# Command line should take precedence over the environment
+$extraENV{MAKEFLAGS} = "-j2 $np";
+run_make_test(q!
+SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
+recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
+all:;@echo $@: "/$(SHOW)/"
+!,
+ '', "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
+delete $extraENV{MAKEFLAGS};
+
+# Test override of -jN
+$extraENV{MAKEFLAGS} = "-j9 $np";
+run_make_test(q!
+SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
+recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j3 -f #MAKEFILE# recurse2
+recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
+all:;@echo $@: "/$(SHOW)/"
+!,
+ "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nrecurse2: /-j3 --jobserver-auth=<auth> $np/\nall: /-j3 --jobserver-auth=<auth> $np/\n");
+delete $extraENV{MAKEFLAGS};
+
+# Test override of -jN with -j
+run_make_test(q!
+SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
+recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j -f #MAKEFILE# recurse2
+recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
+all:;@echo $@: "/$(SHOW)/"
+!,
+ "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nrecurse2: /-j $np/\nall: /-j $np/\n");
+
+# Don't put --jobserver-auth into a re-exec'd MAKEFLAGS.
# We can't test this directly because there's no way a makefile can
# show the value of MAKEFLAGS we were re-exec'd with. We can intuit it
# by looking for "disabling jobserver mode" warnings; we should only
@@ -34,7 +76,7 @@ inc.mk:
# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
@echo 'FOO = bar' > $@
!,
- '--no-print-directory -j2', "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n");
+ "$np -j2", "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n");
unlink('inc.mk');
@@ -52,10 +94,14 @@ close(MAKEFILE);
run_make_test(q!
default: ; @ #MAKEPATH# -f Makefile2
!,
- '-j2 --no-print-directory',
+ "-j2 $np",
"#MAKE#[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
#MAKE#[1]: Nothing to be done for 'foo'.");
rmfiles('Makefile2');
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/features/load b/tests/scripts/features/load
index 1f8cdc22..2e9318d5 100644
--- a/tests/scripts/features/load
+++ b/tests/scripts/features/load
@@ -56,7 +56,7 @@ load testload.so
POST := $(.LOADED)
all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD)
!,
- '', "pre= post=testload.so implicit\n");
+ '--warn-undefined-variables', "pre= post=testload.so implicit\n");
# TEST 2
# Load using an explicit function
diff --git a/tests/scripts/features/output-sync b/tests/scripts/features/output-sync
index a7534cb7..7237e65b 100644
--- a/tests/scripts/features/output-sync
+++ b/tests/scripts/features/output-sync
@@ -53,6 +53,8 @@ sub output_sync_set {
@syncfiles = qw(mksync.foo mksync.foo_start mksync.bar mksync.bar_start);
+$tmout = 30;
+
output_sync_clean();
mkdir('foo', 0777);
mkdir('bar', 0777);
@@ -140,7 +142,7 @@ bar: start
bar: end
baz: start
baz: end
-#MAKE#[1]: Leaving directory '#PWD#/bar'\n", 0, 6);
+#MAKE#[1]: Leaving directory '#PWD#/bar'\n", 0, $tmout);
# Test per-target synchronization.
# Note we have to sleep again here after starting the foo makefile before
@@ -171,7 +173,7 @@ foo: end
#MAKE#[1]: Entering directory '#PWD#/bar'
baz: start
baz: end
-#MAKE#[1]: Leaving directory '#PWD#/bar'\n", 0, 6);
+#MAKE#[1]: Leaving directory '#PWD#/bar'\n", 0, $tmout);
# Rerun but this time suppress the directory tracking
unlink(@syncfiles);
@@ -183,7 +185,7 @@ bar: end
foo: start
foo: end
baz: start
-baz: end\n", 0, 6);
+baz: end\n", 0, $tmout);
# Test that messages from make itself are enclosed with
# "Entering/Leaving directory" messages.
@@ -204,11 +206,9 @@ bar: end
#MAKE#[1]: Entering directory '#PWD#/foo'
foo-fail: start
foo-fail: end
-Makefile:20: recipe for target 'foo-fail' failed
-#MAKE#[1]: *** [foo-fail] Error 1
+#MAKE#[1]: *** [Makefile:23: foo-fail] Error 1
#MAKE#[1]: Leaving directory '#PWD#/foo'
-#MAKEFILE#:4: recipe for target 'make-foo-fail' failed
-#MAKE#: *** [make-foo-fail] Error 2\n",
+#MAKE#: *** [#MAKEFILE#:4: make-foo-fail] Error 2\n",
512);
# Test the per-job synchronization.
@@ -238,7 +238,7 @@ bar: end
#MAKE#[1]: Leaving directory '#PWD#/bar'
#MAKE#[1]: Entering directory '#PWD#/foo'
foo: end
-#MAKE#[1]: Leaving directory '#PWD#/foo'\n", 0, 6);
+#MAKE#[1]: Leaving directory '#PWD#/foo'\n", 0, $tmout);
# Remove temporary directories and contents.
@@ -326,7 +326,7 @@ run_make_test(qq!
all: t1
t1: ; -\@\$(MAKE) -f $m1
!,
- "-j -Oline", "#MAKE#[1]: Entering directory '#PWD#'\nd1 stderr\nd1 stdout\n$m1:3: *** d1 failed. Stop.\n#MAKE#[1]: Leaving directory '#PWD#'\n#MAKEFILE#:3: recipe for target 't1' failed\n#MAKE#: [t1] Error 2 (ignored)\n");
+ "-j -Oline", "#MAKE#[1]: Entering directory '#PWD#'\nd1 stderr\nd1 stdout\n$m1:3: *** d1 failed. Stop.\n#MAKE#[1]: Leaving directory '#PWD#'\n#MAKE#: [#MAKEFILE#:3: t1] Error 2 (ignored)\n");
rmfiles($m1);
@@ -337,5 +337,13 @@ foo: $(OBJS) ; echo $(or $(filter %.o,$^),$(error fail))
!,
'-O', "#MAKEFILE#:2: *** fail. Stop.\n", 512);
+# SV 47365: Make sure exec failure error messages are shown
+# Is "127" not always the same everywhere? We may have to detect it?
+
+run_make_test(q!
+all:: ; @./foo bar baz
+!,
+ '-O', "#MAKE#: ./foo: Command not found\n#MAKE#: *** [#MAKEFILE#:2: all] Error 127\n", 512);
+
# This tells the test driver that the perl test script executed properly.
1;
diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
index c702c268..fabe5485 100644
--- a/tests/scripts/features/parallelism
+++ b/tests/scripts/features/parallelism
@@ -99,15 +99,12 @@ ok:
\@$sleep_command 4
\@echo Ok done",
'-rR -j5', "Fail
-#MAKEFILE#:6: recipe for target 'fail.1' failed
-#MAKE#: *** [fail.1] Error 1
+#MAKE#: *** [#MAKEFILE#:8: fail.1] Error 1
#MAKE#: *** Waiting for unfinished jobs....
Fail
-#MAKEFILE#:6: recipe for target 'fail.2' failed
-#MAKE#: *** [fail.2] Error 1
+#MAKE#: *** [#MAKEFILE#:8: fail.2] Error 1
Fail
-#MAKEFILE#:6: recipe for target 'fail.3' failed
-#MAKE#: *** [fail.3] Error 1
+#MAKE#: *** [#MAKEFILE#:8: fail.3] Error 1
Ok done",
512);
@@ -214,3 +211,7 @@ rmfiles('file1', 'file2', 'file3', 'file4');
# rmfiles(qw(dependfile output));
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/features/patternrules b/tests/scripts/features/patternrules
index 0ff49a75..c7ae7cff 100644
--- a/tests/scripts/features/patternrules
+++ b/tests/scripts/features/patternrules
@@ -110,8 +110,7 @@ $(dir)/foo.bar:
',
"dir=$dir",
-"#MAKEFILE#:6: recipe for target '$dir/foo.bar' failed
-#MAKE#: *** [$dir/foo.bar] Error 1",
+"#MAKE#: *** [#MAKEFILE#:6: $dir/foo.bar] Error 1",
512);
unlink("$dir/foo.bar");
@@ -223,3 +222,7 @@ all: foo.x foo-mt.x
# This tells the test driver that the perl test script executed properly.
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/features/vpath3 b/tests/scripts/features/vpath3
index c6ede282..839fb723 100644
--- a/tests/scripts/features/vpath3
+++ b/tests/scripts/features/vpath3
@@ -17,6 +17,12 @@ my @files_to_touch = ("a1${pathsep}lib1.a",
"b3${pathsep}lib3.so");
&touch(@files_to_touch);
+my $answer = "a1${pathsep}lib1.a a1${pathsep}libc.a " .
+ "a2${pathsep}lib2.a lib3.a\n";
+if ($port_type eq 'VMS-DCL') {
+ $answer =~ s/ /,/g;
+}
+
run_make_test('
vpath %.h b3
vpath %.a a1
@@ -25,7 +31,7 @@ vpath % a2 b2
vpath % b3
all: -l1 -lc -l2 -l3; @echo $^
',
- '', "a1${pathsep}lib1.a a1${pathsep}libc.a a2${pathsep}lib2.a lib3.a\n");
+ '', $answer);
unlink(@files_to_touch);
for my $d (@dirs_to_make) {
diff --git a/tests/scripts/features/vpathplus b/tests/scripts/features/vpathplus
index 361788c7..9ade3f0c 100644
--- a/tests/scripts/features/vpathplus
+++ b/tests/scripts/features/vpathplus
@@ -86,8 +86,7 @@ cat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1
$answer = "not creating notarget.c from notarget.d
cat notarget.c > notarget.b 2>/dev/null || exit 1
-$makefile:16: recipe for target 'notarget.b' failed
-$make_name: *** [notarget.b] Error 1
+$make_name: *** [$makefile:16: notarget.b] Error 1
";
&compare_output($answer,&get_logfile(1));
@@ -127,3 +126,7 @@ rm inter.c
unlink @touchedfiles unless $keep;
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call
index 9db9da71..dc1a6233 100644
--- a/tests/scripts/functions/call
+++ b/tests/scripts/functions/call
@@ -4,11 +4,7 @@ $description = "Test the call function.\n";
$details = "Try various uses of call and ensure they all give the correct
results.\n";
-open(MAKEFILE, "> $makefile");
-
-# The Contents of the MAKEFILE ...
-
-print MAKEFILE <<'EOMAKE';
+run_make_test(q!
# Simple, just reverse two things
#
reverse = $2 $1
@@ -48,35 +44,22 @@ all: ; @echo '$(call reverse,bar,foo)'; \
echo '$(call my-foreach,a,,,)'; \
echo '$(call my-if,a,b,c)'; \
echo '$(call two,bar,baz)'; \
- echo '$(call tclose,foo)'
-
-
+ echo '$(call tclose,foo)';
+!,
+ "", "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n");
-EOMAKE
-
-# These won't work until/unless PR/1527 is resolved.
-# echo '$(call my-foreach,a,x y z,$(a)$(a))'; \
-# echo '$(call my-if,,$(warning don't print this),ok)'
+# These won't work because call expands all its arguments first, before
+# passing them on, then marks them as resolved/simple, so they're not
+# expanded again by the function.
#
-# $answer = "xx yy zz\nok\n";
-
-# END of Contents of MAKEFILE
-
-close(MAKEFILE);
-
-&run_make_with_options($makefile, "", &get_logfile);
-$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n";
-&compare_output($answer, &get_logfile(1));
-
+# echo '$(call my-foreach,a,x y z,$$(a)$$(a))'; \
+# echo '$(call my-if,,$$(info don't print this),$$(info do print this))'
+#
+# $answer = "xx yy zz\ndo print this\n";
# TEST eclipsing of arguments when invoking sub-calls
-$makefile2 = &get_tmpfile;
-
-open(MAKEFILE,"> $makefile2");
-
-print MAKEFILE <<'EOF';
-
+run_make_test(q!
all = $1 $2 $3 $4 $5 $6 $7 $8 $9
level1 = $(call all,$1,$2,$3,$4,$5)
@@ -88,13 +71,8 @@ all:
@echo $(call level1,1,2,3,4,5,6,7,8)
@echo $(call level2,1,2,3,4,5,6,7,8)
@echo $(call level3,1,2,3,4,5,6,7,8)
-EOF
-
-close(MAKEFILE);
-
-&run_make_with_options($makefile2, "", &get_logfile);
-$answer = "1 2 3 4 5 6 7 8 9\n1 2 3 4 5\n1 2 3\n1 2 3\n";
-&compare_output($answer,&get_logfile(1));
+!,
+ "", "1 2 3 4 5 6 7 8 9\n1 2 3 4 5\n1 2 3\n1 2 3\n");
# Ensure that variables are defined in global scope even in a $(call ...)
@@ -108,3 +86,7 @@ all: ; @echo "$${X123-not set}"
'', "\n");
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/functions/error b/tests/scripts/functions/error
index 0d61177f..998afe48 100644
--- a/tests/scripts/functions/error
+++ b/tests/scripts/functions/error
@@ -54,7 +54,7 @@ $answer = "Some stuff\n$makefile:12: *** error is maybe. Stop.\n";
# Test #4
&run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512);
-$answer = "Some stuff\n$makefile:16: *** error is definitely. Stop.\n";
+$answer = "Some stuff\n$makefile:17: *** error is definitely. Stop.\n";
&compare_output($answer,&get_logfile(1));
# Test #5
@@ -66,8 +66,6 @@ $answer = "$makefile:22: *** Error found!. Stop.\n";
# This tells the test driver that the perl test script executed properly.
1;
-
-
-
-
-
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/functions/file b/tests/scripts/functions/file
index 55eb58a0..904db790 100644
--- a/tests/scripts/functions/file
+++ b/tests/scripts/functions/file
@@ -115,4 +115,47 @@ x:;@cat file.out
unlink('file.out');
+# Reading files
+run_make_test(q!
+$(file >file.out,A = foo)
+X1 := $(file <file.out)
+$(file >>file.out,B = bar)
+$(eval $(file <file.out))
+
+x:;@echo '$(X1)'; echo '$(A)'; echo '$(B)'
+!,
+ '', "A = foo\nfoo\nbar\n");
+
+unlink('file.out');
+
+# Reading from non-existent file
+run_make_test(q!
+X1 := $(file <file.out)
+x:;@echo '$(X1)';
+!,
+ '', "\n");
+
+# Extra arguments in read mode
+run_make_test(q!
+X1 := $(file <file.out,foo)
+x:;@echo '$(X1)';
+!,
+ '', "#MAKEFILE#:2: *** file: too many arguments. Stop.\n", 512);
+
+
+# Missing filename
+run_make_test('$(file >)', '',
+ "#MAKEFILE#:1: *** file: missing filename. Stop.\n", 512);
+
+run_make_test('$(file >>)', '',
+ "#MAKEFILE#:1: *** file: missing filename. Stop.\n", 512);
+
+run_make_test('$(file <)', '',
+ "#MAKEFILE#:1: *** file: missing filename. Stop.\n", 512);
+
+# Bad call
+
+run_make_test('$(file foo)', '',
+ "#MAKEFILE#:1: *** file: invalid file operation: foo. Stop.\n", 512);
+
1;
diff --git a/tests/scripts/functions/foreach b/tests/scripts/functions/foreach
index 4d1a11d1..451839a2 100644
--- a/tests/scripts/functions/foreach
+++ b/tests/scripts/functions/foreach
@@ -53,8 +53,26 @@ $(foreach x,FOREACH,$(eval $(value mktarget)))',
'',
'FOREACH');
+# Allow variable names with trailing space
+run_make_test(q!
+$(foreach \
+ a \
+, b c d \
+, $(info $a))
+all:;@:
+!,
+ "", "b\nc\nd\n");
+
+# Allow empty variable names. We still expand the body.
-# TEST 2: Check some error conditions.
+run_make_test('
+x = $(foreach ,1 2 3,a)
+y := $x
+
+all: ; @echo $y',
+ '', "a a a\n");
+
+# Check some error conditions.
run_make_test('
x = $(foreach )
@@ -66,12 +84,12 @@ all: ; @echo $y',
512);
run_make_test('
-x = $(foreach )
+x = $(foreach x,y)
y := $x
all: ; @echo $y',
'',
- "#MAKEFILE#:2: *** insufficient number of arguments (1) to function 'foreach'. Stop.",
+ "#MAKEFILE#:2: *** insufficient number of arguments (2) to function 'foreach'. Stop.",
512);
1;
diff --git a/tests/scripts/functions/shell b/tests/scripts/functions/shell
index 723cd0ed..809c77fa 100644
--- a/tests/scripts/functions/shell
+++ b/tests/scripts/functions/shell
@@ -4,11 +4,26 @@ $description = 'Test the $(shell ...) function.';
$details = '';
+# Test standard shell
+run_make_test('.PHONY: all
+OUT := $(shell echo hi)
+all: ; @echo $(OUT)
+ ','','hi');
# Test shells inside rules.
run_make_test('.PHONY: all
all: ; @echo $(shell echo hi)
-','','hi');
+ ','','hi');
+
+# Verify .SHELLSTATUS
+run_make_test('.PHONY: all
+PRE := $(.SHELLSTATUS)
+$(shell exit 0)
+OK := $(.SHELLSTATUS)
+$(shell exit 1)
+BAD := $(.SHELLSTATUS)
+all: ; @echo PRE=$(PRE) OK=$(OK) BAD=$(BAD)
+ ','','PRE= OK=0 BAD=1');
# Test unescaped comment characters in shells. Savannah bug #20513
@@ -27,6 +42,19 @@ run_make_test('
export HI = $(shell echo hi)
.PHONY: all
all: ; @echo $$HI
-','','hi');
+ ','','hi');
+
+# Test shell errors in recipes including offset
+run_make_test('
+all:
+ @echo hi
+ $(shell ./basdfdfsed there)
+ @echo there
+',
+ '', "#MAKE#: ./basdfdfsed: Command not found\nhi\nthere\n");
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/functions/sort b/tests/scripts/functions/sort
index b5589103..f1791437 100644
--- a/tests/scripts/functions/sort
+++ b/tests/scripts/functions/sort
@@ -12,20 +12,20 @@ remove all duplicates\n";
run_make_test('
foo := moon_light days
foo1:= jazz
-bar := captured
-bar2 = boy end, has rise A midnight
+bar := captured
+bar2 = boy end, has rise A midnight
bar3:= $(foo)
s1 := _by
s2 := _and_a
t1 := $(addsuffix $(s1), $(bar) )
t2 := $(addsuffix $(s2), $(foo1) )
-t3 := $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2)
-t4 := $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3)
-t5 := $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4)
-t6 := $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5)
-t7 := $(t6) $(t6) $(t6)
+t3 := $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2)
+t4 := $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3)
+t5 := $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4)
+t6 := $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5)
+t7 := $(t6) $(t6) $(t6)
p1 := $(addprefix $(foo1), $(s2) )
-blank:=
+blank:=
all:
@echo $(sort $(bar2) $(foo) $(addsuffix $(s1), $(bar) ) $(t2) $(bar2) $(bar3))
@echo $(sort $(blank) $(foo) $(bar2) $(t1) $(p1) )
@@ -42,6 +42,10 @@ A boy captured_by days end, has jazz_and_a midnight moon_light rise
run_make_test("FOO = a b\tc\rd\fe \f \f \f \f \ff
all: ; \@echo \$(words \$(sort \$(FOO)))\n",
- '', "5\n");
+ '', "6\n");
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/functions/warning b/tests/scripts/functions/warning
index cd452d41..16eb83bb 100644
--- a/tests/scripts/functions/warning
+++ b/tests/scripts/functions/warning
@@ -52,14 +52,32 @@ $answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n";
# Test #4
&run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0);
-$answer = "Some stuff\n$makefile:14: warning is definitely\nhi\nthere\n";
+$answer = "Some stuff\n$makefile:15: warning is definitely\nhi\nthere\n";
&compare_output($answer,&get_logfile(1));
+# Test linenumber offset
+
+run_make_test(q!
+all: one two
+ $(warning in $@ line 3)
+ @true
+ $(warning in $@ line 5)
+
+one two:
+ $(warning in $@ line 8)
+ @true
+ $(warning in $@ line 10)
+!,
+ '', "#MAKEFILE#:8: in one line 8
+#MAKEFILE#:10: in one line 10
+#MAKEFILE#:8: in two line 8
+#MAKEFILE#:10: in two line 10
+#MAKEFILE#:3: in all line 3
+#MAKEFILE#:5: in all line 5\n");
+
# This tells the test driver that the perl test script executed properly.
1;
-
-
-
-
-
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/misc/bs-nl b/tests/scripts/misc/bs-nl
index 4fc3f639..fc323ce9 100644
--- a/tests/scripts/misc/bs-nl
+++ b/tests/scripts/misc/bs-nl
@@ -125,5 +125,103 @@ close(MAKEFILE);
run_make_with_options($m2, '', get_logfile());
compare_output("foo bar\n", get_logfile(1));
+# Test different types of whitespace, and bsnl inside functions
+
+sub xlate
+{
+ $_ = $_[0];
+ s/\\r/\r/g;
+ s/\\t/\t/g;
+ s/\\f/\f/g;
+ s/\\v/\v/g;
+ s/\\n/\n/g;
+ return $_;
+}
+
+run_make_test(xlate(q!
+$(foreach\r a \t , b\t c \r ,$(info $a \r ) )
+all:;@:
+!),
+ '', "b \r \nc \r \n");
+
+run_make_test(xlate(q!
+all:;@:$(foreach\r a \t , b\t c \r ,$(info $a \r ) )
+!),
+ '', "b \r \nc \r \n");
+
+run_make_test(xlate(q!
+$(foreach \
+\r a \t\
+ , b\t \
+ c \r ,$(info \
+ $a \r ) \
+ )
+all:;@:
+!),
+ '', "b \r \nc \r \n");
+
+run_make_test(xlate(q!
+all:;@:$(foreach \
+\r a \t\
+ , b\t \
+ c \r ,$(info \
+ $a \r ) \
+ )
+!),
+ '', "b \r \nc \r \n");
+
+run_make_test(xlate(q!
+define FOO
+$(foreach
+\r a \t
+ , b\t
+ c \r ,$(info
+ $a \r )
+ )
+endef
+$(FOO)
+all:;@:
+!),
+ '', "b \r \nc \r \n");
+
+run_make_test(xlate(q!
+define FOO
+$(foreach
+\r a \t
+ , b\t
+ c \r ,$(info
+ $a \r )
+ )
+endef
+all:;@:$(FOO)
+!),
+ '', "b \r \nc \r \n");
+
+# Test variables in recipes that expand to multiple lines
+
+run_make_test(q!
+define var
+
+echo foo
+
+
+echo bar
+endef
+all:;$(var)
+!,
+ '', "echo foo\nfoo\necho bar\nbar\n");
+
+run_make_test(q!
+define var
+
+echo foo
+
+@
+
+echo bar
+endef
+all:;$(var)
+!,
+ '', "echo foo\nfoo\necho bar\nbar\n");
1;
diff --git a/tests/scripts/misc/fopen-fail b/tests/scripts/misc/fopen-fail
index 6580e519..2ec9810b 100644
--- a/tests/scripts/misc/fopen-fail
+++ b/tests/scripts/misc/fopen-fail
@@ -7,9 +7,12 @@ $description = "Make sure make exits with an error if fopen fails.";
# since it's hard to know what it will be, exactly.
# See Savannah bug #27374.
+# Use a longer-than-normal timeout: some systems have more FDs available?
+# We also set ulimit -n 512 in check-regression in Makefile.am, which see.
+# See Savannah bug #42390.
run_make_test(q!
include $(lastword $(MAKEFILE_LIST))
!,
- '', undef, 512);
+ '', undef, 512, 300);
1;
diff --git a/tests/scripts/misc/general3 b/tests/scripts/misc/general3
index 8ad0f8e2..7bbff1c2 100644
--- a/tests/scripts/misc/general3
+++ b/tests/scripts/misc/general3
@@ -310,4 +310,6 @@ foo bar
hi
foo bar');
+run_make_test('x:;@-exit 1', '', "#MAKE#: [#MAKEFILE#:1: x] Error 1 (ignored)\n");
+
1;
diff --git a/tests/scripts/options/dash-B b/tests/scripts/options/dash-B
index 9c708b77..4c4c4cfb 100644
--- a/tests/scripts/options/dash-B
+++ b/tests/scripts/options/dash-B
@@ -45,7 +45,6 @@ include foo.x
foo.x: ; @touch $@
',
'-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');
rmfiles('foo.x');
@@ -63,7 +62,6 @@ foo.x: ; @touch $@
blah.x: ; @echo $@
',
'-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1
blah.x
all');
@@ -83,3 +81,7 @@ x.a: x.b ; @echo $?
unlink(qw(x.a x.b));
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/options/dash-W b/tests/scripts/options/dash-W
index 20b9f745..857b1cce 100644
--- a/tests/scripts/options/dash-W
+++ b/tests/scripts/options/dash-W
@@ -42,8 +42,7 @@ foo.x: bar.x
bar.x: ; echo >> $@
baz.x: bar.x ; @echo "touch $@"
',
- '', '#MAKEFILE#:3: foo.x: No such file or directory
-echo >> bar.x
+ '', 'echo >> bar.x
touch foo.x
restarts=1
touch baz.x');
@@ -86,3 +85,7 @@ unlink(qw(y x-dir/x));
rmdir('x-dir');
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/options/dash-k b/tests/scripts/options/dash-k
index e784e0db..85dd0b0a 100644
--- a/tests/scripts/options/dash-k
+++ b/tests/scripts/options/dash-k
@@ -42,7 +42,7 @@ close(MAKEFILE);
"$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h",
- "$workdir${pathsep}command.c");
+ "$workdir${pathsep}command.c");
&touch(@files_to_touch);
@@ -92,8 +92,7 @@ close(MAKEFILE);
&run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
$answer = "exit 1
-$makefile2:9: recipe for target 'foo.o' failed
-$make_name: *** [foo.o] Error 1
+$make_name: *** [$makefile2:9: foo.o] Error 1
$make_name: Target 'all' not remade because of errors.\n";
&compare_output($answer, &get_logfile(1));
diff --git a/tests/scripts/options/dash-n b/tests/scripts/options/dash-n
index dfed419d..02ae4a99 100644
--- a/tests/scripts/options/dash-n
+++ b/tests/scripts/options/dash-n
@@ -92,7 +92,7 @@ EOF
close(MAKEFILE);
&run_make_with_options($topmake, '-n --no-print-directory', &get_logfile);
-$answer = "$make_path -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n";
+$answer = "$make_command -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n";
&compare_output($answer, &get_logfile(1));
unlink('inc');
diff --git a/tests/scripts/options/dash-q b/tests/scripts/options/dash-q
index 194588d9..e67b55d4 100644
--- a/tests/scripts/options/dash-q
+++ b/tests/scripts/options/dash-q
@@ -74,4 +74,13 @@ build-y: build-x
',
'-q build-y', "#MAKE#: *** No rule to make target 'build-stamp-2', needed by 'build-arch'. Stop.\n", 512);
+# TEST 9 : Savannah bug # 47151
+# Make sure we exit with 1 when invoking a recursive make
+run_make_test('
+foo: bar ; echo foo
+bar: ; @$(MAKE) -f #MAKEFILE# baz
+baz: ; echo baz
+',
+ '-q foo', '', 256);
+
1;
diff --git a/tests/scripts/options/print-directory b/tests/scripts/options/print-directory
index a05bbee7..db762b2c 100644
--- a/tests/scripts/options/print-directory
+++ b/tests/scripts/options/print-directory
@@ -18,7 +18,7 @@ include foo
all: ;@:
foo: ; touch foo
!,
- "", "#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n");
+ "", "touch foo\n");
unlink('foo');
# Test makefile rebuild with -w
@@ -27,7 +27,7 @@ include foo
all: ;@:
foo: ; touch foo
!,
- "-w", "#MAKE#: Entering directory '#PWD#'\n#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n");
+ "-w", "#MAKE#: Entering directory '#PWD#'\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n");
unlink('foo');
1;
diff --git a/tests/scripts/targets/DELETE_ON_ERROR b/tests/scripts/targets/DELETE_ON_ERROR
new file mode 100644
index 00000000..f0d9f9b4
--- /dev/null
+++ b/tests/scripts/targets/DELETE_ON_ERROR
@@ -0,0 +1,22 @@
+#! -*-perl-*-
+
+$description = "Test the behaviour of the .DELETE_ON_ERROR target.";
+
+$details = "";
+
+run_make_test('
+.DELETE_ON_ERROR:
+all: ; exit 1 > $@
+',
+ '', "exit 1 > all\n#MAKE#: *** [#MAKEFILE#:3: all] Error 1\n#MAKE#: *** Deleting file 'all'", 512);
+
+run_make_test('
+.DELETE_ON_ERROR:
+all: foo.x ;
+%.x : %.q ; echo > $@
+%.q : ; exit 1 > $@
+',
+ '', "exit 1 > foo.q\n#MAKE#: *** [#MAKEFILE#:5: foo.q] Error 1\n#MAKE#: *** Deleting file 'foo.q'", 512);
+
+# This tells the test driver that the perl test script executed properly.
+1;
diff --git a/tests/scripts/targets/POSIX b/tests/scripts/targets/POSIX
index a24e3bcf..5c3c7f89 100644
--- a/tests/scripts/targets/POSIX
+++ b/tests/scripts/targets/POSIX
@@ -17,8 +17,7 @@ run_make_test(qq!
.POSIX:
all: ; \@$script
!,
- '', "#MAKEFILE#:3: recipe for target 'all' failed
-#MAKE#: *** [all] Error $err\n", 512);
+ '', "#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512);
# User settings must override .POSIX
$flags = '-xc';
diff --git a/tests/scripts/variables/MAKEFLAGS b/tests/scripts/variables/MAKEFLAGS
index 8a5d0f6a..0fac74a3 100644
--- a/tests/scripts/variables/MAKEFLAGS
+++ b/tests/scripts/variables/MAKEFLAGS
@@ -39,3 +39,7 @@ jump Works: MAKEFLAGS=e --no-print-directory
print Works: MAKEFLAGS=e --no-print-directory');
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/variables/MAKE_RESTARTS b/tests/scripts/variables/MAKE_RESTARTS
index ef8e368f..01bf55ec 100644
--- a/tests/scripts/variables/MAKE_RESTARTS
+++ b/tests/scripts/variables/MAKE_RESTARTS
@@ -11,7 +11,6 @@ include foo.x
foo.x: ; @touch $@
',
'', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');
rmfiles('foo.x');
@@ -26,9 +25,7 @@ foo.x: ; @echo "include bar.x" > $@
bar.x: ; @touch $@
',
'', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
MAKE_RESTARTS=2');
rmfiles('foo.x', 'bar.x');
@@ -47,9 +44,7 @@ foo.x: ; @echo "include bar.x" > $@
bar.x: ; @touch $@
',
'', "MAKE_RESTARTS=
-#MAKEFILE#:8: foo.x: No such file or directory
MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
MAKE_RESTARTS=2
recurse MAKE_RESTARTS=
#MAKE#[1]: Entering directory '#PWD#'
@@ -60,3 +55,7 @@ all MAKE_RESTARTS=
rmfiles('foo.x', 'bar.x');
1;
+
+### Local Variables:
+### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
+### End:
diff --git a/tests/scripts/variables/SHELL b/tests/scripts/variables/SHELL
index 1d01ba3f..edba7b67 100644
--- a/tests/scripts/variables/SHELL
+++ b/tests/scripts/variables/SHELL
@@ -97,7 +97,6 @@ run_make_test(qq!
.SHELLFLAGS = $flags
all: ; \@$script
!,
- '', "$out#MAKEFILE#:3: recipe for target 'all' failed
-#MAKE#: *** [all] Error $err\n", 512);
+ '', "$out#MAKE#: *** [#MAKEFILE#:3: all] Error $err\n", 512);
1;
diff --git a/tests/scripts/variables/special b/tests/scripts/variables/special
index a5ab93aa..68f3128c 100644
--- a/tests/scripts/variables/special
+++ b/tests/scripts/variables/special
@@ -14,14 +14,22 @@ X2 := $(sort $(filter FOO BAR,$(.VARIABLES)))
BAR := bar
-all:
- @echo X1 = $(X1)
- @echo X2 = $(X2)
- @echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES)))
+all: ; @echo X1 = $(X1); echo X2 = $(X2); echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES)))
',
'', "X1 =\nX2 = FOO\nLAST = BAR FOO\n");
+# SV 45728: Test that undefining a variable is reflected properly
+&run_make_test('
+FOO := foo
+BAR := bar
+$(info one: $(sort $(filter FOO BAR BAZ,$(.VARIABLES))))
+undefine BAR
+BAZ := baz
+$(info two: $(sort $(filter FOO BAR BAZ,$(.VARIABLES))))
+all:;@:
+',
+ '', "one: BAR FOO\ntwo: BAZ FOO\n");
# $makefile2 = &get_tmpfile;
# open(MAKEFILE, "> $makefile2");
@@ -31,9 +39,9 @@ all:
# X1 := $(sort $(.TARGETS))
# all: foo
-# @echo X1 = $(X1)
-# @echo X2 = $(X2)
-# @echo LAST = $(sort $(.TARGETS))
+# @echo X1 = $(X1)
+# @echo X2 = $(X2)
+# @echo LAST = $(sort $(.TARGETS))
# X2 := $(sort $(.TARGETS))
diff --git a/tests/scripts/vms/library b/tests/scripts/vms/library
new file mode 100644
index 00000000..9a64951e
--- /dev/null
+++ b/tests/scripts/vms/library
@@ -0,0 +1,73 @@
+# -*-mode: perl-*-
+
+$description = "Test GNU make's VMS Library management features.";
+
+$details = "\
+This only works on VMS systems.";
+
+return -1 if $osname ne 'VMS';
+
+# Help library
+$mk_string = "help : help.hlb(file1.hlp)\n\n" .
+"file1.hlp :\n" .
+"\t\@pipe open/write xxx file1.hlp ; write xxx \"1 help\" ; close xxx\n";
+
+my $answer = "library /replace help.hlb file1.hlp";
+
+run_make_test($mk_string,
+ '', $answer);
+
+unlink('help.hlb');
+unlink('file1.hlp');
+
+#Text library
+$mk_string = "text : text.tlb(file1.txt)\n\n" .
+"file1.txt :\n" .
+"\t\@pipe open/write xxx file1.txt ; write xxx \"text file\" ; close xxx\n";
+
+my $answer = "library /replace text.tlb file1.txt";
+
+run_make_test($mk_string,
+ '', $answer);
+
+unlink('text.tlb');
+unlink('file1.txt');
+
+
+#Macro library
+$mk_string = "macro : macro.mlb(file1.mar)\n\n" .
+"file1.mar :\n" .
+"\t\pipe open/write xxx file1.mar ; " .
+"write xxx \".macro a b\" ; write xxx \".endm\" ; close xxx\n";
+
+my $answer = "library /replace macro.mlb file1.mar";
+
+run_make_test($mk_string,
+ '', $answer);
+
+unlink('macro.mlb');
+unlink('file1.mar');
+
+$mk_string =
+"all:imagelib.olb(file2.exe)\n" .
+"file2.exe : file2.obj file2.opt\n" .
+"\t\@link /share=\$\@ \$\*,\$\*/opt\n\n" .
+"file2.opt :\n" .
+"\t\@pipe open/write xxx file2.opt ; " .
+"write xxx \"CASE_SENSITIVE=YES\" ; close xxx\n" .
+"file2.c :\n" .
+"\t\@pipe open/write xxx file2.c ; write xxx \"file2(){}\" ; close xxx\n";
+
+my $answer = "library /replace imagelib.olb file2.exe";
+
+run_make_test($mk_string,
+ '', $answer);
+
+unlink('imagelib.olb');
+unlink('file2.c');
+unlink('file2.obj');
+unlink('file2.exe');
+unlink('file2.opt');
+
+# This tells the test driver that the perl test script executed properly.
+1;
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 91141eb4..e6cd9f9e 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -5,7 +5,7 @@
# Written 91-12-02 through 92-01-01 by Stephen McGee.
# Modified 92-02-11 through 92-02-22 by Chris Arthur to further generalize.
#
-# Copyright (C) 1991-2014 Free Software Foundation, Inc.
+# Copyright (C) 1991-2016 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under