[m-dev.] Interleaved output in hlc.gc.par

Julien Fischer jfischer at opturion.com
Thu Sep 17 23:53:04 AEST 2015


On Thu, 17 Sep 2015, Paul Bone wrote:

>
> While I was testing the boehm_gc changes in hlc.gc.par tl_backjump_test
> failed as follows:
>
> paul at oxygen> diff -u tests/hard_coded/tl_backjump_test.{exp,out}
> --- tests/hard_coded/tl_backjump_test.exp       2014-11-12 12:16:20.420852421 +1100
> +++ tests/hard_coded/tl_backjump_test.out       2015-09-17 14:58:47.463777533 +1000
> @@ -20,9 +20,8 @@
> (TID: #2) solution 2, 2, 2
> (TID: #2) label C = 3, (14)
> (TID: #2) Solutions:
> -(TID: #2) {1, 1, 3},
> -(TID: #2) {2, 1, 1},
> -(TID: #2) {2, 2, 2}
> +(TID: #2) (TID: #3) label C = 3, (14)
> +(TID: #2) (TID: #3) {2{, 21, , 1},
> (TID: #3) label A = 1, (0)
> (TID: #3) label B = 1, (1)
> (TID: #3) label C = 1, (2)
> @@ -43,8 +42,6 @@
> (TID: #3) label C = 1, (12)
> (TID: #3) label C = 2, (13)
> (TID: #3) solution 2, 2, 2
> -(TID: #3) label C = 3, (14)
> (TID: #3) Solutions:
> -(TID: #3) {1, 1, 3},
> -(TID: #3) {2, 1, 1},
> +(TID: #3) {{11, , 11, , 33}},
> (TID: #3) {2, 2, 2}
>
> As this is a multithreaded test the test suite sorts output lines so that
> interleaving does not affect the result of the test.  However the output of the
> threads is interleaved _within_ lines.

The reasons for this have been discussed in the rest of this thread.
If you've ever tried at the the concurrency examples in the hlc.par.gc
grade you'll notice that they (sometimes) do the same thing.

I think the best thing to do here would be to re-write the test so
run_problem and its descendents don't write anything to I/O streams but
instead build up a list of strings to print inside io_mutvars that are
passed to each thread and then extract and print those lists of strings
*after* all the worker threads have finished running.

Julien.



More information about the developers mailing list