2005-12-13 22:44:17 +08:00
|
|
|
# -*-perl-*-
|
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
$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");
|
1999-09-14 10:03:19 +08:00
|
|
|
|
|
|
|
# TEST #1
|
|
|
|
# -------
|
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
run_make_test(undef, " -i two",
|
|
|
|
"exit 1\n#MAKE#: [#MAKEFILE#;6: two] Error 1 (ignored)\nexit 0\n");
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
# TEST #2
|
|
|
|
# -------
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
# Test that error line offset works
|
2004-05-17 03:16:52 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
run_make_test(qq!
|
|
|
|
all:
|
|
|
|
\t\@echo hi
|
|
|
|
\t\@echo there
|
|
|
|
\t\@exit 1
|
|
|
|
!,
|
|
|
|
'', "hi\nthere\n#MAKE#: *** [#MAKEFILE#;5: all] Error 1", 512);
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
# TEST #3
|
|
|
|
# -------
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
# Try failing due to unknown command
|
|
|
|
my $unk = './foobarbazbozblat';
|
|
|
|
unlink($unk);
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
my $err = $ERR_no_such_file;
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
# TEST #4
|
1999-09-14 10:03:19 +08:00
|
|
|
# -------
|
|
|
|
|
2019-09-22 03:11:21 +08:00
|
|
|
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");
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
# TEST #5
|
|
|
|
# -------
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
run_make_test(undef, 'two',
|
2019-09-22 03:11:21 +08:00
|
|
|
"$unk aa bb\n#MAKE#: $unk: $err\n#MAKE#: *** [#MAKEFILE#;2: two] Error 127\n", 512);
|
|
|
|
|
|
|
|
# SV #56918 : Test the unknown command as the second recipe line
|
|
|
|
|
|
|
|
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);
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
# Try failing due to non-executable file
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2019-09-15 03:41:58 +08:00
|
|
|
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);
|
|
|
|
}
|
2016-04-11 05:12:48 +08:00
|
|
|
|
2019-09-15 03:58:57 +08:00
|
|
|
# Try failing by "running" a directory
|
|
|
|
|
|
|
|
if ($ERR_exe_dir) {
|
|
|
|
mkdir('sd', 0775);
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
PATH := .
|
|
|
|
all: ; sd
|
|
|
|
!,
|
|
|
|
'', "sd\n#MAKE#: sd: $ERR_exe_dir\n#MAKE#: *** [#MAKEFILE#;3: all] Error 127", 512);
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
all: ; ./sd
|
|
|
|
!,
|
|
|
|
'', "./sd\n#MAKE#: ./sd: $ERR_exe_dir\n#MAKE#: *** [#MAKEFILE#;2: all] Error 127", 512);
|
|
|
|
|
|
|
|
rmdir('sd');
|
|
|
|
}
|
|
|
|
|
2018-08-05 00:20:11 +08:00
|
|
|
1;
|