From 77212627fb37b886df4dd6ddf3be572c25b01687 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jul 2019 11:05:44 +0200 Subject: [PATCH] Remove traces of aleth and IPC. --- .circleci/config.yml | 3 +- .circleci/docker/Dockerfile.ubuntu1904 | 9 ----- .circleci/soltest.sh | 12 +------ appveyor.yml | 5 +-- docs/contributing.rst | 47 ++++++++++++-------------- scripts/aleth_with_log.sh | 21 ------------ scripts/common.sh | 39 --------------------- scripts/cpp-ethereum/build.sh | 17 ---------- scripts/cpp-ethereum/eth_artful.docker | 7 ---- scripts/cpp-ethereum/eth_trusty.docker | 13 ------- scripts/install_deps.sh | 10 ------ scripts/tests.sh | 34 ++----------------- 12 files changed, 26 insertions(+), 191 deletions(-) delete mode 100755 scripts/aleth_with_log.sh delete mode 100755 scripts/cpp-ethereum/build.sh delete mode 100644 scripts/cpp-ethereum/eth_artful.docker delete mode 100644 scripts/cpp-ethereum/eth_trusty.docker diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a340b83a..e4b4d0654 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -282,7 +282,7 @@ jobs: at: build - run: name: "soltest: Syntax Tests" - command: build/test/soltest -t 'syntaxTest*' -- --no-ipc --testpath test + command: build/test/soltest -t 'syntaxTest*' -- --testpath test - run: name: "Code Coverage: Syntax Tests" command: codecov --flags syntax --gcov-root build @@ -478,7 +478,6 @@ jobs: environment: EVM: constantinople 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 t_ubu_homestead: diff --git a/.circleci/docker/Dockerfile.ubuntu1904 b/.circleci/docker/Dockerfile.ubuntu1904 index ac9a288d4..e3c74ea27 100644 --- a/.circleci/docker/Dockerfile.ubuntu1904 +++ b/.circleci/docker/Dockerfile.ubuntu1904 @@ -46,15 +46,6 @@ RUN set -ex; \ 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 RUN set -ex; \ git clone --depth=1 --branch="Z3-4.8.5" https://github.com/Z3Prover/z3.git /usr/src/z3; \ diff --git a/.circleci/soltest.sh b/.circleci/soltest.sh index 673540b3c..dda335102 100755 --- a/.circleci/soltest.sh +++ b/.circleci/soltest.sh @@ -36,27 +36,17 @@ set -e OPTIMIZE=${OPTIMIZE:-"0"} EVM=${EVM:-"invalid"} WORKDIR=${CIRCLE_WORKING_DIRECTORY:-.} -SOLTEST_IPC=${SOLTEST_IPC:-1} REPODIR="$(realpath $(dirname $0)/..)" -ALETH_PATH="/usr/bin/aleth" source "${REPODIR}/scripts/common.sh" # Test result output directory (CircleCI is reading test results from here) 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. ulimit -s 16384 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" -test "${SOLTEST_IPC}" = "1" || SOLTEST_ARGS="$SOLTEST_ARGS --no-ipc" +SOLTEST_ARGS="--evm-version=$EVM --evmonepath /usr/lib/libevmone.so $flags" test "${OPTIMIZE}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --optimize" test "${ABI_ENCODER_V2}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv2 --optimize-yul" diff --git a/appveyor.yml b/appveyor.yml index 864c63594..2e2a2fa8b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,9 +5,6 @@ # # 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. # @@ -71,7 +68,7 @@ build_script: test_script: - 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 - cd %APPVEYOR_BUILD_FOLDER% - ps: if ($env:priv_key) { diff --git a/docs/contributing.rst b/docs/contributing.rst index 5d6240390..4dfd18610 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -81,15 +81,23 @@ Thank you for your help! Running the compiler tests ========================== -The ``./scripts/tests.sh`` script executes most Solidity tests and -runs ``aleth`` automatically if it is in the path. The script does not download it, -so you need to install it first. Please read on for the details. +The ``./scripts/tests.sh`` script executes most Solidity tests automatically, +but for quicker feedback, you might want to run specific tests. -Solidity includes different types of tests, most of them bundled into the `Boost C++ Test Framework `_ application ``soltest``. -Some of them require the ``aleth`` client in testing mode, others require ``libz3``. +Solidity includes different types of tests, most of them bundled into the +`Boost C++ Test Framework `_ 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 -``./scripts/soltest.sh --no-ipc --no-smt``. +Some tests require the ``libevmone.so`` library, others require ``libz3``. + +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 `_ +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. See especially: @@ -100,27 +108,19 @@ See especially: .. 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``. - If you're running this in plain Command Prompt, use ``.\build\test\Release\soltest.exe -- --no-ipc --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 `_ 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``. + 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 are running this in plain Command Prompt, use ``.\build\test\Release\soltest.exe -- --no-smt``. 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 ``*``. -For example, here's an example test you might run; -``./scripts/soltest.sh -t "yulOptimizerTests/disambiguator/*" --no-ipc --no-smt``. +For example, here is an example test you might run; +``./scripts/soltest.sh -t "yulOptimizerTests/disambiguator/*" --no-smt``. This will test all the tests for the disambiguator. 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". 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. -.. 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 -------------------------------- diff --git a/scripts/aleth_with_log.sh b/scripts/aleth_with_log.sh deleted file mode 100755 index 3fd8ba656..000000000 --- a/scripts/aleth_with_log.sh +++ /dev/null @@ -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 - diff --git a/scripts/common.sh b/scripts/common.sh index f1e5cf134..fbb730241 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -55,42 +55,3 @@ safe_kill() kill -9 $PID 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 -} - diff --git a/scripts/cpp-ethereum/build.sh b/scripts/cpp-ethereum/build.sh deleted file mode 100755 index 23ed12906..000000000 --- a/scripts/cpp-ethereum/build.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/scripts/cpp-ethereum/eth_artful.docker b/scripts/cpp-ethereum/eth_artful.docker deleted file mode 100644 index 7ce9faae8..000000000 --- a/scripts/cpp-ethereum/eth_artful.docker +++ /dev/null @@ -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 diff --git a/scripts/cpp-ethereum/eth_trusty.docker b/scripts/cpp-ethereum/eth_trusty.docker deleted file mode 100644 index 5cfb59f7e..000000000 --- a/scripts/cpp-ethereum/eth_trusty.docker +++ /dev/null @@ -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 diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index a0e1ff352..c8e90b0d2 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -104,9 +104,6 @@ case $(uname -s) in brew install cmake if [ "$CI" = true ]; then brew upgrade cmake - brew tap ethereum/ethereum - brew install cpp-ethereum - brew linkapps cpp-ethereum else brew upgrade fi @@ -337,13 +334,6 @@ case $(uname -s) in sudo apt-get -y update sudo apt-get -y install libz3-dev 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 ;; diff --git a/scripts/tests.sh b/scripts/tests.sh index 0350de5a0..80c19752f 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -33,10 +33,6 @@ REPO_ROOT="$(dirname "$0")/.." source "${REPO_ROOT}/scripts/common.sh" WORKDIR=`mktemp -d` -# Will be printed in case of a test failure -ALETH_TMP_OUT=`mktemp` -IPC_ENABLED=true -ALETH_PID= CMDLINE_PID= if [[ "$OSTYPE" == "darwin"* ]] @@ -48,10 +44,6 @@ cleanup() { # ensure failing commands don't cause termination during cleanup (especially within safe_kill) set +e - if [[ "$IPC_ENABLED" = true ]] && [[ -n "${ALETH_PID}" ]] - then - safe_kill $ALETH_PID $ALETH_PATH - fi if [[ -n "$CMDLINE_PID" ]] then safe_kill $CMDLINE_PID "Commandline tests" @@ -59,7 +51,6 @@ cleanup() { echo "Cleaning up working directory ${WORKDIR} ..." rm -rf "$WORKDIR" || true - rm $ALETH_TMP_OUT } trap cleanup INT TERM @@ -89,20 +80,6 @@ else 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" @@ -112,7 +89,7 @@ then fi # 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" do for vm in $EVM_VERSIONS @@ -143,16 +120,9 @@ do fi 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 [ -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 fi set -e