mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
scripts/ImportExportTest.sh: add support for 'set -euo pipefail'.
This commit is contained in:
parent
c5e6a5b4b8
commit
3e2b62ab89
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -euo pipefail
|
||||
IMPORT_TEST_TYPE="${1}"
|
||||
|
||||
# Bash script to test the import/exports.
|
||||
@ -60,7 +60,7 @@ function Ast_ImportExportEquivalence
|
||||
set +e
|
||||
diff_files expected.json obtained.json
|
||||
DIFF=$?
|
||||
set -e
|
||||
set -euo pipefail
|
||||
if [[ ${DIFF} != 0 ]]
|
||||
then
|
||||
FAILED=$((FAILED + 1))
|
||||
@ -112,7 +112,7 @@ function JsonEvmAsm_ImportExportEquivalence
|
||||
set +e
|
||||
diff_files "expected.${output}" "obtained.${output}"
|
||||
DIFF=$?
|
||||
set -e
|
||||
set -euo pipefail
|
||||
if [[ ${DIFF} != 0 ]]
|
||||
then
|
||||
_TESTED=
|
||||
@ -137,7 +137,7 @@ function JsonEvmAsm_ImportExportEquivalence
|
||||
set +e
|
||||
diff_files "expected.asm" "obtained_direct_import_export.asm"
|
||||
DIFF=$?
|
||||
set -e
|
||||
set -euo pipefail
|
||||
if [[ ${DIFF} != 0 ]]
|
||||
then
|
||||
_TESTED=
|
||||
@ -166,6 +166,11 @@ function testImportExportEquivalence {
|
||||
local nth_input_file="$1"
|
||||
IFS=" " read -r -a all_input_files <<< "$2"
|
||||
|
||||
if [ -z ${all_input_files+x} ]
|
||||
then
|
||||
all_input_files=( "" )
|
||||
fi
|
||||
|
||||
if $SOLC --bin "$nth_input_file" "${all_input_files[@]}" > /dev/null 2>&1
|
||||
then
|
||||
! [[ -e stderr.txt ]] || { printError "stderr.txt already exists. Refusing to overwrite."; exit 1; }
|
||||
@ -219,7 +224,7 @@ do
|
||||
set +e
|
||||
OUTPUT=$("$SPLITSOURCES" "$solfile")
|
||||
SPLITSOURCES_RC=$?
|
||||
set -e
|
||||
set -euo pipefail
|
||||
if [ ${SPLITSOURCES_RC} == 0 ]
|
||||
then
|
||||
NSOURCES=$((NSOURCES - 1))
|
||||
@ -230,14 +235,14 @@ do
|
||||
done
|
||||
elif [ ${SPLITSOURCES_RC} == 1 ]
|
||||
then
|
||||
testImportExportEquivalence "$solfile"
|
||||
testImportExportEquivalence "$solfile" ""
|
||||
elif [ ${SPLITSOURCES_RC} == 2 ]
|
||||
then
|
||||
# The script will exit with return code 2, if an UnicodeDecodeError occurred.
|
||||
# This is the case if e.g. some tests are using invalid utf-8 sequences. We will ignore
|
||||
# these errors, but print the actual output of the script.
|
||||
printError "\n${OUTPUT}\n"
|
||||
testImportExportEquivalence "$solfile"
|
||||
testImportExportEquivalence "$solfile" ""
|
||||
else
|
||||
# All other return codes will be treated as critical errors. The script will exit.
|
||||
printError "\nGot unexpected return code ${SPLITSOURCES_RC} from ${SPLITSOURCES}. Aborting."
|
||||
|
@ -26,6 +26,11 @@ set -e
|
||||
# changes directory. The paths returned by `caller` are relative to it.
|
||||
_initial_work_dir=$(pwd)
|
||||
|
||||
if [ -z ${CIRCLECI+x} ]
|
||||
then
|
||||
CIRCLECI=0
|
||||
fi
|
||||
|
||||
if [ "$CIRCLECI" ]
|
||||
then
|
||||
export TERM="${TERM:-xterm}"
|
||||
|
Loading…
Reference in New Issue
Block a user