Remove traces of aleth and IPC.

This commit is contained in:
chriseth 2019-07-17 11:05:44 +02:00
parent c4638cc5cb
commit 77212627fb
12 changed files with 26 additions and 191 deletions

View File

@ -282,7 +282,7 @@ jobs:
at: build at: build
- run: - run:
name: "soltest: Syntax Tests" name: "soltest: Syntax Tests"
command: build/test/soltest -t 'syntaxTest*' -- --no-ipc --testpath test command: build/test/soltest -t 'syntaxTest*' -- --testpath test
- run: - run:
name: "Code Coverage: Syntax Tests" name: "Code Coverage: Syntax Tests"
command: codecov --flags syntax --gcov-root build command: codecov --flags syntax --gcov-root build
@ -478,7 +478,6 @@ jobs:
environment: environment:
EVM: constantinople EVM: constantinople
OPTIMIZE: 0 OPTIMIZE: 0
SOLTEST_IPC: 0
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
t_ubu_homestead: t_ubu_homestead:

View File

@ -46,15 +46,6 @@ RUN set -ex; \
FROM base AS libraries FROM base AS libraries
# Aleth for end-to-end tests
ARG ALETH_VERSION="1.6.0"
ARG ALETH_HASH="7f7004e1563299bc57882e32b32e4a195747dfb6"
ARG ALETH_URL="https://github.com/ethereum/aleth/releases/download/v${ALETH_VERSION}/aleth-${ALETH_VERSION}-linux-x86_64.tar.gz"
RUN set -ex; \
wget -q -O /tmp/aleth.tar.gz "${ALETH_URL}"; \
test "$(shasum /tmp/aleth.tar.gz)" = "$ALETH_HASH /tmp/aleth.tar.gz"; \
tar -xf /tmp/aleth.tar.gz -C /usr
# Z3 # Z3
RUN set -ex; \ RUN set -ex; \
git clone --depth=1 --branch="Z3-4.8.5" https://github.com/Z3Prover/z3.git /usr/src/z3; \ git clone --depth=1 --branch="Z3-4.8.5" https://github.com/Z3Prover/z3.git /usr/src/z3; \

View File

@ -36,27 +36,17 @@ set -e
OPTIMIZE=${OPTIMIZE:-"0"} OPTIMIZE=${OPTIMIZE:-"0"}
EVM=${EVM:-"invalid"} EVM=${EVM:-"invalid"}
WORKDIR=${CIRCLE_WORKING_DIRECTORY:-.} WORKDIR=${CIRCLE_WORKING_DIRECTORY:-.}
SOLTEST_IPC=${SOLTEST_IPC:-1}
REPODIR="$(realpath $(dirname $0)/..)" REPODIR="$(realpath $(dirname $0)/..)"
ALETH_PATH="/usr/bin/aleth"
source "${REPODIR}/scripts/common.sh" source "${REPODIR}/scripts/common.sh"
# Test result output directory (CircleCI is reading test results from here) # Test result output directory (CircleCI is reading test results from here)
mkdir -p test_results mkdir -p test_results
ALETH_PID=$(run_aleth)
function cleanup() {
safe_kill $ALETH_PID $ALETH_PATH
}
trap cleanup INT TERM
# in case we run with ASAN enabled, we must increase stck size. # in case we run with ASAN enabled, we must increase stck size.
ulimit -s 16384 ulimit -s 16384
BOOST_TEST_ARGS="--color_output=no --show_progress=yes --logger=JUNIT,error,test_results/$EVM.xml" BOOST_TEST_ARGS="--color_output=no --show_progress=yes --logger=JUNIT,error,test_results/$EVM.xml"
SOLTEST_ARGS="--evm-version=$EVM --ipcpath "${WORKDIR}/geth.ipc" $flags" SOLTEST_ARGS="--evm-version=$EVM --evmonepath /usr/lib/libevmone.so $flags"
test "${SOLTEST_IPC}" = "1" || SOLTEST_ARGS="$SOLTEST_ARGS --no-ipc"
test "${OPTIMIZE}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --optimize" test "${OPTIMIZE}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --optimize"
test "${ABI_ENCODER_V2}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv2 --optimize-yul" test "${ABI_ENCODER_V2}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv2 --optimize-yul"

View File

@ -5,9 +5,6 @@
# #
# http://solidity.readthedocs.org # http://solidity.readthedocs.org
# #
# TODO - Tests currently disabled, because Tests-over-IPC code is using UNIX
# sockets unconditionally at the time of writing.
#
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# This file is part of solidity. # This file is part of solidity.
# #
@ -71,7 +68,7 @@ build_script:
test_script: test_script:
- cd %APPVEYOR_BUILD_FOLDER%\build\test\%CONFIGURATION% - cd %APPVEYOR_BUILD_FOLDER%\build\test\%CONFIGURATION%
- soltest.exe --show-progress -- --testpath %APPVEYOR_BUILD_FOLDER%\test --no-ipc --no-smt - soltest.exe --show-progress -- --testpath %APPVEYOR_BUILD_FOLDER%\test --no-smt
# Skip bytecode compare if private key is not available # Skip bytecode compare if private key is not available
- cd %APPVEYOR_BUILD_FOLDER% - cd %APPVEYOR_BUILD_FOLDER%
- ps: if ($env:priv_key) { - ps: if ($env:priv_key) {

View File

@ -81,15 +81,23 @@ Thank you for your help!
Running the compiler tests Running the compiler tests
========================== ==========================
The ``./scripts/tests.sh`` script executes most Solidity tests and The ``./scripts/tests.sh`` script executes most Solidity tests automatically,
runs ``aleth`` automatically if it is in the path. The script does not download it, but for quicker feedback, you might want to run specific tests.
so you need to install it first. Please read on for the details.
Solidity includes different types of tests, most of them bundled into the `Boost C++ Test Framework <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/index.html>`_ application ``soltest``. Solidity includes different types of tests, most of them bundled into the
Some of them require the ``aleth`` client in testing mode, others require ``libz3``. `Boost C++ Test Framework <https://www.boost.org/doc/libs/1_69_0/libs/test/doc/html/index.html>`_ application ``soltest``.
Running ``build/test/soltest` or its wrapper ``scripts/soltest.sh`` is sufficient for most changes.
To run a basic set of tests that require neither ``aleth`` nor ``libz3``, run Some tests require the ``libevmone.so`` library, others require ``libz3``.
``./scripts/soltest.sh --no-ipc --no-smt``.
The test system will automatically try to discover the location of ``libevmone.so``
starting from the current directory. If it does not find it, the relevant tests
are skipped. To run all tests, download the library from
`Github <https://github.com/ethereum/evmone/releases/download/v0.1.0/evmone-0.1.0-linux-x86_64.tar.gz>`_
and either place it in the project root path or inside the ``deps`` folder.
If you do not have libz3 installed on your system, you should disable the SMT tests:
``./scripts/soltest.sh --no-smt``.
``./build/test/soltest --help`` has extensive help on all of the options available. ``./build/test/soltest --help`` has extensive help on all of the options available.
See especially: See especially:
@ -100,27 +108,19 @@ See especially:
.. note :: .. note ::
Those working in a Windows environment wanting to run the above basic sets without aleth or libz3 in Git Bash, you would have to do: ``./build/test/Release/soltest.exe -- --no-ipc --no-smt``. Those working in a Windows environment wanting to run the above basic sets without libz3 in Git Bash, you would have to do: ``./build/test/Release/soltest.exe -- --no-smt``.
If you're running this in plain Command Prompt, use ``.\build\test\Release\soltest.exe -- --no-ipc --no-smt``. If you are running this in plain Command Prompt, use ``.\build\test\Release\soltest.exe -- --no-smt``.
The option ``--no-smt`` disables the tests that require ``libz3`` and
``--no-ipc`` disables those that require ``aleth``.
If you want to run the ipc tests (that test the semantics of the generated code),
you need to install `aleth <https://github.com/ethereum/aleth/releases/download/v1.6.0/aleth-1.6.0-linux-x86_64.tar.gz>`_ and run it in testing mode: ``aleth --db memorydb --test -d /tmp/testeth``.
To run the actual tests, use: ``./scripts/soltest.sh --ipcpath /tmp/testeth/geth.ipc``.
To run a subset of tests, you can use filters: To run a subset of tests, you can use filters:
``./scripts/soltest.sh -t TestSuite/TestName --ipcpath /tmp/testeth/geth.ipc``, ``./scripts/soltest.sh -t TestSuite/TestName,
where ``TestName`` can be a wildcard ``*``. where ``TestName`` can be a wildcard ``*``.
For example, here's an example test you might run; For example, here is an example test you might run;
``./scripts/soltest.sh -t "yulOptimizerTests/disambiguator/*" --no-ipc --no-smt``. ``./scripts/soltest.sh -t "yulOptimizerTests/disambiguator/*" --no-smt``.
This will test all the tests for the disambiguator. This will test all the tests for the disambiguator.
To get a list of all tests, use To get a list of all tests, use
``./build/test/soltest --list_content=HRF -- --ipcpath /tmp/irrelevant``. ``./build/test/soltest --list_content=HRF``.
If you want to debug using GDB, make sure you build differently than the "usual". If you want to debug using GDB, make sure you build differently than the "usual".
For example, you could run the following command in your ``build`` folder: For example, you could run the following command in your ``build`` folder:
@ -137,11 +137,6 @@ in addition to those found in ``soltest``.
The CI runs additional tests (including ``solc-js`` and testing third party Solidity frameworks) that require compiling the Emscripten target. The CI runs additional tests (including ``solc-js`` and testing third party Solidity frameworks) that require compiling the Emscripten target.
.. note ::
Some versions of ``aleth`` can not be used for testing. We suggest using
the same version that the Solidity continuous integration tests use.
Currently the CI uses version ``1.6.0`` of ``aleth``.
Writing and running syntax tests Writing and running syntax tests
-------------------------------- --------------------------------

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
ALETH_PATH=$1
ALETH_TMP_OUT=$2
shift
shift
$ALETH_PATH $@ &> >(tail -n 100000 &> "$ALETH_TMP_OUT") &
PID=$!
function cleanup()
{
kill $PID
}
trap cleanup INT TERM
wait $PID

View File

@ -55,42 +55,3 @@ safe_kill()
kill -9 $PID kill -9 $PID
fi fi
} }
# Ensures aleth executable and exposes the following information:
#
# - env var ALETH_PATH: to point to the aleth executable.
# - directory /tmp/test if needed. No cleanup is done on this directory
function download_aleth()
{
if which aleth &>/dev/null; then
ALETH_PATH=`which aleth`
elif [[ "$OSTYPE" == "darwin"* ]]; then
ALETH_PATH="$(realpath $(dirname "$0")/..)/aleth"
elif [ "$CIRCLECI" ] || [ -z $CI ]; then
ALETH_PATH="aleth"
else
ALETH_PATH="/tmp/test/bin/aleth"
mkdir -p /tmp/test
# Any time the hash is updated here, the "Running the compiler tests" section in contributing.rst should also be updated.
local ALETH_HASH="7f7004e1563299bc57882e32b32e4a195747dfb6"
local 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
sync
chmod +x $ALETH_PATH
sync # Otherwise we might get a "text file busy" error
fi
}
# Executes aleth in the background and echos its PID.
function run_aleth()
{
$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
}

View File

@ -1,17 +0,0 @@
#!/usr/bin/env sh
# Script to build the eth binary from latest develop
# for ubuntu trusty and ubuntu artful.
# Requires docker.
set -e
REPO_ROOT="$(dirname "$0")"/../..
for rel in artful trusty
do
docker build -t eth_$rel -f "$REPO_ROOT"/scripts/cpp-ethereum/eth_$rel.docker .
tmp_container=$(docker create eth_$rel sh)
echo "Built eth ($rel) at $REPO_ROOT/build/eth_$rel"
docker cp ${tmp_container}:/build/eth/eth "$REPO_ROOT"/build/eth_$rel
done

View File

@ -1,7 +0,0 @@
FROM ubuntu:artful
RUN apt update
RUN apt -y install libleveldb-dev cmake g++ git
RUN git clone --recursive https://github.com/ethereum/cpp-ethereum --branch develop --single-branch --depth 1
RUN mkdir /build && cd /build && cmake /cpp-ethereum -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTOOLS=Off -DTESTS=Off
RUN cd /build && make eth

View File

@ -1,13 +0,0 @@
FROM ubuntu:trusty
RUN apt-get update
RUN apt-get -y install software-properties-common python-software-properties
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get -y install gcc libleveldb-dev git curl make gcc-7 g++-7
RUN ln -sf /usr/bin/gcc-7 /usr/bin/gcc
RUN ln -sf /usr/bin/g++-7 /usr/bin/g++
RUN git clone --recursive https://github.com/ethereum/cpp-ethereum --branch develop --single-branch --depth 1
RUN ./cpp-ethereum/scripts/install_cmake.sh
RUN mkdir /build && cd /build && ~/.local/bin/cmake /cpp-ethereum -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTOOLS=Off -DTESTS=Off
RUN cd /build && make eth

View File

@ -104,9 +104,6 @@ case $(uname -s) in
brew install cmake brew install cmake
if [ "$CI" = true ]; then if [ "$CI" = true ]; then
brew upgrade cmake brew upgrade cmake
brew tap ethereum/ethereum
brew install cpp-ethereum
brew linkapps cpp-ethereum
else else
brew upgrade brew upgrade
fi fi
@ -337,13 +334,6 @@ case $(uname -s) in
sudo apt-get -y update sudo apt-get -y update
sudo apt-get -y install libz3-dev sudo apt-get -y install libz3-dev
fi fi
# Install 'eth', for use in the Solidity Tests-over-IPC.
# We will not use this 'eth', but its dependencies
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get -y update
sudo apt-get -y install eth
fi fi
;; ;;

View File

@ -33,10 +33,6 @@ REPO_ROOT="$(dirname "$0")/.."
source "${REPO_ROOT}/scripts/common.sh" source "${REPO_ROOT}/scripts/common.sh"
WORKDIR=`mktemp -d` WORKDIR=`mktemp -d`
# Will be printed in case of a test failure
ALETH_TMP_OUT=`mktemp`
IPC_ENABLED=true
ALETH_PID=
CMDLINE_PID= CMDLINE_PID=
if [[ "$OSTYPE" == "darwin"* ]] if [[ "$OSTYPE" == "darwin"* ]]
@ -48,10 +44,6 @@ cleanup() {
# ensure failing commands don't cause termination during cleanup (especially within safe_kill) # ensure failing commands don't cause termination during cleanup (especially within safe_kill)
set +e set +e
if [[ "$IPC_ENABLED" = true ]] && [[ -n "${ALETH_PID}" ]]
then
safe_kill $ALETH_PID $ALETH_PATH
fi
if [[ -n "$CMDLINE_PID" ]] if [[ -n "$CMDLINE_PID" ]]
then then
safe_kill $CMDLINE_PID "Commandline tests" safe_kill $CMDLINE_PID "Commandline tests"
@ -59,7 +51,6 @@ cleanup() {
echo "Cleaning up working directory ${WORKDIR} ..." echo "Cleaning up working directory ${WORKDIR} ..."
rm -rf "$WORKDIR" || true rm -rf "$WORKDIR" || true
rm $ALETH_TMP_OUT
} }
trap cleanup INT TERM trap cleanup INT TERM
@ -89,20 +80,6 @@ else
fi fi
fi fi
function check_aleth() {
printTask "Running IPC tests with $ALETH_PATH..."
if ! hash $ALETH_PATH 2>/dev/null; then
printError "$ALETH_PATH not found"
exit 1
fi
}
if [ "$IPC_ENABLED" = true ];
then
download_aleth
check_aleth
ALETH_PID=$(run_aleth)
fi
EVM_VERSIONS="homestead byzantium" EVM_VERSIONS="homestead byzantium"
@ -112,7 +89,7 @@ then
fi fi
# And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer # And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer
# and homestead / byzantium VM, # pointing to that IPC endpoint. # and homestead / byzantium VM
for optimize in "" "--optimize" for optimize in "" "--optimize"
do do
for vm in $EVM_VERSIONS for vm in $EVM_VERSIONS
@ -143,16 +120,9 @@ do
fi fi
set +e set +e
"$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" "$REPO_ROOT"/build/test/soltest --show-progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv2_flag
if test "0" -ne "$?"; then if test "0" -ne "$?"; then
if [ -n "$log_directory" ]
then
# Need to kill aleth first so the log is written
safe_kill $ALETH_PID $ALETH_PATH
cp $ALETH_TMP_OUT $log_directory/aleth.log
printError "Some test failed, wrote aleth.log"
fi
exit 1 exit 1
fi fi
set -e set -e