Created
January 28, 2017 01:49
-
-
Save movitto/6107bf9bbe6b6e229ce09a5a42814701 to your computer and use it in GitHub Desktop.
Parallel Catch - Invokes philsquared/Catch tests in a parallel fashion (https://github.com/philsquared/Catch)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# runs tests in parallel | |
TEST_CMD="./build/test/run_unit_tests" | |
JOBS="8" | |
TAGS="$($TEST_CMD -l | grep Scenario -A 1 | grep -v Scenario | sort -u)" | |
IFS=' ' read -a SPLIT <<< $TAGS | |
NUM_TAGS=${#SPLIT[@]} | |
# so as to round up | |
PER_JOB=`expr $NUM_TAGS + $JOBS - 1` | |
PER_JOB=`expr $PER_JOB / $JOBS` | |
echo "$NUM_TAGS total tags / $PER_JOB per job" | |
tag=0 | |
for j in $(seq 1 $JOBS) | |
do | |
job="" | |
for t in $(seq 1 $PER_JOB) | |
do | |
if [ "$tag" -ge "$NUM_TAGS" ] | |
then | |
continue | |
fi | |
if [ "$job" != "" ] | |
then | |
job="$job," | |
fi | |
job="$job${SPLIT[$tag]}" | |
tag=`expr $tag + 1` | |
done | |
echo $TEST_CMD $job | |
$TEST_CMD $job& | |
done | |
wait | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment