mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move functions to the top.
This commit is contained in:
parent
8a9e012757
commit
88c7975ca5
@ -28,14 +28,14 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
## GLOBAL VARIABLES
|
||||||
|
|
||||||
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
|
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
|
||||||
echo $REPO_ROOT
|
|
||||||
SOLC="$REPO_ROOT/build/solc/solc"
|
SOLC="$REPO_ROOT/build/solc/solc"
|
||||||
|
|
||||||
FULLARGS="--optimize --ignore-missing --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,userdoc"
|
FULLARGS="--optimize --ignore-missing --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,userdoc"
|
||||||
|
|
||||||
echo "Checking that the bug list is up to date..."
|
## FUNCTIONS
|
||||||
"$REPO_ROOT"/scripts/update_bugs_by_version.py
|
|
||||||
|
|
||||||
if [ "$CIRCLECI" ]
|
if [ "$CIRCLECI" ]
|
||||||
then
|
then
|
||||||
@ -93,22 +93,6 @@ function compileFull()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
printTask "Testing unknown options..."
|
|
||||||
(
|
|
||||||
set +e
|
|
||||||
output=$("$SOLC" --allow=test 2>&1)
|
|
||||||
failed=$?
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ "$output" == "unrecognised option '--allow=test'" ] && [ $failed -ne 0 ]
|
|
||||||
then
|
|
||||||
echo "Passed"
|
|
||||||
else
|
|
||||||
printError "Incorrect response to unknown options: $STDERR"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
)
|
|
||||||
|
|
||||||
# General helper function for testing SOLC behaviour, based on file name, compile opts, exit code, stdout and stderr.
|
# General helper function for testing SOLC behaviour, based on file name, compile opts, exit code, stdout and stderr.
|
||||||
# An failure is expected.
|
# An failure is expected.
|
||||||
function test_solc_behaviour()
|
function test_solc_behaviour()
|
||||||
@ -174,6 +158,49 @@ function test_solc_behaviour()
|
|||||||
rm -f $stdout_path $stderr_path
|
rm -f $stdout_path $stderr_path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function test_solc_assembly_output()
|
||||||
|
{
|
||||||
|
local input="${1}"
|
||||||
|
local expected="${2}"
|
||||||
|
local solc_args="${3}"
|
||||||
|
|
||||||
|
local expected_object="object \"object\" { code "${expected}" }"
|
||||||
|
|
||||||
|
output=$(echo "${input}" | "$SOLC" - ${solc_args} 2>/dev/null)
|
||||||
|
empty=$(echo $output | sed -ne '/'"${expected_object}"'/p')
|
||||||
|
if [ -z "$empty" ]
|
||||||
|
then
|
||||||
|
printError "Incorrect assembly output. Expected: "
|
||||||
|
echo -e ${expected}
|
||||||
|
printError "with arguments ${solc_args}, but got:"
|
||||||
|
echo "${output}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## RUN
|
||||||
|
|
||||||
|
echo "Checking that the bug list is up to date..."
|
||||||
|
"$REPO_ROOT"/scripts/update_bugs_by_version.py
|
||||||
|
|
||||||
|
printTask "Testing unknown options..."
|
||||||
|
(
|
||||||
|
set +e
|
||||||
|
output=$("$SOLC" --allow=test 2>&1)
|
||||||
|
failed=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$output" == "unrecognised option '--allow=test'" ] && [ $failed -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "Passed"
|
||||||
|
else
|
||||||
|
printError "Incorrect response to unknown options: $STDERR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
printTask "Testing passing files that are not found..."
|
printTask "Testing passing files that are not found..."
|
||||||
test_solc_behaviour "file_not_found.sol" "" "" "" 1 "\"file_not_found.sol\" is not found."
|
test_solc_behaviour "file_not_found.sol" "" "" "" 1 "\"file_not_found.sol\" is not found."
|
||||||
|
|
||||||
@ -297,26 +324,6 @@ SOLTMPDIR=$(mktemp -d)
|
|||||||
)
|
)
|
||||||
rm -rf "$SOLTMPDIR"
|
rm -rf "$SOLTMPDIR"
|
||||||
|
|
||||||
function test_solc_assembly_output()
|
|
||||||
{
|
|
||||||
local input="${1}"
|
|
||||||
local expected="${2}"
|
|
||||||
local solc_args="${3}"
|
|
||||||
|
|
||||||
local expected_object="object \"object\" { code "${expected}" }"
|
|
||||||
|
|
||||||
output=$(echo "${input}" | "$SOLC" - ${solc_args} 2>/dev/null)
|
|
||||||
empty=$(echo $output | sed -ne '/'"${expected_object}"'/p')
|
|
||||||
if [ -z "$empty" ]
|
|
||||||
then
|
|
||||||
printError "Incorrect assembly output. Expected: "
|
|
||||||
echo -e ${expected}
|
|
||||||
printError "with arguments ${solc_args}, but got:"
|
|
||||||
echo "${output}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
printTask "Testing assemble, yul, strict-assembly and optimize..."
|
printTask "Testing assemble, yul, strict-assembly and optimize..."
|
||||||
(
|
(
|
||||||
echo '{}' | "$SOLC" - --assemble &>/dev/null
|
echo '{}' | "$SOLC" - --assemble &>/dev/null
|
||||||
@ -405,4 +412,5 @@ SOLTMPDIR=$(mktemp -d)
|
|||||||
done
|
done
|
||||||
)
|
)
|
||||||
rm -rf "$SOLTMPDIR"
|
rm -rf "$SOLTMPDIR"
|
||||||
|
|
||||||
echo "Commandline tests successful."
|
echo "Commandline tests successful."
|
||||||
|
Loading…
Reference in New Issue
Block a user