Merge pull request #9421 from ethereum/parallel

Run tests in parallel.
This commit is contained in:
chriseth 2020-07-16 00:35:50 +02:00 committed by GitHub
commit 4e6b660839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 4 deletions

View File

@ -139,6 +139,7 @@ defaults:
- test_ubuntu2004: &test_ubuntu2004 - test_ubuntu2004: &test_ubuntu2004
docker: docker:
- image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >> - image: ethereum/solidity-buildpack-deps:ubuntu2004-<< pipeline.parameters.ubuntu-2004-docker-image-rev >>
parallelism: 6
steps: steps:
- checkout - checkout
- attach_workspace: - attach_workspace:

View File

@ -28,10 +28,49 @@ set -e
REPODIR="$(realpath $(dirname $0)/..)" REPODIR="$(realpath $(dirname $0)/..)"
EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 ${REPODIR}/.circleci/soltest.sh EVM_VALUES=(homestead byzantium constantinople petersburg istanbul)
OPTIMIZE_VALUES=(0 1)
STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))
for OPTIMIZE in 0 1; do if (( $CIRCLE_NODE_TOTAL )) && (( $CIRCLE_NODE_TOTAL > 1 ))
for EVM in homestead byzantium constantinople petersburg istanbul; do then
EVM=$EVM OPTIMIZE=$OPTIMIZE BOOST_TEST_ARGS="-t !@nooptions" ${REPODIR}/.circleci/soltest.sh # Run step 1 as the only step on the first executor
# and evenly distribute the other steps among
# the other executors.
# The first step takes much longer than the other steps.
if (( $CIRCLE_NODE_INDEX == 0 ))
then
RUN_STEPS="1"
else
export CIRCLE_NODE_INDEX=$(($CIRCLE_NODE_INDEX - 1))
export CIRCLE_NODE_TOTAL=$(($CIRCLE_NODE_TOTAL - 1))
RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split)
fi
else
RUN_STEPS=$(seq "$STEPS")
fi
# turn newlines into spaces
RUN_STEPS=$(echo $RUN_STEPS)
echo "Running steps $RUN_STEPS..."
STEP=1
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1))
for OPTIMIZE in ${OPTIMIZE_VALUES[@]}
do
for EVM in ${EVM_VALUES[@]}
do
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM="$EVM" OPTIMIZE="$OPTIMIZE" BOOST_TEST_ARGS="-t !@nooptions" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1))
done done
done done
if (($STEP != $STEPS + 1))
then
echo "Step counter not properly adjusted!" >2
exit 1
fi