make/tests/scripts/targets/IGNORE
Paul Smith 3176b60566 [SV 64085] Handle .POSIX plus .IGNORE correctly
POSIX requires that a conforming makefile should not use -e if
 1) make is invoked with -i
 2) A .IGNORE target exists with no prerequisites
 3) The current target is a prerequisite of .IGNORE

* src/job.c (start_job_command): Add the target's flags when
constructing argv so it can check (3) above.
(construct_command_argv_internal): Don't set shellflags if it's not
set: this only happens if we're parsing for the slow path and we
don't need them.
(construct_command_argv): Don't allocate buffers if not needed.
When detecting "-ec", check the global ignore_errors_flag and the
current command line flags.
* tests/scripts/targets/IGNORE: Add tests for .IGNORE.
* tests/scripts/targets/POSIX: Add tests for the three cases above.
2024-02-04 19:41:50 -05:00

28 lines
588 B
Perl

# -*-perl-*-
$description = "Test the behaviour of the .IGNORE target.";
$details = "";
# Without any ignore
run_make_test(q!
all: ; @#HELPER# -q fail 1
!,
'', "#MAKE#: *** [#MAKEFILE#:2: all] Error 1", 512);
# Global .IGNORE
run_make_test(q!
.IGNORE:
all: ; @#HELPER# -q fail 1
!,
'', "#MAKE#: [#MAKEFILE#:3: all] Error 1 (ignored)");
# Specific .IGNORE
run_make_test(q!
.IGNORE: all
all: ; @#HELPER# -q fail 1
!,
'', "#MAKE#: [#MAKEFILE#:3: all] Error 1 (ignored)");
1;