mirror of
https://github.com/mirror/make.git
synced 2024-12-27 13:20:34 +08:00
Enhance tests to work on different systems
The GNU platform testers reported a number of test errors on different systems; try to address them. * tests/thelp.pl: A number of tests timed out with a 4-second timeout. Increase the default timeout to 10 seconds. * tests/run_make_tests.pl: Executing directories on cygwin behaves differently in Perl than make so skip these tests there. * tests/scripts/options/symlinks: Check for the symlink feature in make, rather than whether the system supports them. * tests/scripts/features/implicit_search: On some systems "false" exits with a different exit code. Use the helper instead. * tests/scripts/features/loadapi: Ditto. * tests/scripts/features/output-sync: Sleep before make -f bar in the first test as well as the second one. * tests/scripts/features/exec: Skip on cygwin, which seems to be "UNIX" but where scripts don't run normally. * tests/scripts/misc/fopen-fail: Skip on cygwin, where make eventually exits with exit code 0 and no error messages.
This commit is contained in:
parent
54214176b1
commit
cad3ddd165
@ -148,11 +148,16 @@ $ERR_command_not_found = undef;
|
||||
$ERR_nonexe_file = "$!";
|
||||
}
|
||||
|
||||
$_ = `./. 2>&1`;
|
||||
if ($? == 0) {
|
||||
print "Executed directory! Skipping related tests.\n";
|
||||
if ($^O =~ /cygwin/i) {
|
||||
# For some reason the execute here gives a different answer than make's
|
||||
print "Skipping directory execution on $^O\n";
|
||||
} else {
|
||||
$ERR_exe_dir = "$!";
|
||||
$_ = `./. 2>&1`;
|
||||
if ($? == 0) {
|
||||
print "Executed directory! Skipping related tests.\n";
|
||||
} else {
|
||||
$ERR_exe_dir = "$!";
|
||||
}
|
||||
}
|
||||
|
||||
chmod(0000, 'file.out');
|
||||
|
@ -99,7 +99,7 @@ if ($ERR_nonexe_file) {
|
||||
# Try failing by "running" a directory
|
||||
|
||||
if ($ERR_exe_dir) {
|
||||
mkdir('sd', 0775);
|
||||
mkdir('sd', 0775) or print "mkdir: sd: $!\n";
|
||||
|
||||
run_make_test(q!
|
||||
PATH := .
|
||||
|
@ -13,6 +13,7 @@ my $details = "The various shells that this test uses are the default"
|
||||
|
||||
# Only bother with this on UNIX systems
|
||||
$port_type eq 'UNIX' or return -1;
|
||||
$^O =~ /cygwin/ and return -1;
|
||||
|
||||
my $usersh = $origENV{SHELL};
|
||||
my $answer = 'hello, world';
|
||||
@ -36,7 +37,7 @@ for my $shbang (@shbangs) {
|
||||
close(CMD);
|
||||
chmod 0700, $cmd;
|
||||
|
||||
run_make_test("# $shbang\n# $shell" . q!
|
||||
run_make_test("# shbang=$shbang\n# shell=$shell" . q!
|
||||
all:; @$(CMD)
|
||||
!, "$shell CMD=$cmd", "$answer\n");
|
||||
|
||||
|
@ -55,8 +55,8 @@ run_make_test("
|
||||
all: hello$s
|
||||
%$s:$r %.c; \$(info hello.c)
|
||||
%$s:$r %.f; \$(info hello.f)
|
||||
hello.c:; false
|
||||
", '-r', "false\n#MAKE#: *** [#MAKEFILE#:5: hello.c] Error 1\n", 512);
|
||||
hello.c:; @#HELPER# fail 1
|
||||
", '-r', "fail 1\n#MAKE#: *** [#MAKEFILE#:5: hello.c] Error 1\n", 512);
|
||||
|
||||
# Test that make finds the intended implicit rule based on existence of a
|
||||
# prerequisite in the filesystem, even when the prerequisite of another
|
||||
@ -115,9 +115,9 @@ run_make_test("
|
||||
all: hello$s
|
||||
%$s:$r %.c; \$(info \$<)
|
||||
%$s:$r %.f; \$(info \$<)
|
||||
.DEFAULT:; \$(info \$\@) false
|
||||
.DEFAULT:; \@\$(info \$\@) #HELPER# fail 1
|
||||
unrelated: hello.c
|
||||
", '-r', "hello.c\nfalse\n#MAKE#: *** [#MAKEFILE#:5: hello.c] Error 1\n", 512);
|
||||
", '-r', "hello.c\nfail 1\n#MAKE#: *** [#MAKEFILE#:5: hello.c] Error 1\n", 512);
|
||||
|
||||
# hello.f is missing.
|
||||
# No rule is found, because hello.c is not mentioned explicitly.
|
||||
@ -125,8 +125,8 @@ run_make_test("
|
||||
all: hello$s
|
||||
%$s:$r %.c; \$(info \$<)
|
||||
%$s:$r %.f; \$(info \$<)
|
||||
.DEFAULT:; \@\$(info \$\@) false
|
||||
", '-r', "hello$s\n#MAKE#: *** [#MAKEFILE#:5: hello$s] Error 1\n", 512);
|
||||
.DEFAULT:; \@\$(info \$\@) #HELPER# fail 1
|
||||
", '-r', "hello$s\nfail 1\n#MAKE#: *** [#MAKEFILE#:5: hello$s] Error 1\n", 512);
|
||||
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ for my $r (@rules) {
|
||||
|
||||
my $result = "#MAKE#: *** No rule to make target 'hello.tsk', needed by 'all'. Stop.\n";
|
||||
if ($s or $r) {
|
||||
$result = "false\n#MAKE#: *** [#MAKEFILE#:6: hello.c] Error 1\n";
|
||||
$result = "fail 1\n#MAKE#: *** [#MAKEFILE#:6: hello.c] Error 1\n";
|
||||
}
|
||||
|
||||
run_make_test("
|
||||
@ -210,7 +210,7 @@ all: hello.tsk
|
||||
%.tsk: %$s; \$(info hello.tsk)
|
||||
%$s:$r %.c; \$(info hello.c)
|
||||
%$s:$r %.f; \$(info hello.f)
|
||||
hello.c:; false
|
||||
hello.c:; @#HELPER# fail 1
|
||||
", '-r', $result, 512);
|
||||
}
|
||||
}
|
||||
|
@ -190,10 +190,10 @@ run_make_test("
|
||||
load testapi.so
|
||||
$extra_loads
|
||||
all:; \$(info \$(test-expand hello))
|
||||
testapi.so: force; false
|
||||
testapi.so: force; @#HELPER# fail 1
|
||||
force:;
|
||||
.PHONY: force
|
||||
", '', "testapi_gmk_setup\nfalse\n#MAKE#: *** [#MAKEFILE#:$n: testapi.so] Error 1\n", 512);
|
||||
", '', "testapi_gmk_setup\nfail 1\n#MAKE#: *** [#MAKEFILE#:$n: testapi.so] Error 1\n", 512);
|
||||
|
||||
# sv 63045.
|
||||
# Same as above, but testapi_gmk_setup returned -1.
|
||||
@ -203,7 +203,7 @@ run_make_test("
|
||||
load testapi.so
|
||||
$extra_loads
|
||||
all:; \$(info \$(test-expand hello))
|
||||
testapi.so: force; false
|
||||
testapi.so: force; @#HELPER# fail 1
|
||||
force:;
|
||||
.PHONY: force
|
||||
", '', "testapi_gmk_setup\nhello\n#MAKE#: 'all' is up to date.\n");
|
||||
|
@ -116,20 +116,24 @@ EOF
|
||||
close(MAKEFILE);
|
||||
|
||||
# Test per-make synchronization.
|
||||
# Note we have to sleep again here after starting the foo makefile before
|
||||
# starting the bar makefile, otherwise the "entering/leaving" messages for the
|
||||
# submakes might be ordered differently than we expect.
|
||||
|
||||
unlink(@syncfiles);
|
||||
run_make_test(qq!
|
||||
all: make-foo make-bar
|
||||
|
||||
make-foo: ; \$(MAKE) -C foo
|
||||
|
||||
make-bar: ; \$(MAKE) -C bar!,
|
||||
make-bar: ; #HELPER# -q sleep 1 ; \$(MAKE) -C bar!,
|
||||
'-j -Orecurse',
|
||||
"#MAKEPATH# -C foo
|
||||
#MAKE#[1]: Entering directory '#PWD#/foo'
|
||||
foo: start
|
||||
foo: end
|
||||
#MAKE#[1]: Leaving directory '#PWD#/foo'
|
||||
#MAKEPATH# -C bar
|
||||
#HELPER# -q sleep 1 ; #MAKEPATH# -C bar
|
||||
#MAKE#[1]: Entering directory '#PWD#/bar'
|
||||
bar: start
|
||||
bar: end
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
$description = "Make sure make exits with an error if fopen fails.";
|
||||
|
||||
# For some reason on Cygwin, make exits with no error message after
|
||||
# it recurses for a while.
|
||||
$^O =~ /cygwin/ and return -1;
|
||||
|
||||
# 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.
|
||||
|
@ -6,14 +6,7 @@ $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;
|
||||
}
|
||||
exists $FEATURES{'check-symlink'} or return -1;
|
||||
|
||||
use File::Spec;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
$| = 1;
|
||||
|
||||
my $quiet = 0;
|
||||
my $timeout = 4;
|
||||
my $timeout = 10;
|
||||
|
||||
sub op {
|
||||
my ($op, $nm) = @_;
|
||||
|
Loading…
Reference in New Issue
Block a user