# -*-perl-*- $description = "Test ignored failures in recipe command lines"; my $answer ="exit 1 #MAKEFILE#:3: [one] error 1 (ignored) #0 one at $fulltestdir/#MAKEFILE#:2 exit 0 "; run_make_test(qq! one: \t-exit 1 \texit 0 two: \texit 1 \texit 0 !, "one", $answer); # TEST #1 # ------- $answer = "exit 1 #MAKEFILE#:6: [two] error 1 (ignored) #0 two at $fulltestdir/#MAKEFILE#:5 exit 0 "; run_make_test(undef, " -i two", $answer); # TEST #2 # ------- # Test that error line offset works $answer = "hi there #MAKEFILE#:4: *** [all] error 1 #0 all at $fulltestdir/#MAKEFILE#:2 "; run_make_test(qq! all: \t\@echo hi \t\@echo there \t\@exit 1 !, '', $answer, 512); # TEST #3 # ------- # Try failing due to unknown command my $unk = './foobarbazbozblat'; unlink($unk); my $err = $ERR_no_such_file; $answer = "$unk xx yy #MAKE#: $unk: $err #MAKEFILE#:2: [one] error 127 (ignored) #0 one at $fulltestdir/#MAKEFILE#:2 "; run_make_test(qq! one: ; -$unk xx yy !, 'one', $answer); # TEST #4 # ------- $answer = "$unk aa bb #MAKE#: $unk: $err #MAKEFILE#:2: [two] error 127 (ignored) #0 two at $fulltestdir/#MAKEFILE#:2 "; run_make_test(qq! two: ; $unk aa bb !, 'two -i', $answer); # TEST #5 # ------- $answer = "$unk aa bb #MAKE#: $unk: $err #MAKEFILE#:2: *** [two] error 127 #0 two at $fulltestdir/#MAKEFILE#:2 "; run_make_test(undef, 'two', $answer, 512); # SV #56918 : Test the unknown command as the second recipe line $answer = "one $unk qq rr #MAKE#: $unk: $err #MAKEFILE#:3: *** [three] error 127 #0 three at $fulltestdir/#MAKEFILE#:2 "; run_make_test(qq! three: \t\@echo one \t$unk qq rr !, 'three', $answer, 512); # Try failing due to non-executable file if ($ERR_nonexe_file) { my $noexe = './barfooblatboz'; touch($noexe); $answer = "$noexe xx yy #MAKE#: $noexe: $ERR_nonexe_file #MAKEFILE#:2: [one] error 127 (ignored) #0 one at $fulltestdir/#MAKEFILE#:2 "; run_make_test(qq! one: ; -$noexe xx yy two: ; $noexe aa bb !, 'one', $answer); unlink($noexe); } # 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'); } 1;