Only ask for cmdline test updates in interactive runs.

This commit is contained in:
chriseth 2019-04-15 23:51:31 +02:00
parent edfebcf957
commit 6bc5068a67

View File

@ -32,6 +32,11 @@ set -e
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd) REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
SOLC="$REPO_ROOT/build/solc/solc" SOLC="$REPO_ROOT/build/solc/solc"
INTERACTIVE=true
if ! tty -s || [ "$CI" ]
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" FULLARGS="--optimize --ignore-missing --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,userdoc"
@ -95,23 +100,19 @@ function compileFull()
function ask_expectation_update() function ask_expectation_update()
{ {
local newExpectation="${1}" if [ $INTERACTIVE ]
local expectationFile="${2}" then
while true; local newExpectation="${1}"
do local expectationFile="${2}"
set +e while true;
read -t10 -p "(u)pdate expectation/(q)uit? " do
if [ $? -gt 128 ]; read -p "(u)pdate expectation/(q)uit? "
then case $REPLY in
echo -e "\nUser input timed out." u* ) echo "$newExpectation" > $expectationFile ; break;;
exit 1 q* ) exit 1;;
fi esac
set -e done
case $REPLY in fi
u* ) echo "$newExpectation" > $expectationFile ; break;;
q* ) exit 1;;
esac
done
} }
# 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.
@ -165,10 +166,10 @@ function test_solc_behaviour()
if [[ "$(cat $stdout_path)" != "${stdout_expected}" ]] if [[ "$(cat $stdout_path)" != "${stdout_expected}" ]]
then then
printError "Incorrect output on stdout received. Expected:" printError "Incorrect output on stdout received. Expected:"
echo "${stdout_expected}" echo -e "${stdout_expected}"
printError "But got:" printError "But got:"
cat $stdout_path echo -e "$(cat $stdout_path)"
printError "When running $solc_command" printError "When running $solc_command"
@ -183,10 +184,10 @@ function test_solc_behaviour()
if [[ "$(cat $stderr_path)" != "${stderr_expected}" ]] if [[ "$(cat $stderr_path)" != "${stderr_expected}" ]]
then then
printError "Incorrect output on stderr received. Expected:" printError "Incorrect output on stderr received. Expected:"
echo "${stderr_expected}" echo -e "${stderr_expected}"
printError "But got:" printError "But got:"
cat $stderr_path echo -e "$(cat $stderr_path)"
printError "When running $solc_command" printError "When running $solc_command"