mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Refactor compilation tests.
This commit is contained in:
parent
d3b447c203
commit
a8d78bb767
@ -30,27 +30,6 @@ set -e
|
|||||||
|
|
||||||
REPO_ROOT="$(dirname "$0")"/..
|
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..."
|
echo "Running commandline tests..."
|
||||||
"$REPO_ROOT/test/cmdlineTests.sh"
|
"$REPO_ROOT/test/cmdlineTests.sh"
|
||||||
|
|
||||||
|
@ -28,25 +28,68 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
REPO_ROOT="$(dirname "$0")"/..
|
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
|
||||||
|
echo $REPO_ROOT
|
||||||
SOLC="$REPO_ROOT/build/solc/solc"
|
SOLC="$REPO_ROOT/build/solc/solc"
|
||||||
|
|
||||||
echo "Checking that the bug list is up to date..."
|
echo "Checking that the bug list is up to date..."
|
||||||
"$REPO_ROOT"/scripts/update_bugs_by_version.py
|
"$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
|
function compileFull()
|
||||||
do
|
{
|
||||||
echo "Compiling $f..."
|
files="$*"
|
||||||
set +e
|
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=$?
|
failed=$?
|
||||||
# Remove the pre-release warning from the compiler output
|
# Remove the pre-release warning from the compiler output
|
||||||
output=$(echo "$output" | grep -v 'pre-release')
|
output=$(echo "$output" | grep -v 'pre-release')
|
||||||
echo "$output"
|
echo "$output"
|
||||||
set -e
|
set -e
|
||||||
test -z "$output" -a "$failed" -eq 0
|
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
|
done
|
||||||
|
|
||||||
echo "Compiling all examples from the documentation..."
|
echo "Compiling all examples from the documentation..."
|
||||||
@ -59,15 +102,8 @@ TMPDIR=$(mktemp -d)
|
|||||||
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
|
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
|
||||||
for f in *.sol
|
for f in *.sol
|
||||||
do
|
do
|
||||||
echo "trying $f"
|
echo "$f"
|
||||||
set +e
|
compileFull "$TMPDIR/$f"
|
||||||
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
|
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
rm -rf "$TMPDIR"
|
rm -rf "$TMPDIR"
|
||||||
|
Loading…
Reference in New Issue
Block a user