Module Name:    src
Committed By:   rillig
Date:           Sun Sep 27 20:11:34 UTC 2020

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile
Added Files:
        src/usr.bin/make/unit-tests: job-output-long-lines.exp
            job-output-long-lines.mk

Log Message:
make(1): add test for merging long lines of job output


To generate a diff of this commit:
cvs rdiff -u -r1.930 -r1.931 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.153 -r1.154 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/job-output-long-lines.exp \
    src/usr.bin/make/unit-tests/job-output-long-lines.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.930 src/distrib/sets/lists/tests/mi:1.931
--- src/distrib/sets/lists/tests/mi:1.930	Fri Sep 25 23:24:49 2020
+++ src/distrib/sets/lists/tests/mi	Sun Sep 27 20:11:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.930 2020/09/25 23:24:49 rillig Exp $
+# $NetBSD: mi,v 1.931 2020/09/27 20:11:33 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4812,6 +4812,8 @@
 ./usr/tests/usr.bin/make/unit-tests/include-main.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/include-sub.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/include-subsub.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.exp					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.mk					tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/make-exported.exp				tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.153 src/usr.bin/make/unit-tests/Makefile:1.154
--- src/usr.bin/make/unit-tests/Makefile:1.153	Sun Sep 27 13:18:30 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Sep 27 20:11:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.153 2020/09/27 13:18:30 rillig Exp $
+# $NetBSD: Makefile,v 1.154 2020/09/27 20:11:34 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -169,6 +169,7 @@ TESTS+=		forloop
 TESTS+=		forsubst
 TESTS+=		impsrc
 TESTS+=		include-main
+TESTS+=		job-output-long-lines
 TESTS+=		lint
 TESTS+=		make-exported
 TESTS+=		misc
@@ -403,6 +404,8 @@ SED_CMDS.varname-dot-shell+=	-e 's,\[/[^
 # Some tests need an additional round of postprocessing.
 POSTPROC.deptgt-suffixes= \
 			${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
+POSTPROC.job-output-long-lines= \
+			awk '/^[ab]+--- job-[ab] ---/ { print "bad"; exit }'
 POSTPROC.vardebug=	${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'
 POSTPROC.varmod-match-escape= ${TOOL_SED} -n -e '/^Pattern/p'
 POSTPROC.varname=	${TOOL_SED} -n -e '/^MAGIC/p' -e '/^ORDER_/p'

Added files:

Index: src/usr.bin/make/unit-tests/job-output-long-lines.exp
diff -u /dev/null src/usr.bin/make/unit-tests/job-output-long-lines.exp:1.1
--- /dev/null	Sun Sep 27 20:11:34 2020
+++ src/usr.bin/make/unit-tests/job-output-long-lines.exp	Sun Sep 27 20:11:34 2020
@@ -0,0 +1,2 @@
+bad
+exit status 0
Index: src/usr.bin/make/unit-tests/job-output-long-lines.mk
diff -u /dev/null src/usr.bin/make/unit-tests/job-output-long-lines.mk:1.1
--- /dev/null	Sun Sep 27 20:11:34 2020
+++ src/usr.bin/make/unit-tests/job-output-long-lines.mk	Sun Sep 27 20:11:34 2020
@@ -0,0 +1,36 @@
+# $NetBSD: job-output-long-lines.mk,v 1.1 2020/09/27 20:11:34 rillig Exp $
+#
+# The jobs may produce long lines of output.  A practical case are the echoed
+# command lines from compiler invocations, with their many -D options.
+#
+# Each of these lines must be written atomically to the actual output.
+# The markers for switching jobs must always be written at the beginning of
+# the line, to make them clearly visible in large log files.
+# 
+# As of 2020-09-27, the default job buffer size is 1024.  When a job produces
+# output lines that are longer than this buffer size, these output pieces are
+# not terminated by a newline.  Because of this missing newline, the job
+# markers "--- job-a ---" and "--- job-b ---" are not always written at the
+# beginning of a line, even though this is expected by anyone reading the log
+# files.
+#
+# See Makefile, POSTPROC.job-output-long-lines for the output postprocessing.
+#
+# Tags: probabilistic
+
+.MAKEFLAGS: -j2
+
+100:=	${:U1:S,1,2222222222,g:S,2,3333333333,g}
+10000:=	${100:S,3,4444444444,g:S,4,xxxxxxxxxx,g}
+
+all: job-a job-b
+
+job-a:
+.for i in ${:U:range=100}
+	@echo ${10000:S,x,a,g}
+.endfor
+
+job-b:
+.for i in ${:U:range=100}
+	@echo ${10000:S,x,b,g}
+.endfor

Reply via email to