Refactor compilation tests.

This commit is contained in:
chriseth 2017-07-12 19:06:36 +02:00
parent d3b447c203
commit a8d78bb767
2 changed files with 51 additions and 36 deletions

View File

@ -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"

View File

@ -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
output=$("$SOLC" "$f" 2>&1)
"$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" $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"