diff options
-rwxr-xr-x | scripts/tests.sh | 21 | ||||
-rwxr-xr-x | test/cmdlineTests.sh | 66 |
2 files changed, 51 insertions, 36 deletions
diff --git a/scripts/tests.sh b/scripts/tests.sh index 64b4121f..5d7eb0e1 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -30,27 +30,6 @@ set -e REPO_ROOT="$(dirname "$0")"/.. -echo "Checking that StandardToken.sol, owned.sol and mortal.sol produce bytecode..." -output=$("$REPO_ROOT"/build/solc/solc --bin "$REPO_ROOT"/std/*.sol 2>/dev/null | grep "ffff" | wc -l) -test "${output//[[:blank:]]/}" = "3" - -echo "Compiling various other contracts and libraries..." -( -cd "$REPO_ROOT"/test/compilationTests/ -for dir in * -do - if [ "$dir" != "README.md" ] - then - echo " - $dir" - cd "$dir" - ../../../build/solc/solc --optimize \ - --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,compact-format,devdoc,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,userdoc \ - *.sol */*.sol > /dev/null 2>&1 - cd .. - fi -done -) - echo "Running commandline tests..." "$REPO_ROOT/test/cmdlineTests.sh" diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index 97823515..eb5c714d 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -28,25 +28,68 @@ set -e -REPO_ROOT="$(dirname "$0")"/.. +REPO_ROOT=$(cd $(dirname "$0")/.. && pwd) +echo $REPO_ROOT SOLC="$REPO_ROOT/build/solc/solc" echo "Checking that the bug list is up to date..." "$REPO_ROOT"/scripts/update_bugs_by_version.py -echo "Compiling all files in std and examples..." +echo "Checking that StandardToken.sol, owned.sol and mortal.sol produce bytecode..." +output=$("$REPO_ROOT"/build/solc/solc --bin "$REPO_ROOT"/std/*.sol 2>/dev/null | grep "ffff" | wc -l) +test "${output//[[:blank:]]/}" = "3" -for f in "$REPO_ROOT"/std/*.sol -do - echo "Compiling $f..." +function compileFull() +{ + files="$*" + set +e + "$SOLC" --optimize \ + --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,compact-format,devdoc,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,userdoc \ + $files >/dev/null 2>&1 + failed=$? + set -e + if [ $failed -ne 0 ] + then + echo "Compilation failed on:" + cat $files + false + fi +} + +function compileWithoutWarning() +{ + files="$*" set +e - output=$("$SOLC" "$f" 2>&1) + output=$("$SOLC" $files 2>&1) failed=$? # Remove the pre-release warning from the compiler output output=$(echo "$output" | grep -v 'pre-release') echo "$output" set -e test -z "$output" -a "$failed" -eq 0 +} + +echo "Compiling various other contracts and libraries..." +( +cd "$REPO_ROOT"/test/compilationTests/ +for dir in * +do + if [ "$dir" != "README.md" ] + then + echo " - $dir" + cd "$dir" + compileFull *.sol */*.sol + cd .. + fi +done +) + +echo "Compiling all files in std and examples..." + +for f in "$REPO_ROOT"/std/*.sol +do + echo "$f" + compileWithoutWarning "$f" done echo "Compiling all examples from the documentation..." @@ -59,15 +102,8 @@ TMPDIR=$(mktemp -d) "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs for f in *.sol do - echo "trying $f" - set +e - output=$("$SOLC" "$f" 2>&1) - failed=$? - # Remove the pre-release warning from the compiler output - output=$(echo "$output" | grep -v 'pre-release') - echo "$output" - set -e - test -z "$output" -a "$failed" -eq 0 + echo "$f" + compileFull "$TMPDIR/$f" done ) rm -rf "$TMPDIR" |