| 1 |
# This test verifies test case parallelization and control over that |
| 2 |
# parallelization via serializers. |
| 3 |
# |
| 4 |
# %TEST-EXEC: chmod +x normalize-output |
| 5 |
# |
| 6 |
# 5 tests with 5 threads parallelize completely, but tests 4 and 5 are |
| 7 |
# serialized, so must end up in a single thread. The following groups |
| 8 |
# all test numbers run by a given thread on a single line, and confirms |
| 9 |
# that one of them includes 4, then 5. |
| 10 |
# %TEST-EXEC: btest -j 5 t1 t2 t3 t4 t5 2>&1 | ./normalize-output | grep "4.*5" | sed "s/[0-36-9] //" >output.j5 |
| 11 |
# |
| 12 |
# Single-thread operation is the default, so "-j 1" should yield same output. |
| 13 |
# %TEST-EXEC: btest -j 1 t1 t2 t3 t4 t5 2>&1 | cat >output.j1 |
| 14 |
# %TEST-EXEC: btest -j 0 t1 t2 t3 t4 t5 2>&1 | cat >output.j0 |
| 15 |
# |
| 16 |
# %TEST-EXEC: btest-diff output.j5 |
| 17 |
# %TEST-EXEC: btest-diff output.j1 |
| 18 |
# %TEST-EXEC: btest-diff output.j0 |
| 19 |
|
| 20 |
# In multithreaded output, this looks for lines with the thread-number |
| 21 |
# prefix (e.g. "[#2] t4 ... ok"), transforms them into lines separating |
| 22 |
# thread and test numbers by whitespace (e.g. "test 4 thread 2"), groups |
| 23 |
# tests run by the same thread into the same line, and sorts this. |
| 24 |
%TEST-START-FILE normalize-output |
| 25 |
grep '\#' | \ |
| 26 |
sed 's/.#\([0-9]\). .\([0-9]\).*/test \2 thread \1/g' | \ |
| 27 |
awk '{t[$4] = t[$4] " " $2} END{ for ( i in t ) print t[i];}' | \ |
| 28 |
sort |
| 29 |
%TEST-END-FILE |
| 30 |
|
| 31 |
%TEST-START-FILE t1 |
| 32 |
@TEST-EXEC: echo t1 >output |
| 33 |
%TEST-END-FILE |
| 34 |
|
| 35 |
%TEST-START-FILE t2 |
| 36 |
@TEST-EXEC: echo t2 >output |
| 37 |
%TEST-END-FILE |
| 38 |
|
| 39 |
%TEST-START-FILE t3 |
| 40 |
@TEST-EXEC: echo t3 >output |
| 41 |
%TEST-END-FILE |
| 42 |
|
| 43 |
%TEST-START-FILE t4 |
| 44 |
@TEST-SERIALIZE: Foo |
| 45 |
@TEST-EXEC: echo t4 >output |
| 46 |
%TEST-END-FILE |
| 47 |
|
| 48 |
%TEST-START-FILE t5 |
| 49 |
@TEST-SERIALIZE: Foo |
| 50 |
@TEST-EXEC: echo t5 >output |
| 51 |
%TEST-END-FILE |