Skip to content

Commit f659f04

Browse files
committed
feat: run all tests in parallel
1 parent 3e27a05 commit f659f04

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

script/run_testdata.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Generate uniast for all testdata. Must be run from repo root
3+
#
4+
# USAGE:
5+
# 1. Save the uniast to out/
6+
# $ OUTDIR=out/ ./script/run_testdata.sh
7+
#
8+
# 2. Save the uniast to out/ , colorize output for human readable terminal
9+
# OUTDIR=out/ PARALLEL_FLAGS=--ctag ./script/run_testdata.sh
10+
#
11+
# 3. Use a custom abcoder executable
12+
# OUTDIR=out/ ABCEXE="./other_abcoder" ./script/run_testdata.sh
13+
14+
ABCEXE=${ABCEXE:-./abcoder}
15+
OUTDIR=${OUTDIR:?Error: OUTDIR is a mandatory environment variable}
16+
PARALLEL_FLAGS=${PARALLEL_FLAGS:---tag}
17+
18+
LANGS=(go rust python cxx)
19+
20+
detect_jobs() {
21+
local ABCEXE=${1:-$ABCEXE}
22+
for lang in ${LANGS[@]}; do
23+
for repo in testdata/$lang/*; do
24+
outname=$(echo $repo | sed 's/^testdata\///; s/[/:? ]/_/g')
25+
echo $ABCEXE parse $lang $repo -o $OUTDIR/$outname.json
26+
done
27+
done
28+
}
29+
30+
mkdir -pv "$OUTDIR"
31+
detect_jobs | parallel $PARALLEL_FLAGS echo {}
32+
echo
33+
detect_jobs | parallel $PARALLEL_FLAGS -j$(nproc --all) --jobs 0 "eval {}" 2>&1

0 commit comments

Comments
 (0)