Special-case Windows error results

* tests/scripts/features/errors: Match Windows-specific errors.
* tests/scripts/features/targetvars: Match Windows-specific errors.
* tests/scripts/misc/general4: Match Windows-specific errors.
This commit is contained in:
Paul Smith 2021-11-28 14:17:55 -05:00
parent 116767901f
commit e62f4cf9a2
3 changed files with 51 additions and 9 deletions

View File

@ -31,6 +31,18 @@ all:
!,
'', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512);
# Windows error look completely different :-/
sub errors_getinfo
{
my ($cmd, $args) = @_;
if ($port_type eq 'W32') {
return (2, "process_begin: CreateProcess(NULL, $cmd $args, ...) failed.\nmake (e=2): The system cannot find the file specified.");
}
return (127, "#MAKE#: $cmd: $ERR_no_such_file");
}
# TEST #3
# -------
@ -38,35 +50,38 @@ all:
my $unk = './foobarbazbozblat';
unlink($unk);
my $err = $ERR_no_such_file;
my $ernum, $erstr;
($ernum, $erstr) = errors_getinfo($unk, "xx yy");
run_make_test(qq!
one: ; -$unk xx yy
!,
'one', "$unk xx yy\n#MAKE#: $unk: $err\n#MAKE#: [#MAKEFILE#:2: one] Error 127 (ignored)\n");
!, '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#MAKE#: $unk: $err\n#MAKE#: [#MAKEFILE#:2: two] Error 127 (ignored)\n");
"$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#MAKE#: $unk: $err\n#MAKE#: *** [#MAKEFILE#:2: two] Error 127\n", 512);
"$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#MAKE#: $unk: $err\n#MAKE#: *** [#MAKEFILE#:4: three] Error 127\n", 512);
"one\n$unk qq rr\n$erstr\n#MAKE#: *** [#MAKEFILE#:4: three] Error $ernum\n", 512);
# Try failing due to non-executable file

View File

@ -272,11 +272,20 @@ all: ; $sname >/dev/null
$ENV{PATH} = "$ENV{PATH}:sd";
my ($ernum, $erstr);
if ($port_type eq 'W32') {
$ernum = 1;
$erstr = "'$sname' is not recognized as an internal or external command,\noperable program or batch file.";
} else {
$ernum = 127;
$erstr = "#MAKE#: $sname: $ERR_no_such_file";
}
run_make_test(qq!
all: PATH := ..
all: ; $sname
!,
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
'', "$sname\n$erstr\n#MAKE#: *** [#MAKEFILE#:3: all] Error $ernum", 512);
unlink("sd/$sname");
rmdir ('sd');

View File

@ -96,11 +96,21 @@ all: ; $sname >/dev/null
$ENV{PATH} = "$ENV{PATH}:sd";
my ($ernum, $erstr);
if ($port_type eq 'W32') {
$ernum = 2;
$erstr = "process_begin: CreateProcess(NULL, $sname, ...) failed.\nmake (e=2): The system cannot find the file specified.";
} else {
$ernum = 127;
$erstr = "#MAKE#: $sname: $ERR_no_such_file";
}
run_make_test(qq!
PATH := ..
all: ; $sname
!,
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
'', "$sname\n$erstr\n#MAKE#: *** [#MAKEFILE#:3: all] Error $ernum", 512);
unlink("sd/$sname");
rmdir('sd');
@ -110,11 +120,19 @@ rmdir('sd');
create_file($sname, '');
chmod 0755, $sname;
if ($port_type eq 'W32') {
$ernum = -1;
$erstr = "";
} else {
$ernum = 127;
$erstr = "#MAKE#: $sname: $ERR_no_such_file\n";
}
run_make_test(qq!
PATH := ..
all: ; $sname
!,
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
'', "$sname\n$erstr#MAKE#: *** [#MAKEFILE#:3: all] Error $ernum", 512);
unlink($sname);