mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8502 from mijovic/testDocsPragma
[docs] Compile examples with minimal compiler version
This commit is contained in:
+2
-53
@@ -33,6 +33,7 @@ set -e
|
||||
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
|
||||
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-build}
|
||||
source "${REPO_ROOT}/scripts/common.sh"
|
||||
source "${REPO_ROOT}/scripts/common_cmdline.sh"
|
||||
|
||||
case "$OSTYPE" in
|
||||
msys)
|
||||
@@ -45,6 +46,7 @@ case "$OSTYPE" in
|
||||
SOLC="$REPO_ROOT/${SOLIDITY_BUILD_DIR}/solc/solc"
|
||||
;;
|
||||
esac
|
||||
echo "${SOLC}"
|
||||
|
||||
INTERACTIVE=true
|
||||
if ! tty -s || [ "$CI" ]
|
||||
@@ -52,8 +54,6 @@ then
|
||||
INTERACTIVE=""
|
||||
fi
|
||||
|
||||
FULLARGS="--optimize --ignore-missing --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,userdoc"
|
||||
|
||||
# extend stack size in case we run via ASAN
|
||||
if [[ -n "${CIRCLECI}" ]] || [[ -n "$CI" ]]; then
|
||||
ulimit -s 16384
|
||||
@@ -62,57 +62,6 @@ fi
|
||||
|
||||
## FUNCTIONS
|
||||
|
||||
function compileFull()
|
||||
{
|
||||
local expected_exit_code=0
|
||||
local expect_output=0
|
||||
if [[ $1 = '-e' ]]
|
||||
then
|
||||
expected_exit_code=1
|
||||
expect_output=1
|
||||
shift;
|
||||
fi
|
||||
if [[ $1 = '-w' ]]
|
||||
then
|
||||
expect_output=1
|
||||
shift;
|
||||
fi
|
||||
if [[ $1 = '-o' ]]
|
||||
then
|
||||
expect_output=2
|
||||
shift;
|
||||
fi
|
||||
|
||||
local files="$*"
|
||||
local output
|
||||
|
||||
local stderr_path=$(mktemp)
|
||||
|
||||
set +e
|
||||
"$SOLC" $FULLARGS $files >/dev/null 2>"$stderr_path"
|
||||
local exit_code=$?
|
||||
local errors=$(grep -v -E 'Warning: This is a pre-release compiler version|Warning: Experimental features are turned on|pragma experimental ABIEncoderV2|^ +--> |^ +\||^[0-9]+ +\|' < "$stderr_path")
|
||||
set -e
|
||||
rm "$stderr_path"
|
||||
|
||||
if [[ \
|
||||
"$exit_code" -ne "$expected_exit_code" || \
|
||||
( $expect_output -eq 0 && -n "$errors" ) || \
|
||||
( $expect_output -eq 1 && -z "$errors" ) \
|
||||
]]
|
||||
then
|
||||
printError "Unexpected compilation result:"
|
||||
printError "Expected failure: $expected_exit_code - Expected warning / error output: $expect_output"
|
||||
printError "Was failure: $exit_code"
|
||||
echo "$errors"
|
||||
printError "While calling:"
|
||||
echo "\"$SOLC\" $FULLARGS $files"
|
||||
printError "Inside directory:"
|
||||
pwd
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
function ask_expectation_update()
|
||||
{
|
||||
if [ $INTERACTIVE ]
|
||||
|
||||
Reference in New Issue
Block a user