Tue Sep 29 18:16:24 2020 UTC ()
make(1): fix test job-output-long-lines

The test failed on Linux since the test relied on the two child
processes interleaving each other.  This is not guaranteed to happen
though.


(rillig)
diff -r1.154 -r1.155 src/usr.bin/make/unit-tests/Makefile
diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/job-output-long-lines.exp
diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/job-output-long-lines.mk

cvs diff -r1.154 -r1.155 src/usr.bin/make/unit-tests/Makefile (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/Makefile 2020/09/27 20:11:34 1.154
+++ src/usr.bin/make/unit-tests/Makefile 2020/09/29 18:16:24 1.155
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.154 2020/09/27 20:11:34 rillig Exp $ 1# $NetBSD: Makefile,v 1.155 2020/09/29 18:16:24 rillig Exp $
2# 2#
3# Unit tests for make(1) 3# Unit tests for make(1)
4# 4#
5# The main targets are: 5# The main targets are:
6# 6#
7# all: 7# all:
8# run all the tests 8# run all the tests
9# test: 9# test:
10# run 'all', and compare to expected results 10# run 'all', and compare to expected results
11# accept: 11# accept:
12# move generated output to expected results 12# move generated output to expected results
13# 13#
14# Settable variables 14# Settable variables
@@ -375,47 +375,56 @@ FLAGS.opt-no-action= -n @@ -375,47 +375,56 @@ FLAGS.opt-no-action= -n
375FLAGS.opt-query= -q 375FLAGS.opt-query= -q
376FLAGS.opt-var-expanded= -v VAR -v VALUE 376FLAGS.opt-var-expanded= -v VAR -v VALUE
377FLAGS.opt-var-literal= -V VAR -V VALUE 377FLAGS.opt-var-literal= -V VAR -V VALUE
378FLAGS.opt-warnings-as-errors= -W 378FLAGS.opt-warnings-as-errors= -W
379FLAGS.order= -j1 379FLAGS.order= -j1
380FLAGS.recursive= -dL 380FLAGS.recursive= -dL
381FLAGS.sh-leading-plus= -n 381FLAGS.sh-leading-plus= -n
382FLAGS.vardebug= -k -dv FROM_CMDLINE= 382FLAGS.vardebug= -k -dv FROM_CMDLINE=
383FLAGS.varmod-match-escape= -dv 383FLAGS.varmod-match-escape= -dv
384FLAGS.varname-dot-shell= -dpv 384FLAGS.varname-dot-shell= -dpv
385FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmline-plain' 385FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmline-plain'
386 386
387# Some tests need extra postprocessing. 387# Some tests need extra postprocessing.
 388SED_CMDS.job-output-long-lines= \
 389 ${:D Job separators on their own line are ok. } \
 390 -e '/^--- job-[ab] ---$$/d' \
 391 ${:D Plain output lines are ok as well. } \
 392 ${:D They may come in multiples of 1024 or as 10000. } \
 393 -e '/^aa*$$/d' \
 394 -e '/^bb*$$/d' \
 395 ${:D The following lines should rather not occur since the job } \
 396 ${:D marker should always be at the beginning of the line. } \
 397 -e '/^aa*--- job-b ---$$/d' \
 398 -e '/^bb*--- job-a ---$$/d'
388SED_CMDS.opt-debug-graph1= \ 399SED_CMDS.opt-debug-graph1= \
389 -e 's,${.CURDIR},CURDIR,' 400 -e 's,${.CURDIR},CURDIR,'
390SED_CMDS.opt-debug-graph1+= \ 401SED_CMDS.opt-debug-graph1+= \
391 -e '/Global Variables:/,/Suffixes:/d' 402 -e '/Global Variables:/,/Suffixes:/d'
392SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,' 403SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,<normalized: ...: not found>,'
393SED_CMDS.varmod-subst-regex+= \ 404SED_CMDS.varmod-subst-regex+= \
394 -e 's,\(Regex compilation error:\).*,\1 (details omitted),' 405 -e 's,\(Regex compilation error:\).*,\1 (details omitted),'
395SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,' 406SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,'
396SED_CMDS.varshell+= -e 's,^${.SHELL:T}: ,,' 407SED_CMDS.varshell+= -e 's,^${.SHELL:T}: ,,'
397SED_CMDS.varshell+= -e '/command/s,No such.*,not found,' 408SED_CMDS.varshell+= -e '/command/s,No such.*,not found,'
398SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,' 409SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
399SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,' 410SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
400SED_CMDS.varname-dot-shell= -e 's, = /.*, = (details omitted),' 411SED_CMDS.varname-dot-shell= -e 's, = /.*, = (details omitted),'
401SED_CMDS.varname-dot-shell+= -e 's,"/[^"]*","(details omitted)",' 412SED_CMDS.varname-dot-shell+= -e 's,"/[^"]*","(details omitted)",'
402SED_CMDS.varname-dot-shell+= -e 's,\[/[^]]*\],[(details omitted)],' 413SED_CMDS.varname-dot-shell+= -e 's,\[/[^]]*\],[(details omitted)],'
403 414
404# Some tests need an additional round of postprocessing. 415# Some tests need an additional round of postprocessing.
405POSTPROC.deptgt-suffixes= \ 416POSTPROC.deptgt-suffixes= \
406 ${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p' 417 ${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
407POSTPROC.job-output-long-lines= \ 
408 awk '/^[ab]+--- job-[ab] ---/ { print "bad"; exit }' 
409POSTPROC.vardebug= ${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p' 418POSTPROC.vardebug= ${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'
410POSTPROC.varmod-match-escape= ${TOOL_SED} -n -e '/^Pattern/p' 419POSTPROC.varmod-match-escape= ${TOOL_SED} -n -e '/^Pattern/p'
411POSTPROC.varname= ${TOOL_SED} -n -e '/^MAGIC/p' -e '/^ORDER_/p' 420POSTPROC.varname= ${TOOL_SED} -n -e '/^MAGIC/p' -e '/^ORDER_/p'
412POSTPROC.varname-dot-shell= \ 421POSTPROC.varname-dot-shell= \
413 awk '/\.SHELL/ || /^ParseReadLine/' 422 awk '/\.SHELL/ || /^ParseReadLine/'
414POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p' 423POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
415 424
416# Some tests reuse other tests, which makes them unnecessarily fragile. 425# Some tests reuse other tests, which makes them unnecessarily fragile.
417export-all.rawout: export.mk 426export-all.rawout: export.mk
418unexport.rawout: export.mk 427unexport.rawout: export.mk
419unexport-env.rawout: export.mk 428unexport-env.rawout: export.mk
420 429
421# End of the configuration section. 430# End of the configuration section.

cvs diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/job-output-long-lines.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/job-output-long-lines.exp 2020/09/27 20:11:34 1.1
+++ src/usr.bin/make/unit-tests/job-output-long-lines.exp 2020/09/29 18:16:24 1.2

cvs diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/job-output-long-lines.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/job-output-long-lines.mk 2020/09/27 20:11:34 1.1
+++ src/usr.bin/make/unit-tests/job-output-long-lines.mk 2020/09/29 18:16:24 1.2
@@ -1,32 +1,28 @@ @@ -1,32 +1,28 @@
1# $NetBSD: job-output-long-lines.mk,v 1.1 2020/09/27 20:11:34 rillig Exp $ 1# $NetBSD: job-output-long-lines.mk,v 1.2 2020/09/29 18:16:24 rillig Exp $
2# 2#
3# The jobs may produce long lines of output. A practical case are the echoed 3# The jobs may produce long lines of output. A practical case are the echoed
4# command lines from compiler invocations, with their many -D options. 4# command lines from compiler invocations, with their many -D options.
5# 5#
6# Each of these lines must be written atomically to the actual output. 6# Each of these lines must be written atomically to the actual output.
7# The markers for switching jobs must always be written at the beginning of 7# The markers for switching jobs must always be written at the beginning of
8# the line, to make them clearly visible in large log files. 8# the line, to make them clearly visible in large log files.
9#  9#
10# As of 2020-09-27, the default job buffer size is 1024. When a job produces 10# As of 2020-09-27, the default job buffer size is 1024. When a job produces
11# output lines that are longer than this buffer size, these output pieces are 11# output lines that are longer than this buffer size, these output pieces are
12# not terminated by a newline. Because of this missing newline, the job 12# not terminated by a newline. Because of this missing newline, the job
13# markers "--- job-a ---" and "--- job-b ---" are not always written at the 13# markers "--- job-a ---" and "--- job-b ---" are not always written at the
14# beginning of a line, even though this is expected by anyone reading the log 14# beginning of a line, even though this is expected by anyone reading the log
15# files. 15# files.
16# 
17# See Makefile, POSTPROC.job-output-long-lines for the output postprocessing. 
18# 
19# Tags: probabilistic 
20 16
21.MAKEFLAGS: -j2 17.MAKEFLAGS: -j2
22 18
23100:= ${:U1:S,1,2222222222,g:S,2,3333333333,g} 19100:= ${:U1:S,1,2222222222,g:S,2,3333333333,g}
2410000:= ${100:S,3,4444444444,g:S,4,xxxxxxxxxx,g} 2010000:= ${100:S,3,4444444444,g:S,4,xxxxxxxxxx,g}
25 21
26all: job-a job-b 22all: job-a job-b
27 23
28job-a: 24job-a:
29.for i in ${:U:range=100} 25.for i in ${:U:range=100}
30 @echo ${10000:S,x,a,g} 26 @echo ${10000:S,x,a,g}
31.endfor 27.endfor
32 28