add make-4.3.tar.gz

This commit is contained in:
ahgamut 2021-10-26 23:19:30 +05:30 committed by Justine Tunney
parent 0a0997a872
commit 19f70a154e
458 changed files with 239669 additions and 0 deletions

View file

@ -0,0 +1,232 @@
# -*-perl-*-
$description = "Test backslash-newline handling.";
$details = "";
# TEST #1
# -------
# Backslash-newlines in recipes
# These are basic backslash-newlines with no tricks
run_make_test("fast:;\@echo fa\\\nst\n",
'', 'fast');
run_make_test("slow:;\@: no-op; echo sl\\\now\n",
'', 'slow');
run_make_test("dquote:;\@echo \"dqu\\\note\"\n",
'', 'dquote');
# Single quotes don't behave the same in Windows
if ($port_type ne 'W32') {
run_make_test("squote:;\@echo 'squ\\\note'\n",
'', "squ\\\note");
}
# Ensure that a leading prefix character is omitted
run_make_test("fast:;\@echo fa\\\n\tst\n",
'', 'fast');
run_make_test("slow:;\@: no-op; echo sl\\\n\tow\n",
'', 'slow');
run_make_test("dquote:;\@echo \"dqu\\\n\tote\"\n",
'', 'dquote');
# Single quotes don't behave the same in Windows
if ($port_type ne 'W32') {
run_make_test("squote:;\@echo 'squ\\\n\tote'\n",
'', "squ\\\note");
}
# Ensure that ONLY the leading prefix character is omitted
run_make_test("fast:;\@echo fa\\\n\t st\n",
'', 'fa st');
run_make_test("slow:;\@: no-op; echo sl\\\n\t\tow\n",
'', "sl ow");
run_make_test("dquote:;\@echo \"dqu\\\n\t ote\"\n",
'', 'dqu ote');
run_make_test("squote:;\@echo 'squ\\\n\t\t ote'\n",
'', "squ\\\n\t ote");
# Backslash-newlines in variable values
# Simple
run_make_test(q!
var = he\
llo
var:;@echo '|$(var)|'!,
'', "|he llo|");
# Condense trailing space
run_make_test(q!
var = he \
llo
var:;@echo '|$(var)|'!,
'', "|he llo|");
# Remove leading space
run_make_test(q!
var = he\
llo
var:;@echo '|$(var)|'!,
'', "|he llo|");
# Multiple bs/nl condensed
run_make_test(q!
var = he\
\
\
llo
var:;@echo '|$(var)|'!,
'', "|he llo|");
# POSIX: Preserve trailing space
run_make_test(q!
.POSIX:
x = y
var = he \
llo
var:;@echo '|$(var)|'!,
'', "|he llo|");
# POSIX: One space per bs-nl
run_make_test(q!
.POSIX:
x = y
var = he\
\
\
llo
var:;@echo '|$(var)|'!,
'', "|he llo|");
# Savannah #39035: handle whitespace in call
run_make_test(q!
f = echo $(1)
t:; @$(call f,"a \
b"); \
$(call f,"a \
b")
!,
'', "a b\na b\n");
# Savannah #38945: handle backslash CRLF
# We need our own makefile so we can set binmode
my $m1 = get_tmpfile();
open(MAKEFILE, "> $m1");
binmode(MAKEFILE);
print MAKEFILE "FOO = foo \\\r\n";
close(MAKEFILE);
my $m2 = get_tmpfile();
open(MAKEFILE, "> $m2");
print MAKEFILE "include $m1\ndefine BAR\nall: ; \@echo \$(FOO) bar\nendef\n\$(eval \$(BAR))\n";
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/\\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;

View file

@ -0,0 +1,9 @@
# -*-perl-*-
$description = "Make sure make exits with an error if stdout is full.";
-e '/dev/full' or return -1;
run_make_test('', '-v > /dev/full', '/^#MAKE#: write error/', 256);
1;

View file

@ -0,0 +1,18 @@
# -*-perl-*-
$description = "Make sure make exits with an error if fopen fails.";
# Recurse infinitely until we run out of open files, and ensure we
# fail with a non-zero exit code. Don't bother to test the output
# 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, 300);
1;

View file

@ -0,0 +1,51 @@
# -*-perl-*-
$description = "The following test creates a makefile to test the
simple functionality of make. It mimics the
rebuilding of a product with dependencies.
It also tests the simple definition of VPATH.";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<EOF;
VPATH = $workdir
edit: main.o kbd.o commands.o display.o \\
insert.o
\t\@echo cc -o edit main.o kbd.o commands.o display.o \\
insert.o
main.o : main.c defs.h
\t\@echo cc -c main.c
kbd.o : kbd.c defs.h command.h
\t\@echo cc -c kbd.c
commands.o : command.c defs.h command.h
\t\@echo cc -c commands.c
display.o : display.c defs.h buffer.h
\t\@echo cc -c display.c
insert.o : insert.c defs.h buffer.h
\t\@echo cc -c insert.c
EOF
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c
cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
# COMPARE RESULTS
if (&compare_output($answer,&get_logfile(1))) {
unlink @files_to_touch;
}
1;

View file

@ -0,0 +1,50 @@
# -*-perl-*-
$description = "The following test creates a makefile to test the
simple functionality of make. It is the same as
general_test1 except that this one tests the
definition of a variable to hold the object filenames.";
open(MAKEFILE,"> $makefile");
# The contents of the Makefile ...
print MAKEFILE <<EOF;
VPATH = $workdir
objects = main.o kbd.o commands.o display.o insert.o
edit: \$(objects)
\t\@echo cc -o edit \$(objects)
main.o : main.c defs.h
\t\@echo cc -c main.c
kbd.o : kbd.c defs.h command.h
\t\@echo cc -c kbd.c
commands.o : command.c defs.h command.h
\t\@echo cc -c commands.c
display.o : display.c defs.h buffer.h
\t\@echo cc -c display.c
insert.o : insert.c defs.h buffer.h
\t\@echo cc -c insert.c
EOF
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c
cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
if (&compare_output($answer,&get_logfile(1))) {
unlink @files_to_touch;
}
1;

View file

@ -0,0 +1,347 @@
# -*-perl-*-
$description = "\
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.";
run_make_test("
# We want to allow both empty commands _and_ commands that resolve to empty.
EMPTY =
.PHONY: all a1 a2 a3 a4
all: a1 a2 a3 a4
a1:;
a2:
\t
a3:;\$(EMPTY)
a4:
\t\$(EMPTY)
\# Non-empty lines that expand to nothing should also be ignored.
STR = \# Some spaces
TAB = \t \# A TAB and some spaces
\$(STR)
\$(STR) \$(TAB)",
'', "#MAKE#: Nothing to be done for 'all'.");
# TEST 2
# Make sure files without trailing newlines are handled properly.
# Have to use the old style invocation to test this.
$makefile2 = &get_tmpfile;
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));
# TEST 3
# Check semicolons in variable references
run_make_test('
$(if true,$(info true; true))
all: ; @:
',
'', 'true; true');
# TEST 4
# Check that backslashes in command scripts are handled according to POSIX.
# Checks Savannah bug # 1332.
# Test the fastpath / no quotes
run_make_test('
all:
@echo foo\
bar
@echo foo\
bar
@echo foo\
bar
@echo foo\
bar
@echo foo \
bar
@echo foo \
bar
@echo foo \
bar
@echo foo \
bar
',
'', 'foobar
foobar
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar');
# Test the fastpath / single quotes
# Single quotes don't behave the same in Windows
if ($port_type ne 'W32') {
run_make_test(q!
all:
@echo 'foo\
bar'
@echo 'foo\
bar'
@echo 'foo\
bar'
@echo 'foo\
bar'
@echo 'foo \
bar'
@echo 'foo \
bar'
@echo 'foo \
bar'
@echo 'foo \
bar'
!,
'', 'foo\
bar
foo\
bar
foo\
bar
foo\
bar
foo \
bar
foo \
bar
foo \
bar
foo \
bar');
}
# Test the fastpath / double quotes
run_make_test('
all:
@echo "foo\
bar"
@echo "foo\
bar"
@echo "foo\
bar"
@echo "foo\
bar"
@echo "foo \
bar"
@echo "foo \
bar"
@echo "foo \
bar"
@echo "foo \
bar"
',
'', 'foobar
foobar
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar');
# Test the slow path / no quotes
run_make_test('
all:
@echo hi; echo foo\
bar
@echo hi; echo foo\
bar
@echo hi; echo foo\
bar
@echo hi; echo foo\
bar
@echo hi; echo foo \
bar
@echo hi; echo foo \
bar
@echo hi; echo foo \
bar
@echo hi; echo foo \
bar
',
'', 'hi
foobar
hi
foobar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar');
# Test the slow path / no quotes. This time we put the slow path
# determination _after_ the backslash-newline handling.
run_make_test('
all:
@echo foo\
bar; echo hi
@echo foo\
bar; echo hi
@echo foo\
bar; echo hi
@echo foo\
bar; echo hi
@echo foo \
bar; echo hi
@echo foo \
bar; echo hi
@echo foo \
bar; echo hi
@echo foo \
bar; echo hi
',
'', 'foobar
hi
foobar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi');
# Test the slow path / single quotes
run_make_test(q!
all:
@echo hi; echo 'foo\
bar'
@echo hi; echo 'foo\
bar'
@echo hi; echo 'foo\
bar'
@echo hi; echo 'foo\
bar'
@echo hi; echo 'foo \
bar'
@echo hi; echo 'foo \
bar'
@echo hi; echo 'foo \
bar'
@echo hi; echo 'foo \
bar'
!,
'', 'hi
foo\
bar
hi
foo\
bar
hi
foo\
bar
hi
foo\
bar
hi
foo \
bar
hi
foo \
bar
hi
foo \
bar
hi
foo \
bar');
# Test the slow path / double quotes
run_make_test('
all:
@echo hi; echo "foo\
bar"
@echo hi; echo "foo\
bar"
@echo hi; echo "foo\
bar"
@echo hi; echo "foo\
bar"
@echo hi; echo "foo \
bar"
@echo hi; echo "foo \
bar"
@echo hi; echo "foo \
bar"
@echo hi; echo "foo \
bar"
',
'', 'hi
foobar
hi
foobar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar
hi
foo bar');
run_make_test('x:;@-exit 1', '', "#MAKE#: [#MAKEFILE#:1: x] Error 1 (ignored)\n");
# Slow path with odd setups
if ($port_type ne 'W32') {
run_make_test(q!
slow: SHELL := echo
slow: .SHELLFLAGS := hoho
slow:; @foo bar
!,
'', "hoho foo bar\n");
run_make_test(q!
slow: SHELL := echo hi
slow: .SHELLFLAGS := ho ho
slow:; @foo bar
!,
'', "hi ho ho foo bar\n");
run_make_test(q!
slow: SHELL := echo hi
slow: .SHELLFLAGS := 'ho;ho'
slow:; @foo bar
!,
'', "hi ho;ho foo bar\n");
}
1;
### Local Variables:
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
### End:

View file

@ -0,0 +1,121 @@
# -*-perl-*-
$description = "\
This tests random features of make's algorithms, often somewhat obscure,
which have either broken at some point in the past or seem likely to
break.";
run_make_test('
# Make sure that subdirectories built as prerequisites are actually handled
# properly.
all: dir/subdir/file.a
dir/subdir: ; @echo mkdir -p dir/subdir
dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b
dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@',
'', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n");
# Test implicit rules
&touch('foo.c');
run_make_test('foo: foo.o',
'CC="@echo cc" OUTPUT_OPTION=',
'cc -c foo.c
cc foo.o -o foo');
unlink('foo.c');
# Test implicit rules with '$' in the name (see se_implicit)
run_make_test(q!
%.foo : baz$$bar ; @echo 'done $<'
%.foo : bar$$baz ; @echo 'done $<'
test.foo:
baz$$bar bar$$baz: ; @echo '$@'
!,
'',
"baz\$bar\ndone baz\$bar");
# Test implicit rules with '$' in the name (see se_implicit)
# Use the '$' in the pattern.
run_make_test(q!
%.foo : %$$bar ; @echo 'done $<'
test.foo:
test$$bar: ; @echo '$@'
!,
'',
"test\$bar\ndone test\$bar");
# Make sure that subdirectories built as prerequisites are actually handled
# properly... this time with '$'
run_make_test(q!
all: dir/subdir/file.$$a
dir/subdir: ; @echo mkdir -p '$@'
dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
!,
'', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
# Test odd whitespace at the beginning of a line
run_make_test("
all:
\f
\\
\f \\
\013 \\
all: ; \@echo hi
",
'', "hi\n");
# SV-56834 Ensure setting PATH in the makefile works properly
my $sname = "foobar$scriptsuffix";
mkdir('sd', 0775);
create_file("sd/$sname", "exit 0\n");
chmod 0755, "sd/$sname";
run_make_test(qq!
PATH := sd
all: ; $sname >/dev/null
!,
'', "$sname >/dev/null\n");
# Don't use the general PATH if not found on the target path
$extraENV{PATH} = "$ENV{PATH}:sd";
run_make_test(qq!
PATH := ..
all: ; $sname
!,
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
unlink("sd/$sname");
rmdir('sd');
# Ensure that local programs are not found if "." is not on the PATH
create_file($sname, '');
chmod 0755, $sname;
run_make_test(qq!
PATH := ..
all: ; $sname
!,
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
unlink($sname);
1;

View file

@ -0,0 +1,14 @@
# -*-perl-*-
$description = "Test utf8 handling.";
$details = "";
# Variable names containing UTF8 characters
run_make_test("
\xe2\x96\xaa := hello
\$(info \$(\xe2\x96\xaa))
all:
",
'', "hello\n#MAKE#: Nothing to be done for 'all'.");
1;