mirror of
https://github.com/mirror/make.git
synced 2025-01-22 18:20:50 +08:00
a581146562
Strawberry Perl has some different behaviors from ActiveState Perl which impact the test suite: - Avoid Perl's chomp() as it may not remove CRs; chomp() may remove only the final NL but not the CR in a CRNL line ending. - Strawberry Perl doesn't support ActiveState's system(1, ...) form. - Strawberry Perl (or msys?) does something weird with "/tmp" when provided to exec(), replacing it with the user's %TEMP%. - Strawberry Perl uses msys paths like /c/foo instead of C:\foo. * tests/test_driver.pl (get_osname): Strawberry Perl uses 'msys' as its $^O so if we see that use a port of 'W32'. (_run_with_timeout): Strawberry Perl doesn't support the special system(1, ...) form of system() so use POSIX standard fork/exec. (compare_answer): Paths generated by Strawberry Perl use msys path format (e.g., /c/foo instead of C:\foo); check for those differences and compare RE against both the unmodified and modified log. * tests/run_make_tests.pl (set_defaults): Switch from chomp to s/// to remove CRNL and NL line endings. * tests/scripts/features/errors: Executing directories on Strawberry will give an error; translate it to Windows error output format. * tests/scripts/features/output-sync: Ditto. * tests/scripts/features/temp_stdin: Ditto. * tests/scripts/functions/realpath: Ditto. * tests/scripts/options/dash-I: Ditto. * tests/scripts/variables/INCLUDE_DIRS: Ditto. * tests/scripts/misc/close_stdout: /dev/full is reported as existing on Strawberry Perl, but it doesn't do anything. Skip the test. * tests/scripts/variables/MAKEFLAGS: When an argument containing /tmp is passed to a program via exec(), something replaces it with the expansion of the %TEMP% variable. Instead of using /tmp create a local directory to use.
130 lines
2.9 KiB
Perl
130 lines
2.9 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test ignored failures in recipe command lines";
|
|
|
|
run_make_test(qq!
|
|
one:
|
|
\t-exit 1
|
|
\texit 0
|
|
two:
|
|
\texit 1
|
|
\texit 0
|
|
!,
|
|
"one", "exit 1\n#MAKE#: [#MAKEFILE#:3: one] Error 1 (ignored)\nexit 0\n");
|
|
|
|
# TEST #1
|
|
# -------
|
|
|
|
run_make_test(undef, " -i two",
|
|
"exit 1\n#MAKE#: [#MAKEFILE#:6: two] Error 1 (ignored)\nexit 0\n");
|
|
|
|
# TEST #2
|
|
# -------
|
|
|
|
# Test that error line offset works
|
|
|
|
run_make_test(qq!
|
|
all:
|
|
\t\@echo hi
|
|
\t\@echo there
|
|
\t\@exit 1
|
|
!,
|
|
'', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512);
|
|
|
|
# Windows error look completely different :-/
|
|
|
|
sub errors_getinfo
|
|
{
|
|
my ($cmd, $args, $err) = @_;
|
|
if ($port_type eq 'W32') {
|
|
return (2, "process_begin: CreateProcess(NULL, $cmd$args, ...) failed.\nmake (e=2): The system cannot find the file specified.");
|
|
}
|
|
|
|
if (!$err) { $err = $ERR_no_such_file; }
|
|
return (127, "#MAKE#: $cmd: $err");
|
|
}
|
|
|
|
# TEST #3
|
|
# -------
|
|
|
|
# Try failing due to unknown command
|
|
my $unk = './foobarbazbozblat';
|
|
unlink($unk);
|
|
|
|
my ($ernum, $erstr) = errors_getinfo($unk, " xx yy");
|
|
run_make_test(qq!
|
|
one: ; -$unk xx yy
|
|
!, 'one',
|
|
"$unk xx yy\n$erstr\n#MAKE#: [#MAKEFILE#:2: one] Error $ernum (ignored)\n");
|
|
|
|
# TEST #4
|
|
# -------
|
|
|
|
($ernum, $erstr) = errors_getinfo($unk, " aa bb");
|
|
run_make_test(qq!
|
|
two: ; $unk aa bb
|
|
!, 'two -i',
|
|
"$unk aa bb\n$erstr\n#MAKE#: [#MAKEFILE#:2: two] Error $ernum (ignored)\n");
|
|
|
|
# TEST #5
|
|
# -------
|
|
|
|
run_make_test(undef, 'two',
|
|
"$unk aa bb\n$erstr\n#MAKE#: *** [#MAKEFILE#:2: two] Error $ernum\n", 512);
|
|
|
|
# SV #56918 : Test the unknown command as the second recipe line
|
|
|
|
($ernum, $erstr) = errors_getinfo($unk, " qq rr");
|
|
run_make_test(qq!
|
|
three:
|
|
\t\@echo one
|
|
\t$unk qq rr
|
|
!, 'three',
|
|
"one\n$unk qq rr\n$erstr\n#MAKE#: *** [#MAKEFILE#:4: three] Error $ernum\n", 512);
|
|
|
|
# Try failing due to non-executable file
|
|
|
|
if ($ERR_nonexe_file) {
|
|
my $noexe = './barfooblatboz';
|
|
touch($noexe);
|
|
|
|
run_make_test(qq!
|
|
one: ; -$noexe xx yy
|
|
two: ; $noexe aa bb
|
|
!,
|
|
'one', "$noexe xx yy\n#MAKE#: $noexe: $ERR_nonexe_file\n#MAKE#: [#MAKEFILE#:2: one] Error 127 (ignored)\n");
|
|
|
|
unlink($noexe);
|
|
}
|
|
|
|
# Try failing by "running" a directory
|
|
|
|
if ($ERR_exe_dir) {
|
|
mkdir('sd', 0775) or print "mkdir: sd: $!\n";
|
|
|
|
($ernum, $erstr) = errors_getinfo('sd', '', $ERR_exe_dir);
|
|
|
|
run_make_test(q!
|
|
PATH := .
|
|
all: ; sd
|
|
!,
|
|
'', "sd\n$erstr\n#MAKE#: *** [#MAKEFILE#:3: all] Error $ernum", 512);
|
|
|
|
if ($port_type eq 'W32') {
|
|
$ernum = 5;
|
|
$erstr = "process_begin: CreateProcess(NULL, ./sd, ...) failed.\nmake (e=5): Access is denied.";
|
|
} else {
|
|
$ernum = 127;
|
|
$erstr = "#MAKE#: ./sd: $ERR_exe_dir";
|
|
}
|
|
|
|
run_make_test(q!
|
|
all: ; ./sd
|
|
!,
|
|
'', "./sd\n$erstr\n#MAKE#: *** [#MAKEFILE#:2: all] Error $ernum", 512);
|
|
|
|
rmdir('sd');
|
|
}
|
|
|
|
1;
|