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,87 @@
# -*-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.";
&touch('bar.x');
run_make_test('
.SUFFIXES:
.PHONY: all
all: foo
foo: bar.x
@echo cp $< $@
@echo "" > $@
',
'', 'cp bar.x foo');
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
run_make_test(undef, '-B', 'cp bar.x foo');
# Put the timestamp for foo into the future; it should still be remade.
utouch(1000, 'foo');
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
run_make_test(undef, '-B', 'cp bar.x foo');
# Clean up
rmfiles('bar.x', 'foo');
# Test -B with the re-exec feature: we don't want to re-exec forever
# Savannah bug # 7566
run_make_test('
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
',
'-B', 'MAKE_RESTARTS=
MAKE_RESTARTS=1');
rmfiles('foo.x');
# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
# makefile.
&touch('blah.x');
run_make_test('
all: blah.x ; @echo $@
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
blah.x: ; @echo $@
',
'-B', 'MAKE_RESTARTS=
MAKE_RESTARTS=1
blah.x
all');
rmfiles('foo.x', 'blah.x');
# Test that $? is set properly with -B; all prerequisites will be newer!
utouch(-10, 'x.b');
touch('x.a');
run_make_test(q!
x.a: x.b ; @echo $?
!,
'-B', "x.b\n");
unlink(qw(x.a x.b));
1;
### Local Variables:
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
### End:

View file

@ -0,0 +1,66 @@
# -*-perl-*-
$description = "Test the -C option to GNU make.";
$details = "\
This test is similar to the clean test except that this test creates the file
to delete in the work directory instead of the current directory. Make is
called from another directory using the -C workdir option so that it can both
find the makefile and the file to delete in the work directory.";
$example = $workdir . $pathsep . "EXAMPLE";
open(MAKEFILE,"> $makefile");
print MAKEFILE qq!
all: ; \@echo This makefile did not clean the dir ... good
clean: ; $CMD_rmfile EXAMPLE\$(ext)
!;
close(MAKEFILE);
# TEST #1
# -------
touch($example);
run_make_with_options("${testname}.mk", "-C $workdir clean", &get_logfile);
use Cwd;
chdir $workdir;
$wpath = cwd();
chdir $cwdpath;
if (-f $example) {
$test_passed = 0;
}
# Create the answer to what should be produced by this Makefile
$answer = "$make_name: Entering directory '$wpath'\n"
. "$CMD_rmfile EXAMPLE\n"
. "$make_name: Leaving directory '$wpath'\n";
compare_output($answer,&get_logfile(1));
# TEST #2
# -------
# Do it again with trailing "/"; this should work the same
$example .= "slash";
touch($example);
run_make_with_options("${testname}.mk", "-C $workdir/ clean ext=slash", &get_logfile);
if (-f $example) {
$test_passed = 0;
}
# Create the answer to what should be produced by this Makefile
$answer = "$make_name: Entering directory '$wpath'\n"
. "$CMD_rmfile EXAMPLEslash\n"
. "$make_name: Leaving directory '$wpath'\n";
&compare_output($answer,&get_logfile(1));
unlink($example);
1;

View file

@ -0,0 +1,61 @@
# -*-perl-*-
$description ="The following test creates a makefile to test the -I option.";
$details = "\
This test tests the -I option by including a filename in
another directory and giving make that directory name
under -I in the command line. Without this option, the make
would fail to find the included file. It also checks to make
sure that the -I option gets passed to recursive makes.";
$makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
$mf2 = substr ($makefile2, index ($makefile2, $pathsep) + 1);
print MAKEFILE <<EOF;
include $mf2
all:
\t\@echo There should be no errors for this makefile.
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
open(MAKEFILE,"> $makefile2");
print MAKEFILE <<EOF;
ANOTHER:
\t\@echo This is another included makefile
recurse:
\t\$(MAKE) ANOTHER -f $makefile
EOF
close(MAKEFILE);
&run_make_with_options($makefile,"-I $workdir all",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "There should be no errors for this makefile.\n";
&compare_output($answer,&get_logfile(1));
$answer = "This is another included makefile\n";
&run_make_with_options($makefile,"-I $workdir ANOTHER",&get_logfile);
&compare_output($answer,&get_logfile(1));
$answer = subst_make_string("$mkpath ANOTHER -f $makefile
#MAKE#[1]: Entering directory '#PWD#'
This is another included makefile
#MAKE#[1]: Leaving directory '#PWD#'\n");
&run_make_with_options($makefile,"-I $workdir recurse",&get_logfile);
&compare_output($answer,&get_logfile(1));
1;

View file

@ -0,0 +1,91 @@
# -*-perl-*-
$description = "Test make -W (what if) option.\n";
# Basic build
run_make_test('
a.x: b.x
a.x b.x: ; echo >> $@
',
'', "echo >> b.x\necho >> a.x");
# Run it again: nothing should happen
run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
# Now run it with -W b.x: should rebuild a.x
run_make_test(undef, '-W b.x', 'echo >> a.x');
# Put the timestamp for a.x into the future; it should still be remade.
utouch(1000, 'a.x');
run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
run_make_test(undef, '-W b.x', 'echo >> a.x');
# Clean up
rmfiles('a.x', 'b.x');
# Test -W with the re-exec feature: we don't want to re-exec forever
# Savannah bug # 7566
# First set it up with a normal build
run_make_test('
all: baz.x ; @:
include foo.x
foo.x: bar.x
@echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
@echo "touch $@"
bar.x: ; echo >> $@
baz.x: bar.x ; @echo "touch $@"
',
'', 'echo >> bar.x
touch foo.x
restarts=1
touch baz.x');
# Now run with -W bar.x
# Tweak foo.x's timestamp so the update will change it.
&utouch(1000, 'foo.x');
run_make_test(undef, '-W bar.x', "restarts=\ntouch foo.x\nrestarts=1\ntouch baz.x");
rmfiles('foo.x', 'bar.x');
# Test -W on vpath-found files: it should take effect.
# Savannah bug # 15341
mkdir('x-dir', 0777);
utouch(-20, 'x-dir/x');
touch('y');
run_make_test('
y: x ; @echo cp $< $@
',
'-W x-dir/x VPATH=x-dir',
'cp x-dir/x y');
# Make sure ./ stripping doesn't interfere with the match.
run_make_test('
y: x ; @echo cp $< $@
',
'-W ./x-dir/x VPATH=x-dir',
'cp x-dir/x y');
run_make_test(undef,
'-W x-dir/x VPATH=./x-dir',
'cp ./x-dir/x y');
unlink(qw(y x-dir/x));
rmdir('x-dir');
1;
### Local Variables:
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
### End:

View file

@ -0,0 +1,24 @@
# -*-perl-*-
$description = "The following test creates a makefile to ...";
$details = "";
$extraENV{GOOGLE} = 'boggle';
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
GOOGLE = bazzle
all:; @echo "$(GOOGLE)"
EOF
close(MAKEFILE);
&run_make_with_options($makefile, '-e' ,&get_logfile);
$answer = "boggle\n";
&compare_output($answer,&get_logfile(1));
1;

View file

@ -0,0 +1,85 @@
$description = "The following test tests that if you specify greater \n"
."than one '-f makefilename' on the command line, \n"
."that make concatenates them. This test creates three \n"
."makefiles and specifies all of them with the -f option \n"
."on the command line. To make sure they were concatenated, \n"
."we then call make with the rules from the concatenated \n"
."makefiles one at a time. Finally, it calls all three \n"
."rules in one call to make and checks that the output\n"
."is in the correct order.";
$makefile2 = &get_tmpfile;
$makefile3 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "all: \n";
print MAKEFILE "\t\@echo This is the output from the original makefile\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
# Create a second makefile
open(MAKEFILE,"> $makefile2");
print MAKEFILE "TWO: \n";
print MAKEFILE "\t\@echo This is the output from makefile 2\n";
close(MAKEFILE);
# Create a third makefile
open(MAKEFILE,"> $makefile3");
print MAKEFILE "THREE: \n";
print MAKEFILE "\t\@echo This is the output from makefile 3\n";
close(MAKEFILE);
# Create the answer to what should be produced by this Makefile
$answer = "This is the output from the original makefile\n";
# Run make to catch the default rule
&run_make_with_options($makefile,"-f $makefile2 -f $makefile3",&get_logfile,0);
&compare_output($answer,&get_logfile(1));
# Run Make again with the rule from the second makefile: TWO
$answer = "This is the output from makefile 2\n";
&run_make_with_options($makefile,"-f $makefile2 -f $makefile3 TWO",&get_logfile,0);
&compare_output($answer,&get_logfile(1));
# Run Make again with the rule from the third makefile: THREE
$answer = "This is the output from makefile 3\n";
&run_make_with_options($makefile,
"-f $makefile2 -f $makefile3 THREE",
&get_logfile,
0);
&compare_output($answer,&get_logfile(1));
# Run Make again with ALL three rules in the order 2 1 3 to make sure
# that all rules are executed in the proper order
$answer = "This is the output from makefile 2\n";
$answer .= "This is the output from the original makefile\n";
$answer .= "This is the output from makefile 3\n";
&run_make_with_options($makefile,
"-f $makefile2 -f $makefile3 TWO all THREE",
&get_logfile,
0);
&compare_output($answer,&get_logfile(1));

View file

@ -0,0 +1,116 @@
# -*-perl-*-
$description = "Test the make -k (don't stop on error) option.\n";
$details = "\
The makefile created in this test is a simulation of building
a small product. However, the trick to this one is that one
of the dependencies of the main target does not exist.
Without the -k option, make would fail immediately and not
build any part of the target. What we are looking for here,
is that make builds the rest of the dependencies even though
it knows that at the end it will fail to rebuild the main target.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<EOF;
VPATH = $workdir
edit: main.o kbd.o commands.o display.o
\t\@echo cc -o edit main.o kbd.o commands.o display.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
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
if ($vos) {
$error_code = 3307;
}
else {
$error_code = 512;
}
&run_make_with_options($makefile, "-k", &get_logfile, $error_code);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c
$make_name: *** No rule to make target 'kbd.c', needed by 'kbd.o'.
cc -c commands.c
cc -c display.c
$make_name: Target 'edit' not remade because of errors.\n";
# COMPARE RESULTS
&compare_output($answer, &get_logfile(1));
unlink(@files_to_touch) unless $keep;
# TEST 1: Make sure that top-level targets that depend on targets that
# previously failed to build, aren't attempted. Regression for PR/1634.
$makefile2 = &get_tmpfile;
open(MAKEFILE, "> $makefile2");
print MAKEFILE <<'EOF';
.SUFFIXES:
all: exe1 exe2; @echo making $@
exe1 exe2: lib; @echo cp $^ $@
lib: foo.o; @echo cp $^ $@
foo.o: ; exit 1
EOF
close(MAKEFILE);
&run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
$answer = "exit 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));
# TEST -- make sure we keep the error code if we can't create an included
# makefile.
if (defined $ERR_no_such_file) {
run_make_test('all: ; @echo hi
include ifile
ifile: no-such-file; @false
',
'-k',
"#MAKEFILE#:2: ifile: $ERR_no_such_file
#MAKE#: *** No rule to make target 'no-such-file', needed by 'ifile'.
#MAKE#: Failed to remake makefile 'ifile'.
hi\n",
512);
}
1;

View file

@ -0,0 +1,50 @@
# -*-perl-*-
# Date: Tue, 11 Aug 1992 09:34:26 -0400
# From: pds@lemming.webo.dg.com (Paul D. Smith)
$description = "Test load balancing (-l) option.";
$details = "\
This test creates a makefile where all depends on three rules
which contain the same body. Each rule checks for the existence
of a temporary file; if it exists an error is generated. If it
doesn't exist then it is created, the rule sleeps, then deletes
the temp file again. Thus if any of the rules are run in
parallel the test will fail. When make is called in this test,
it is given the -l option with a value of 0.0001. This ensures
that the load will be above this number and make will therefore
decide that it cannot run more than one job even though -j 4 was
also specified on the command line.";
# On Windows a very different algorithm is used.
$port_type eq 'W32' and return -1;
open(MAKEFILE,"> $makefile");
printf MAKEFILE q,
define test
if [ ! -f test-file ]; then \
echo >> test-file; sleep 2; %s test-file; \
else \
echo $@ FAILED; \
fi
endef
all : ONE TWO THREE
ONE : ; @$(test)
TWO : ; @$(test)
THREE : ; @$(test)
,, $CMD_rmfile;
close(MAKEFILE);
$mkoptions = "-l 0.0001";
$mkoptions .= " -j 4" if ($parallel_jobs);
# We have to wait longer than the default (5s).
&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 8);
$slurp = &read_file_into_string (&get_logfile(1));
if ($slurp !~ /cannot enforce load limit/) {
&compare_output("", &get_logfile(1));
}
1;

View file

@ -0,0 +1,100 @@
# -*-perl-*-
$description = "Test the -n option.\n";
$details = "Try various uses of -n and ensure they all give the correct results.\n";
touch('orig');
run_make_test(q!
final: intermediate ; echo >> $@
intermediate: orig ; echo >> $@
!,
'', "echo >> intermediate\necho >> final\n");
# TEST 1
run_make_test(undef, '-Worig -n', "echo >> intermediate\necho >> final\n");
rmfiles(qw(orig intermediate final));
# We consider the actual updated timestamp of targets with all
# recursive commands, even with -n. Switching this to the new model
# is non-trivial because we use a trick below to change the log content
# before we compare it ...
$makefile2 = &get_tmpfile;
open(MAKEFILE, "> $makefile2");
print MAKEFILE <<'EOF';
.SUFFIXES:
BAR = # nothing
FOO = +$(BAR)
a: b; echo > $@
b: c; $(FOO)
EOF
close(MAKEFILE);
&utouch(-20, 'b');
&utouch(-10, 'a');
&touch('c');
# TEST 2
&run_make_with_options($makefile2, "", &get_logfile);
$answer = "$make_name: 'a' is up to date.\n";
&compare_output($answer, &get_logfile(1));
# TEST 3
&run_make_with_options($makefile2, "-n", &get_logfile);
$answer = "$make_name: 'a' is up to date.\n";
&compare_output($answer, &get_logfile(1));
# TEST 4
unlink(qw(a b));
&run_make_with_options($makefile2, "-t -n", &get_logfile);
open(DASH_N_LOG, ">>" . &get_logfile(1));
print DASH_N_LOG "a exists but should not!\n" if -e 'a';
print DASH_N_LOG "b exists but should not!\n" if -e 'b';
close(DASH_N_LOG);
&compare_output("touch b\ntouch a\n", &get_logfile(1));
# CLEANUP
unlink(qw(a b c));
# Ensure -n continues to be included with recursive/re-execed make
# See Savannah bug #38051
$topmake = &get_tmpfile;
$submake = &get_tmpfile;
open(MAKEFILE, "> $topmake");
print MAKEFILE <<"EOF";
foo: ; \@\$(MAKE) -f "$submake" bar
EOF
close(MAKEFILE);
# The bar target should print what would happen, but not actually run
open(MAKEFILE, "> $submake");
print MAKEFILE <<'EOF';
inc: ; touch $@
-include inc
bar: ; @echo $(strip $(MAKEFLAGS))
EOF
close(MAKEFILE);
&run_make_with_options($topmake, '-n --no-print-directory', &get_logfile);
$answer = subst_make_string("#MAKEPATH# -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n");
&compare_output($answer, &get_logfile(1));
unlink('inc');
1;

View file

@ -0,0 +1,86 @@
# -*-perl-*-
$description = "Test the -q option.\n";
$details = "Try various uses of -q and ensure they all give the correct results.\n";
# TEST 0
run_make_test(qq!
one:
two: ;
three: ; :
four: ; \$(.XY)
five: ; \\
\$(.XY)
six: ; \\
\$(.XY)
\t\$(.XY)
seven: ; \\
\$(.XY)
\t: foo
\t\$(.XY)
!,
'-q one', '');
# TEST 1
run_make_test(undef, '-q two', '');
# TEST 2
run_make_test(undef, '-q three', '', 256);
# TEST 3
run_make_test(undef, '-q four', '');
# TEST 4
run_make_test(undef, '-q five', '');
# TEST 5
run_make_test(undef, '-q six', '');
# TEST 6
run_make_test(undef, '-q seven', '', 256);
# TEST 7 : Savannah bug # 7144
run_make_test('
one:: ; @echo one
one:: ; @echo two
',
'-q', '', 256);
# TEST 7 : Savannah bug # 42249
# Make sure we exit with 1 even for prerequisite updates
run_make_test('
build-stamp: ; echo $@
build-arch: build-stamp
build-x: build-arch
build-y: build-x
',
'-q build-y', '', 256);
# TEST 8
# Make sure we exit with 2 on error even with -q
run_make_test('
build-stamp: ; echo $@
build-arch: build-stamp-2
build-x: build-arch
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;

View file

@ -0,0 +1,26 @@
# -*-perl-*-
$description = "Test the -s (silent) and --no-silent options.\n";
run_make_test(q!
all: one two
one: ; @echo MAKEFLAGS=$$MAKEFLAGS
two: ; echo two
!,
'', "MAKEFLAGS=\necho two\ntwo");
run_make_test(undef, '-s', "MAKEFLAGS=s\ntwo");
run_make_test(undef, '--silent', "MAKEFLAGS=s\ntwo");
run_make_test(undef, '--quiet', "MAKEFLAGS=s\ntwo");
run_make_test(undef, '--no-silent', "MAKEFLAGS=\necho two\ntwo");
run_make_test(undef, '-s --no-silent', "MAKEFLAGS=\necho two\ntwo");
run_make_test(undef, '--silent --no-silent', "MAKEFLAGS=\necho two\ntwo");
run_make_test(undef, '--quiet --no-silent', "MAKEFLAGS=\necho two\ntwo");
run_make_test(undef, '--no-silent -s', "MAKEFLAGS=s\ntwo");
run_make_test(undef, '--no-silent --silent', "MAKEFLAGS=s\ntwo");
run_make_test(undef, '--no-silent --quiet', "MAKEFLAGS=s\ntwo");
1;

View file

@ -0,0 +1,58 @@
# -*-perl-*-
$description = "Test the -t option.\n";
$details = "Look out for regressions of prior bugs related to -t.\n";
# That means, nobody has even tried to make the tests below comprehensive
# TEST 0
# bug reported by Henning Makholm <henning@makholm.net> on 2001-11-03:
# make 3.79.1 touches only interm-[ab] but reports final-[a] as
# 'up to date' without touching them.
# The 'obvious' fix didn't work for double-colon rules, so pay special
# attention to them.
open(MAKEFILE, "> $makefile");
print MAKEFILE <<'EOMAKE';
final-a: interm-a ; echo >> $@
final-b: interm-b ; echo >> $@
interm-a:: orig1-a ; echo >> $@
interm-a:: orig2-a ; echo >> $@
interm-b:: orig1-b ; echo >> $@
interm-b:: orig2-b ; echo >> $@
EOMAKE
close(MAKEFILE);
&utouch(-30, 'orig1-a','orig2-b');
&utouch(-20, 'interm-a','interm-b');
&utouch(-10, 'final-a','final-b');
&touch('orig2-a','orig1-b');
&run_make_with_options($makefile, "-t final-a final-b", &get_logfile);
$answer = "touch interm-a\ntouch final-a\ntouch interm-b\ntouch final-b\n";
&compare_output($answer, &get_logfile(1));
unlink('orig1-a', 'orig2-a', 'interm-a', 'final-a');
unlink('orig1-b', 'orig2-b', 'interm-b', 'final-b');
# TEST 1
# -t should not touch files with no commands.
$makefile2 = &get_tmpfile;
open(MAKEFILE, "> $makefile2");
print MAKEFILE <<'EOMAKE';
PHOOEY: xxx
xxx: ; @:
EOMAKE
close(MAKEFILE);
&run_make_with_options($makefile2, "-t", &get_logfile);
$answer = "touch xxx\n";
&compare_output($answer, &get_logfile(1));
unlink('xxx');
1;

View file

@ -0,0 +1,44 @@
# -*-perl-*-
$description = "Test the --eval option.";
$details = "Verify that --eval options take effect,
and are passed to sub-makes.";
# Verify that --eval is evaluated first
run_make_test(q!
$(info infile)
BAR = bar
all: ; @echo all
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
['--eval=$(info eval)', 'FOO=$(BAR)'], "eval\ninfile\nall");
# Make sure that --eval is handled correctly during recursion
run_make_test(undef, ['--no-print-directory', '--eval=$(info eval)', 'recurse'],
"eval\ninfile\neval\ninfile\nall\nrecurse");
# Make sure that --eval is not passed in MAKEFLAGS
run_make_test(q!
all: ; @echo "MAKEFLAGS=$$MAKEFLAGS"
!,
['--eval=$(info eval)'],
"eval\n".'MAKEFLAGS= --eval=$$(info\ eval)');
# Make sure that --eval is handled correctly during restarting
run_make_test(q!
all: ; @echo $@
-include gen.mk
gen.mk: ; @echo > $@
!,
['--eval=$(info eval)'], "eval\neval\nall");
unlink('gen.mk');
# Check -E
run_make_test(q!
BAR = bar
all: ; @echo all
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
['-E', '$(info eval)', 'FOO=$(BAR)'], "eval\nall");
1;

View file

@ -0,0 +1,30 @@
# -*-perl-*-
$description = "Test generic option processing.\n";
# TEST 0
if (!$parallel_jobs) {
$answer = "#MAKE#: Parallel jobs (-j) are not supported on this platform.\n#MAKE#: Resetting to single job (-j1) mode.\n1foo\n";
}
else {
$answer = "1foo\n";
}
run_make_test(q!
foo 1foo: ; @echo $@
!,
"-j 1foo", $answer);
# TEST 1
# This test prints the usage string; I don't really know a good way to
# test it. I guess I could invoke make with a known-bad option to see
# what the usage looks like, then compare it to what I get here... :(
# On UNIX I can invoke it with 2>/dev/null, then just check the error code.
if ($port_type ne 'W32') {
run_make_test(undef, "-j1foo 2>/dev/null", '', 512);
}
1;

View file

@ -0,0 +1,33 @@
# -*-perl-*-
$description = "Test the -w option to GNU make.";
# Simple test without -w
run_make_test(q!
all: ; @echo hi
!,
"", "hi\n");
# Simple test with -w
run_make_test(undef, "-w",
"#MAKE#: Entering directory '#PWD#'\nhi\n#MAKE#: Leaving directory '#PWD#'\n");
# Test makefile rebuild to ensure no enter/leave
run_make_test(q!
include foo
all: ;@:
foo: ; touch foo
!,
"", "touch foo\n");
unlink('foo');
# Test makefile rebuild with -w
run_make_test(q!
include foo
all: ;@:
foo: ; touch foo
!,
"-w", "#MAKE#: Entering directory '#PWD#'\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n");
unlink('foo');
1;

View file

@ -0,0 +1,69 @@
# -*-perl-*-
$description = "Test the -L option.";
$details = "Verify that symlink handling with and without -L works properly.";
# Only run these tests if the system sypports symlinks
# Apparently the Windows port of Perl reports that it does support symlinks
# (in that the symlink() function doesn't fail) but it really doesn't, so
# check for it explicitly.
if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) {
# This test is N/A
return -1;
}
use File::Spec;
# Set up a symlink sym -> dep
# We'll make both dep and targ older than sym
&utouch(-10, 'dep');
&utouch(-5, 'targ');
$dirnm = (File::Spec->splitdir($cwddir))[-1];
symlink(File::Spec->catfile(File::Spec->updir(), $dirnm, 'dep'), 'sym');
# Without -L, nothing should happen
# With -L, it should update targ
run_make_test('targ: sym ; @echo make $@ from $<', '',
"#MAKE#: 'targ' is up to date.");
run_make_test(undef, '-L', "make targ from sym");
# Now update dep; in all cases targ should be out of date.
&touch('dep');
run_make_test(undef, '', "make targ from sym");
run_make_test(undef, '-L', "make targ from sym");
# Now update targ; in all cases targ should be up to date.
&touch('targ');
run_make_test(undef, '', "#MAKE#: 'targ' is up to date.");
run_make_test(undef, '-L', "#MAKE#: 'targ' is up to date.");
# Add in a new link between sym and dep. Be sure it's newer than targ.
sleep(1);
rename('dep', 'dep1');
symlink('dep1', 'dep');
# Without -L, nothing should happen
# With -L, it should update targ
run_make_test(undef, '', "#MAKE#: 'targ' is up to date.");
run_make_test(undef, '-L', "make targ from sym");
rmfiles('targ', 'dep', 'sym', 'dep1');
# Check handling when symlinks point to non-existent files. Without -L we
# should get an error: with -L we should use the timestamp of the symlink.
symlink("../$dirnm/dep", 'sym');
run_make_test('targ: sym ; @echo make $@ from $<', '',
"#MAKE#: *** No rule to make target 'sym', needed by 'targ'. Stop.", 512);
run_make_test('targ: sym ; @echo make $@ from $<', '-L',
'make targ from sym');
rmfiles('targ', 'sym');
1;

View file

@ -0,0 +1,25 @@
# -*-perl-*-
$description = "Test the --warn-undefined-variables option.";
$details = "Verify that warnings are printed for referencing undefined variables.";
# Without --warn-undefined-variables, nothing should happen
run_make_test('
EMPTY =
EREF = $(EMPTY)
UREF = $(UNDEFINED)
SEREF := $(EREF)
SUREF := $(UREF)
all: ; @echo ref $(EREF) $(UREF)',
'', 'ref');
# With --warn-undefined-variables, it should warn me
run_make_test(undef, '--warn-undefined-variables',
"#MAKEFILE#:7: warning: undefined variable 'UNDEFINED'
#MAKEFILE#:9: warning: undefined variable 'UNDEFINED'
ref");
1;