mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Extract helpers for managing steps in parallelized CircleCI jobs from soltest_all.sh
This commit is contained in:
parent
79af83eae3
commit
fbc48e3029
@ -28,27 +28,31 @@ set -e
|
|||||||
|
|
||||||
REPODIR="$(realpath "$(dirname "$0")"/..)"
|
REPODIR="$(realpath "$(dirname "$0")"/..)"
|
||||||
|
|
||||||
|
# shellcheck source=scripts/common.sh
|
||||||
|
source "${REPODIR}/scripts/common.sh"
|
||||||
|
|
||||||
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london)
|
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london)
|
||||||
DEFAULT_EVM=london
|
DEFAULT_EVM=london
|
||||||
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
|
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
|
||||||
OPTIMIZE_VALUES=(0 1)
|
OPTIMIZE_VALUES=(0 1)
|
||||||
STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))
|
STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))
|
||||||
|
|
||||||
if (( CIRCLE_NODE_TOTAL )) && (( CIRCLE_NODE_TOTAL > 1 ))
|
RUN_STEPS=$(circleci_select_steps "$(seq "$STEPS")")
|
||||||
then
|
printTask "Running steps $RUN_STEPS..."
|
||||||
RUN_STEPS=$(seq "$STEPS" | circleci tests split | xargs)
|
|
||||||
else
|
|
||||||
RUN_STEPS=$(seq "$STEPS" | xargs)
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running steps $RUN_STEPS..."
|
|
||||||
|
|
||||||
STEP=1
|
STEP=1
|
||||||
|
|
||||||
|
|
||||||
# Run for ABI encoder v1, without SMTChecker tests.
|
# Run for ABI encoder v1, without SMTChecker tests.
|
||||||
[[ " $RUN_STEPS " == *" $STEP "* ]] && EVM="${DEFAULT_EVM}" OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
|
if circleci_step_selected "$RUN_STEPS" "$STEP"
|
||||||
STEP=$((STEP + 1))
|
then
|
||||||
|
EVM="${DEFAULT_EVM}" \
|
||||||
|
OPTIMIZE=1 \
|
||||||
|
ABI_ENCODER_V1=1 \
|
||||||
|
BOOST_TEST_ARGS="-t !smtCheckerTests" \
|
||||||
|
"${REPODIR}/.circleci/soltest.sh"
|
||||||
|
fi
|
||||||
|
((++STEP))
|
||||||
|
|
||||||
for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
|
for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
|
||||||
do
|
do
|
||||||
@ -63,13 +67,16 @@ do
|
|||||||
DISABLE_SMTCHECKER=""
|
DISABLE_SMTCHECKER=""
|
||||||
[ "${OPTIMIZE}" != "0" ] && DISABLE_SMTCHECKER="-t !smtCheckerTests"
|
[ "${OPTIMIZE}" != "0" ] && DISABLE_SMTCHECKER="-t !smtCheckerTests"
|
||||||
|
|
||||||
[[ " $RUN_STEPS " == *" $STEP "* ]] && EVM="$EVM" OPTIMIZE="$OPTIMIZE" SOLTEST_FLAGS="$SOLTEST_FLAGS $ENFORCE_GAS_ARGS $EWASM_ARGS" BOOST_TEST_ARGS="-t !@nooptions $DISABLE_SMTCHECKER" "${REPODIR}/.circleci/soltest.sh"
|
if circleci_step_selected "$RUN_STEPS" "$STEP"
|
||||||
STEP=$((STEP + 1))
|
then
|
||||||
|
EVM="$EVM" \
|
||||||
|
OPTIMIZE="$OPTIMIZE" \
|
||||||
|
SOLTEST_FLAGS="$SOLTEST_FLAGS $ENFORCE_GAS_ARGS $EWASM_ARGS" \
|
||||||
|
BOOST_TEST_ARGS="-t !@nooptions $DISABLE_SMTCHECKER" \
|
||||||
|
"${REPODIR}/.circleci/soltest.sh"
|
||||||
|
fi
|
||||||
|
((++STEP))
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if ((STEP != STEPS + 1))
|
((STEP == STEPS + 1)) || assertFail "Step counter not properly adjusted!"
|
||||||
then
|
|
||||||
echo "Step counter not properly adjusted!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
@ -196,3 +196,25 @@ function safe_kill
|
|||||||
kill -9 "$PID"
|
kill -9 "$PID"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function circleci_select_steps
|
||||||
|
{
|
||||||
|
local all_steps="$1"
|
||||||
|
(( $# == 1 )) || assertFail
|
||||||
|
|
||||||
|
if (( CIRCLE_NODE_TOTAL )) && (( CIRCLE_NODE_TOTAL > 1 ))
|
||||||
|
then
|
||||||
|
echo "$all_steps" | circleci tests split | xargs
|
||||||
|
else
|
||||||
|
echo "$all_steps" | xargs
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function circleci_step_selected
|
||||||
|
{
|
||||||
|
local selected_steps="$1"
|
||||||
|
local step="$2"
|
||||||
|
[[ $step != *" "* ]] || assertFail "Step names must not contain spaces."
|
||||||
|
|
||||||
|
[[ " $selected_steps " == *" $step "* ]] || return 1
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user