[SV 56918] Compute job slots properly on failing command

Ensure we properly reduce job_slots_used if a command fails because
it doesn't exist/can't be started.

* src/job.h (struct child): Add a field jobslot to be set when using
a job slot.
* src/job.c (start_waiting_job): Remember if we are using a job slot.
(reap_children): Reduce number of job slots used by jobslot.
This commit is contained in:
Paul Smith
2019-09-21 15:11:21 -04:00
parent e1c072aa7e
commit bd4ce86785
3 changed files with 21 additions and 8 deletions

View File

@@ -42,21 +42,31 @@ my $err = $ERR_no_such_file;
run_make_test(qq!
one: ; -$unk xx yy
two: ; $unk aa bb
!,
'one', "$unk xx yy\n#MAKE#: $unk: $err\n#MAKE#: [#MAKEFILE#;2: one] Error 127 (ignored)\n");
# TEST #4
# -------
run_make_test(undef, 'two -i',
"$unk aa bb\n#MAKE#: $unk: $err\n#MAKE#: [#MAKEFILE#;3: two] Error 127 (ignored)\n");
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");
# TEST #5
# -------
run_make_test(undef, 'two',
"$unk aa bb\n#MAKE#: $unk: $err\n#MAKE#: *** [#MAKEFILE#;3: two] Error 127\n", 512);
"$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);
# Try failing due to non-executable file