Home | History | Annotate | Line # | Download | only in unit-tests
job-output-null.mk revision 1.1
      1  1.1  rillig # $NetBSD: job-output-null.mk,v 1.1 2021/04/15 19:02:29 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Test how null bytes in the output of a command are handled.  Make processes
      4  1.1  rillig # them using null-terminated strings, which may cut off some of the output.
      5  1.1  rillig #
      6  1.1  rillig # As of 2021-04-15, make handles null bytes from the child process
      7  1.1  rillig # inconsistently.  It's an edge case though since typically the child
      8  1.1  rillig # processes output text.
      9  1.1  rillig 
     10  1.1  rillig .MAKEFLAGS: -j1		# force jobs mode
     11  1.1  rillig 
     12  1.1  rillig all: .PHONY
     13  1.1  rillig 	# The null byte from the command output is kept as-is.
     14  1.1  rillig 	# See CollectOutput, which looks like it intended to replace these
     15  1.1  rillig 	# null bytes with simple spaces.
     16  1.1  rillig 	@printf 'hello\0world%s\n' ''
     17  1.1  rillig 
     18  1.1  rillig 	# Give the parent process a chance to see the above output, but not
     19  1.1  rillig 	# yet the output from the next printf command.
     20  1.1  rillig 	@sleep 1
     21  1.1  rillig 
     22  1.1  rillig 	# All null bytes from the command output are kept as-is.
     23  1.1  rillig 	@printf 'hello\0world%s\n' '' '' '' '' '' ''
     24  1.1  rillig 
     25  1.1  rillig 	@sleep 1
     26  1.1  rillig 
     27  1.1  rillig 	# The null bytes are replaced with spaces since they are not followed
     28  1.1  rillig 	# by a newline.
     29  1.1  rillig 	#
     30  1.1  rillig 	# The three null bytes in a row test whether this output is
     31  1.1  rillig 	# compressed to a single space like in DebugFailedTarget.  It isn't.
     32  1.1  rillig 	@printf 'hello\0world\0without\0\0\0newline%s' ', ' ', ' '.'
     33