aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_emscripten.sh6
-rw-r--r--scripts/bytecodecompare/deploy_key.encbin0 -> 1680 bytes
-rwxr-xr-xscripts/bytecodecompare/prepare_report.py24
-rw-r--r--scripts/bytecodecompare/storebytecode.bat41
-rwxr-xr-xscripts/bytecodecompare/storebytecode.sh101
-rwxr-xr-xscripts/create_source_tarball.sh2
-rwxr-xr-xscripts/isolate_tests.py24
7 files changed, 179 insertions, 19 deletions
diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh
index 9b432e95..6046978e 100755
--- a/scripts/build_emscripten.sh
+++ b/scripts/build_emscripten.sh
@@ -29,12 +29,6 @@
set -e
if [[ "$OSTYPE" != "darwin"* ]]; then
- if [ "$TRAVIS_BRANCH" = release ]
- then
- echo -n > prerelease.txt
- else
- date -u +"nightly.%Y.%-m.%-d" > prerelease.txt
- fi
./scripts/travis-emscripten/install_deps.sh
docker run -v $(pwd):/src trzeci/emscripten:sdk-tag-1.35.4-64bit ./scripts/travis-emscripten/build_emscripten.sh
fi
diff --git a/scripts/bytecodecompare/deploy_key.enc b/scripts/bytecodecompare/deploy_key.enc
new file mode 100644
index 00000000..acab2a27
--- /dev/null
+++ b/scripts/bytecodecompare/deploy_key.enc
Binary files differ
diff --git a/scripts/bytecodecompare/prepare_report.py b/scripts/bytecodecompare/prepare_report.py
new file mode 100755
index 00000000..5a770981
--- /dev/null
+++ b/scripts/bytecodecompare/prepare_report.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+import sys
+import glob
+import subprocess
+import json
+
+solc = sys.argv[1]
+report = open("report.txt", "w")
+
+for optimize in [False, True]:
+ for f in sorted(glob.glob("*.sol")):
+ args = [solc, '--combined-json', 'bin,metadata', f]
+ if optimize:
+ args += ['--optimize']
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (out, err) = proc.communicate()
+ try:
+ result = json.loads(out.strip())
+ for contractName in sorted(result['contracts'].keys()):
+ report.write(contractName + ' ' + result['contracts'][contractName]['bin'] + '\n')
+ report.write(contractName + ' ' + result['contracts'][contractName]['metadata'] + '\n')
+ except:
+ report.write(f + ": ERROR\n")
diff --git a/scripts/bytecodecompare/storebytecode.bat b/scripts/bytecodecompare/storebytecode.bat
new file mode 100644
index 00000000..969a42a4
--- /dev/null
+++ b/scripts/bytecodecompare/storebytecode.bat
@@ -0,0 +1,41 @@
+@ECHO OFF
+
+REM ---------------------------------------------------------------------------
+REM This file is part of solidity.
+REM
+REM solidity is free software: you can redistribute it and/or modify
+REM it under the terms of the GNU General Public License as published by
+REM the Free Software Foundation, either version 3 of the License, or
+REM (at your option) any later version.
+REM
+REM solidity is distributed in the hope that it will be useful,
+REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+REM GNU General Public License for more details.
+REM
+REM You should have received a copy of the GNU General Public License
+REM along with solidity. If not, see <http://www.gnu.org/licenses/>
+REM
+REM Copyright (c) 2017 solidity contributors.
+REM ---------------------------------------------------------------------------
+
+set CONFIGURATION=%1
+set COMMIT=%2
+
+mkdir bytecode
+cd bytecode
+..\scripts\isolate_tests.py ..\test\
+..\scripts\bytecodecompare\prepare_report.py ..\build\solc\%CONFIGURATION%\solc.exe
+
+git clone --depth 2 git@github.com:ethereum/solidity-test-bytecode.git
+cd solidity-test-bytecode
+git config user.name "travis"
+git config user.email "chris@ethereum.org"
+git clean -f -d -x
+
+mkdir %COMMIT%
+set REPORT=%COMMIT%/windows.txt
+cp ../report.txt %REPORT%
+git add %REPORT%
+git commit -a -m "Added report."
+git push origin
diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh
new file mode 100755
index 00000000..cdf376a6
--- /dev/null
+++ b/scripts/bytecodecompare/storebytecode.sh
@@ -0,0 +1,101 @@
+#!/usr/bin/env bash
+
+#------------------------------------------------------------------------------
+# Script used for cross-platform comparison as part of the travis automation.
+# Splits all test source code into multiple files, generates bytecode and
+# uploads the bytecode into github.com/ethereum/solidity-test-bytecode where
+# another travis job is triggered to do the actual comparison.
+#
+# ------------------------------------------------------------------------------
+# This file is part of solidity.
+#
+# solidity is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# solidity is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with solidity. If not, see <http://www.gnu.org/licenses/>
+#
+# (c) 2017 solidity contributors.
+#------------------------------------------------------------------------------
+
+set -e
+
+REPO_ROOT="$(dirname "$0")"/../..
+
+echo "Compiling all test contracts into bytecode..."
+TMPDIR=$(mktemp -d)
+(
+ cd "$REPO_ROOT"
+ REPO_ROOT=$(pwd) # make it absolute
+ cd "$TMPDIR"
+
+ "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
+
+ if [[ "$SOLC_EMSCRIPTEN" = "On" ]]
+ then
+ cp "$REPO_ROOT/build/solc/soljson.js" .
+ npm install solc
+ cat > solc <<EOF
+#!/usr/bin/env node
+var process = require('process')
+var fs = require('fs')
+
+var compiler = require('solc/wrapper.js')(require('./soljson.js'))
+
+for (var optimize of [false, true])
+{
+ for (var filename of process.argv.slice(2))
+ {
+ if (filename !== undefined)
+ {
+ var inputs = {}
+ inputs[filename] = fs.readFileSync(filename).toString()
+ var result = compiler.compile({sources: inputs}, optimize)
+ if (!('contracts' in result) || Object.keys(result['contracts']).length === 0)
+ {
+ console.log(filename + ': ERROR')
+ }
+ else
+ {
+ for (var contractName in result['contracts'])
+ {
+ console.log(contractName + ' ' + result['contracts'][contractName].bytecode)
+ console.log(contractName + ' ' + result['contracts'][contractName].metadata)
+ }
+ }
+ }
+ }
+}
+EOF
+ chmod +x solc
+ ./solc *.sol > report.txt
+ else
+ $REPO_ROOT/scripts/bytecodecompare/prepare_report.py $REPO_ROOT/build/solc/solc
+ fi
+
+ openssl aes-256-cbc -K $encrypted_60701c962b9c_key -iv $encrypted_60701c962b9c_iv -in "$REPO_ROOT"/scripts/bytecodecompare/deploy_key.enc -out deploy_key -d
+ chmod 600 deploy_key
+ eval `ssh-agent -s`
+ ssh-add deploy_key
+
+ git clone --depth 2 git@github.com:ethereum/solidity-test-bytecode.git
+ cd solidity-test-bytecode
+ git config user.name "travis"
+ git config user.email "chris@ethereum.org"
+ git clean -f -d -x
+
+ mkdir -p "$TRAVIS_COMMIT"
+ REPORT="$TRAVIS_COMMIT/$ZIP_SUFFIX.txt"
+ cp ../report.txt "$REPORT"
+ git add "$REPORT"
+ git commit -a -m "Added report $REPORT"
+ git push origin
+)
+rm -rf "$TMPDIR" \ No newline at end of file
diff --git a/scripts/create_source_tarball.sh b/scripts/create_source_tarball.sh
index bf8a336b..9ca72c31 100755
--- a/scripts/create_source_tarball.sh
+++ b/scripts/create_source_tarball.sh
@@ -15,7 +15,7 @@ REPO_ROOT="$(dirname "$0")"/..
then
versionstring="$version"
else
- versionstring="$version-develop-$commitdate-$commithash"
+ versionstring="$version-nightly-$commitdate-$commithash"
fi
TEMPDIR=$(mktemp -d)
diff --git a/scripts/isolate_tests.py b/scripts/isolate_tests.py
index 9bb52f4c..a1d1c75c 100755
--- a/scripts/isolate_tests.py
+++ b/scripts/isolate_tests.py
@@ -8,10 +8,12 @@
import sys
import re
-
+import os
+import hashlib
+from os.path import join
def extract_cases(path):
- lines = open(path).read().splitlines()
+ lines = open(path, 'rb').read().splitlines()
inside = False
delimiter = ''
@@ -33,16 +35,14 @@ def extract_cases(path):
return tests
-def write_cases(tests, start=0):
- for i, test in enumerate(tests, start=start):
- open('test%d.sol' % i, 'w').write(test)
-
+def write_cases(tests):
+ for test in tests:
+ open('test_%s.sol' % hashlib.sha256(test).hexdigest(), 'wb').write(test)
if __name__ == '__main__':
- files = sys.argv[1:]
+ path = sys.argv[1]
- i = 0
- for path in files:
- cases = extract_cases(path)
- write_cases(cases, start=i)
- i += len(cases)
+ for root, dir, files in os.walk(path):
+ for f in files:
+ cases = extract_cases(join(root, f))
+ write_cases(cases)