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