Refactor & Speedups on CircleCI; split out out codecov into dedicated tests.

This commit is contained in:
Christian Parpart
2019-06-21 20:26:10 +02:00
parent 4d3fa7a6cc
commit b58170f890
14 changed files with 846 additions and 534 deletions
+12 -90
View File
@@ -28,7 +28,9 @@
set -e
REPO_ROOT="$(dirname "$0")"/..
REPO_ROOT="$(dirname "$0")/.."
source "${REPO_ROOT}/scripts/common.sh"
WORKDIR=`mktemp -d`
# Will be printed in case of a test failure
@@ -40,38 +42,8 @@ CMDLINE_PID=
if [[ "$OSTYPE" == "darwin"* ]]
then
SMT_FLAGS="--no-smt"
if [ "$CIRCLECI" ]
then
IPC_ENABLED=false
IPC_FLAGS="--no-ipc"
fi
fi
safe_kill() {
local PID=${1}
local NAME=${2:-${1}}
local n=1
# only proceed if $PID does exist
kill -0 $PID 2>/dev/null || return
echo "Sending SIGTERM to ${NAME} (${PID}) ..."
kill $PID
# wait until process terminated gracefully
while kill -0 $PID 2>/dev/null && [[ $n -le 4 ]]; do
echo "Waiting ($n) ..."
sleep 1
n=$[n + 1]
done
# process still alive? then hard-kill
if kill -0 $PID 2>/dev/null; then
echo "Sending SIGKILL to ${NAME} (${PID}) ..."
kill -9 $PID
fi
}
cleanup() {
# ensure failing commands don't cause termination during cleanup (especially within safe_kill)
set +e
@@ -103,15 +75,6 @@ else
log_directory=""
fi
if [ "$CIRCLECI" ]
then
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput setaf 7)"; }
function printError() { echo "$(tput setaf 1)$1$(tput setaf 7)"; }
else
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; }
function printError() { echo "$(tput setaf 1)$1$(tput sgr0)"; }
fi
printTask "Running commandline tests..."
# Only run in parallel if this is run on CI infrastructure
if [[ -n "$CI" ]]
@@ -126,41 +89,6 @@ else
fi
fi
function download_aleth()
{
if [[ "$OSTYPE" == "darwin"* ]]; then
ALETH_PATH="$REPO_ROOT/aleth"
elif [ -z $CI ]; then
ALETH_PATH="aleth"
else
mkdir -p /tmp/test
# Any time the hash is updated here, the "Running the compiler tests" section in contributing.rst should also be updated.
ALETH_HASH="7f7004e1563299bc57882e32b32e4a195747dfb6"
ALETH_VERSION=1.6.0
wget -q -O /tmp/test/aleth.tar.gz https://github.com/ethereum/aleth/releases/download/v${ALETH_VERSION}/aleth-${ALETH_VERSION}-linux-x86_64.tar.gz
test "$(shasum /tmp/test/aleth.tar.gz)" = "$ALETH_HASH /tmp/test/aleth.tar.gz"
tar -xf /tmp/test/aleth.tar.gz -C /tmp/test
ALETH_PATH="/tmp/test/bin/aleth"
sync
chmod +x $ALETH_PATH
sync # Otherwise we might get a "text file busy" error
fi
}
# $1: data directory
# echos the PID
function run_aleth()
{
# Use this to have aleth log output
#$REPO_ROOT/scripts/aleth_with_log.sh $ALETH_PATH $ALETH_TMP_OUT --log-verbosity 3 --db memorydb --test -d "${WORKDIR}" &> /dev/null &
$ALETH_PATH --db memorydb --test -d "${WORKDIR}" &> /dev/null &
echo $!
# Wait until the IPC endpoint is available.
while [ ! -S "${WORKDIR}/geth.ipc" ] ; do sleep 1; done
sleep 2
}
function check_aleth() {
printTask "Running IPC tests with $ALETH_PATH..."
if ! hash $ALETH_PATH 2>/dev/null; then
@@ -176,17 +104,11 @@ then
ALETH_PID=$(run_aleth)
fi
progress="--show-progress"
if [ "$CIRCLECI" ]
then
progress=""
fi
EVM_VERSIONS="homestead byzantium"
if [ "$CIRCLECI" ] || [ -z "$CI" ]
if [ -z "$CI" ]
then
EVM_VERSIONS+=" constantinople petersburg"
EVM_VERSIONS+=" constantinople petersburg"
fi
# And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer
@@ -212,16 +134,16 @@ do
log=""
if [ -n "$log_directory" ]
then
if [ -n "$optimize" ]
then
log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs
else
log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt
fi
if [ -n "$optimize" ]
then
log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs
else
log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt
fi
fi
set +e
"$REPO_ROOT"/build/test/soltest $progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $IPC_FLAGS $force_abiv2_flag --ipcpath "${WORKDIR}/geth.ipc"
"$REPO_ROOT"/build/test/soltest --show-progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $IPC_FLAGS $force_abiv2_flag --ipcpath "${WORKDIR}/geth.ipc"
if test "0" -ne "$?"; then
if [ -n "$log_directory" ]