aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cpp-ethereum/build.sh17
-rw-r--r--scripts/cpp-ethereum/eth_artful.docker7
-rw-r--r--scripts/cpp-ethereum/eth_trusty.docker13
-rwxr-xr-xscripts/extract_test_cases.py49
-rwxr-xr-xscripts/isolate_tests.py7
-rwxr-xr-xscripts/isoltest.sh6
-rwxr-xr-xscripts/soltest.sh43
-rwxr-xr-xscripts/tests.sh25
-rwxr-xr-xscripts/uniqueErrors.sh2
9 files changed, 158 insertions, 11 deletions
diff --git a/scripts/cpp-ethereum/build.sh b/scripts/cpp-ethereum/build.sh
new file mode 100755
index 00000000..23ed1290
--- /dev/null
+++ b/scripts/cpp-ethereum/build.sh
@@ -0,0 +1,17 @@
+#!/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
new file mode 100644
index 00000000..7ce9faae
--- /dev/null
+++ b/scripts/cpp-ethereum/eth_artful.docker
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 00000000..5cfb59f7
--- /dev/null
+++ b/scripts/cpp-ethereum/eth_trusty.docker
@@ -0,0 +1,13 @@
+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/extract_test_cases.py b/scripts/extract_test_cases.py
new file mode 100755
index 00000000..07ef9a96
--- /dev/null
+++ b/scripts/extract_test_cases.py
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+#
+# This script reads C++ or RST source files and writes all
+# multi-line strings into individual files.
+# This can be used to extract the Solidity test cases
+# into files for e.g. fuzz testing as
+# scripts/isolate_tests.py test/libsolidity/*
+
+import sys
+import re
+import os
+import hashlib
+from os.path import join
+
+def extract_test_cases(path):
+ lines = open(path, 'rb').read().splitlines()
+
+ inside = False
+ delimiter = ''
+ test = ''
+
+ ctr = 1
+ test_name = ''
+
+ for l in lines:
+ if inside:
+ if l.strip().endswith(')' + delimiter + '";'):
+ open('%03d_%s.sol' % (ctr, test_name), 'wb').write(test)
+ ctr += 1
+ inside = False
+ test = ''
+ else:
+ l = re.sub('^\t\t', '', l)
+ l = l.replace('\t', ' ')
+ test += l + '\n'
+ else:
+ m = re.search(r'BOOST_AUTO_TEST_CASE\(([^(]*)\)', l.strip())
+ if m:
+ test_name = m.group(1)
+ m = re.search(r'R"([^(]*)\($', l.strip())
+ if m:
+ inside = True
+ delimiter = m.group(1)
+
+
+if __name__ == '__main__':
+ path = sys.argv[1]
+ extract_test_cases(path)
+
diff --git a/scripts/isolate_tests.py b/scripts/isolate_tests.py
index cfaef210..5bf577d3 100755
--- a/scripts/isolate_tests.py
+++ b/scripts/isolate_tests.py
@@ -86,10 +86,15 @@ if __name__ == '__main__':
for root, subdirs, files in os.walk(path):
if '_build' in subdirs:
subdirs.remove('_build')
+ if 'compilationTests' in subdirs:
+ subdirs.remove('compilationTests')
for f in files:
path = join(root, f)
if docs:
cases = extract_docs_cases(path)
else:
- cases = extract_test_cases(path)
+ if f.endswith(".sol"):
+ cases = [open(path, "r").read()]
+ else:
+ cases = extract_test_cases(path)
write_cases(cases)
diff --git a/scripts/isoltest.sh b/scripts/isoltest.sh
new file mode 100755
index 00000000..8aed0b3a
--- /dev/null
+++ b/scripts/isoltest.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -e
+
+REPO_ROOT="$(dirname "$0")"/..
+exec ${REPO_ROOT}/build/test/tools/isoltest --testpath ${REPO_ROOT}/test
diff --git a/scripts/soltest.sh b/scripts/soltest.sh
new file mode 100755
index 00000000..00f484a1
--- /dev/null
+++ b/scripts/soltest.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+set -e
+
+REPO_ROOT="$(dirname "$0")"/..
+USE_DEBUGGER=0
+DEBUGGER="gdb --args"
+BOOST_OPTIONS=
+SOLTEST_OPTIONS=
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ --debugger)
+ shift
+ DEBUGGER="$1"
+ USE_DEBUGGER=1
+ ;;
+ --debug)
+ USE_DEBUGGER=1
+ ;;
+ --boost-options)
+ shift
+ BOOST_OPTIONS="${BOOST_OPTIONS} $1"
+ ;;
+ -t)
+ shift
+ BOOST_OPTIONS="${BOOST_OPTIONS} -t $1"
+ ;;
+ --show-progress | -p)
+ BOOST_OPTIONS="${BOOST_OPTIONS} $1"
+ ;;
+ *)
+ SOLTEST_OPTIONS="${SOLTEST_OPTIONS} $1"
+ ;;
+ esac
+ shift
+done
+if [ "$USE_DEBUGGER" -ne "0" ]; then
+ DEBUG_PREFIX=${DEBUGGER}
+fi
+
+exec ${DEBUG_PREFIX} ${REPO_ROOT}/build/test/soltest ${BOOST_OPTIONS} -- --testpath ${REPO_ROOT}/test ${SOLTEST_OPTIONS}
diff --git a/scripts/tests.sh b/scripts/tests.sh
index bf4ee3d9..425a4ff4 100755
--- a/scripts/tests.sh
+++ b/scripts/tests.sh
@@ -61,13 +61,13 @@ function download_eth()
mkdir -p /tmp/test
if grep -i trusty /etc/lsb-release >/dev/null 2>&1
then
- # built from 1ecff3cac12f0fbbeea3e645f331d5ac026b24d3 at 2018-03-06
- ETH_BINARY=eth_byzantium_trusty
- ETH_HASH="5432ea81c150e8a3547615bf597cd6dce9e1e27b"
+ # built from 5ac09111bd0b6518365fe956e1bdb97a2db82af1 at 2018-04-05
+ ETH_BINARY=eth_2018-04-05_trusty
+ ETH_HASH="1e5e178b005e5b51f9d347df4452875ba9b53cc6"
else
- # built from ?? at 2018-02-13 ?
- ETH_BINARY=eth_byzantium_artful
- ETH_HASH="e527dd3e3dc17b983529dd7dcfb74a0d3a5aed4e"
+ # built from 5ac09111bd0b6518365fe956e1bdb97a2db82af1 at 2018-04-05
+ ETH_BINARY=eth_2018-04-05_artful
+ ETH_HASH="eb2d0df022753bb2b442ba73e565a9babf6828d6"
fi
wget -q -O /tmp/test/eth https://github.com/ethereum/cpp-ethereum/releases/download/solidityTester/$ETH_BINARY
test "$(shasum /tmp/test/eth)" = "$ETH_HASH /tmp/test/eth"
@@ -94,16 +94,23 @@ download_eth
ETH_PID=$(run_eth /tmp/test)
progress="--show-progress"
-if [ "$CI" ]
+if [ "$CIRCLECI" ]
then
progress=""
fi
+EVM_VERSIONS="homestead byzantium"
+
+if [ "$CIRCLECI" ] || [ -z "$CI" ]
+then
+EVM_VERSIONS+=" constantinople"
+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.
for optimize in "" "--optimize"
do
- for vm in homestead byzantium
+ for vm in $EVM_VERSIONS
do
echo "--> Running tests using "$optimize" --evm-version "$vm"..."
log=""
@@ -116,7 +123,7 @@ do
log=--logger=JUNIT,test_suite,$log_directory/noopt_$vm.xml $testargs_no_opt
fi
fi
- "$REPO_ROOT"/build/test/soltest $progress $log -- "$optimize" --evm-version "$vm" --ipcpath /tmp/test/geth.ipc
+ "$REPO_ROOT"/build/test/soltest $progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" --ipcpath /tmp/test/geth.ipc
done
done
diff --git a/scripts/uniqueErrors.sh b/scripts/uniqueErrors.sh
index eee1df90..fa2c7b4c 100755
--- a/scripts/uniqueErrors.sh
+++ b/scripts/uniqueErrors.sh
@@ -9,6 +9,6 @@ do
echo -n $x " # "
# This subshell is a workaround to prevent the shell from printing
# "Aborted"
- ("$REPO"/build/test/solfuzzer < "$x" || true) 2>&1 | head -n 1
+ ("$REPO"/build/test/tools/solfuzzer < "$x" || true) 2>&1 | head -n 1
done
) | sort -u -t'#' -k 2