Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit a5cfb9a

Browse files
committed
Chunk up test parallelization
We have lots of files, can't blindly spawn a process per test file. Chunk them.
1 parent 2533456 commit a5cfb9a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

test.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,35 @@ function exp {
66
echo "$(dirname $1)/expected/$(basename $1).txt"
77
}
88

9+
taskCount=0
10+
function maybeWait {
11+
let taskCount+=1
12+
# spawn in batch of 20 processes
13+
[[ $((taskCount % 20)) = 0 ]] && wait
14+
}
15+
916
# parsing
1017
for file in tests/parsing/{errors,infiniteLoops,recovery}/**/*.(res|resi); do
11-
lib/rescript.exe -recover -print ml $file &> $(exp $file) &
18+
lib/rescript.exe -recover -print ml $file &> $(exp $file) & maybeWait
1219
done
1320
for file in tests/parsing/{grammar,other}/**/*.(res|resi); do
14-
lib/rescript.exe -print ml $file &> $(exp $file) &
21+
lib/rescript.exe -print ml $file &> $(exp $file) & maybeWait
1522
done
1623

1724
# printing
1825
for file in tests/{printer,conversion}/**/*.(res|resi|ml|mli); do
19-
lib/rescript.exe $file &> $(exp $file) &
26+
lib/rescript.exe $file &> $(exp $file) & maybeWait
2027
done
2128
for file in tests/{printer,conversion}/**/*.re; do
22-
lib/refmt.exe --parse re --print binary $file | lib/rescript.exe -parse reasonBinary &> $(exp $file) &
29+
lib/refmt.exe --parse re --print binary $file | lib/rescript.exe -parse reasonBinary &> $(exp $file) & maybeWait
2330
done
2431
for file in tests/{printer,conversion}/**/*.rei; do
25-
lib/refmt.exe --parse re --print binary --interface true $file | lib/rescript.exe -parse reasonBinary -interface &> $(exp $file) &
32+
lib/refmt.exe --parse re --print binary --interface true $file | lib/rescript.exe -parse reasonBinary -interface &> $(exp $file) & maybeWait
2633
done
2734

2835
# printing with ppx
2936
for file in tests/ppx/react/*.(res|resi); do
30-
lib/rescript.exe -ppx jsx $file &> $(exp $file) &
37+
lib/rescript.exe -ppx jsx $file &> $(exp $file) & maybeWait
3138
done
3239

3340
wait

0 commit comments

Comments
 (0)