Home | History | Annotate | Line # | Download | only in unit-tests
job-output.mk revision 1.1
      1 # $NetBSD: job-output.mk,v 1.1 2025/06/05 21:56:54 rillig 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.
     12 #
     13 # FIXME: When reading an isolated newline character in CollectOutput, it is
     14 # not passed on to the main output.
     15 empty-lines: .PHONY
     16 	@echo begin $@
     17 	@sleep 1
     18 	@echo
     19 	@sleep 1
     20 	@echo
     21 	@sleep 1
     22 	@echo end $@
     23 
     24 # In parallel mode, both stdout and stderr from the child process are
     25 # collected in a local buffer and then written to make's stdout.
     26 #
     27 # expect: begin stdout-and-stderr
     28 # expect: only stdout:
     29 # expect: This is stdout.
     30 # expect: This is stderr.
     31 # expect: only stderr:
     32 # expect: end stdout-and-stderr
     33 stdout-and-stderr:
     34 	@echo begin $@
     35 	@echo only stdout:
     36 	@${MAKE} -f ${MAKEFILE} echo-on-stdout-and-stderr 2>/dev/null
     37 	@echo only stderr:
     38 	@${MAKE} -f ${MAKEFILE} echo-on-stdout-and-stderr 1>/dev/null
     39 	@echo end $@
     40 
     41 echo-on-stdout-and-stderr: .PHONY
     42 	@echo This is stdout.
     43 	@echo This is stderr. 1>&2
     44