job-output.mk revision 1.2.4.2 1 # $NetBSD: job-output.mk,v 1.2.4.2 2025/08/02 05:58:35 perseant Exp $
2 #
3 # Tests for handling the output in parallel mode.
4
5 all: .PHONY
6 @${MAKE} -f ${MAKEFILE} -j1 empty-lines
7 @${MAKE} -f ${MAKEFILE} -j1 stdout-and-stderr
8 @${MAKE} -f ${MAKEFILE} -j1 echo-on-stdout-and-stderr
9
10 # By sleeping for a second, the output of the child process is written byte
11 # by byte, to be consumed in small pieces by make. No matter what the chunk
12 # size is, the empty lines must not be discarded.
13 empty-lines: .PHONY
14 @echo begin $@
15 @sleep 1
16 @echo
17 @sleep 1
18 @echo
19 @sleep 1
20 @echo end $@
21
22 # In parallel mode, both stdout and stderr from the child process are
23 # collected in a local buffer and then written to make's stdout.
24 #
25 # expect: begin stdout-and-stderr
26 # expect: only stdout:
27 # expect: This is stdout.
28 # expect: This is stderr.
29 # expect: only stderr:
30 # expect: end stdout-and-stderr
31 stdout-and-stderr:
32 @echo begin $@
33 @echo only stdout:
34 @${MAKE} -f ${MAKEFILE} echo-on-stdout-and-stderr 2>/dev/null
35 @echo only stderr:
36 @${MAKE} -f ${MAKEFILE} echo-on-stdout-and-stderr 1>/dev/null
37 @echo end $@
38
39 echo-on-stdout-and-stderr: .PHONY
40 @echo This is stdout.
41 @echo This is stderr. 1>&2
42