@@ -92,7 +92,7 @@ echo "Using solc binary at ${SOLC}"
9292INTERACTIVE=true
9393if ! tty -s || [ " $CI " ]
9494then
95- INTERACTIVE=" "
95+ INTERACTIVE=false
9696fi
9797
9898# extend stack size in case we run via ASAN
@@ -123,7 +123,7 @@ function update_expectation {
123123
124124function ask_expectation_update
125125{
126- if [[ $INTERACTIVE != " " ]]
126+ if [[ $INTERACTIVE == true ]]
127127 then
128128 local newExpectation=" ${1} "
129129 local expectationFile=" ${2} "
@@ -142,12 +142,13 @@ function ask_expectation_update
142142 e* ) " $editor " " $expectationFile " ; break ;;
143143 u* ) update_expectation " $newExpectation " " $expectationFile " ; break ;;
144144 s* ) return ;;
145- q* ) exit 1 ;;
145+ q* ) fail ;;
146146 esac
147147 done
148148 fi
149149 else
150- exit 1
150+ [[ $INTERACTIVE == false ]] || assertFail
151+ fail
151152 fi
152153}
153154
252253 printError " Incorrect exit code. Expected $exit_code_expected but got $exitCode ."
253254
254255 [[ $exit_code_expectation_file != " " ]] && ask_expectation_update " $exitCode " " $exit_code_expectation_file "
255- [[ $exit_code_expectation_file == " " ]] && exit 1
256+ [[ $exit_code_expectation_file == " " ]] && fail
256257 fi
257258
258259 if [[ " $( cat " $stdout_path " ) " != " ${stdout_expected} " ]]
266267 printError " When running $solc_command "
267268
268269 [[ $stdout_expectation_file != " " ]] && ask_expectation_update " $( cat " $stdout_path " ) " " $stdout_expectation_file "
269- [[ $stdout_expectation_file == " " ]] && exit 1
270+ [[ $stdout_expectation_file == " " ]] && fail
270271 fi
271272
272273 if [[ " $( cat " $stderr_path " ) " != " ${stderr_expected} " ]]
280281 printError " When running $solc_command "
281282
282283 [[ $stderr_expectation_file != " " ]] && ask_expectation_update " $( cat " $stderr_path " ) " " $stderr_expectation_file "
283- [[ $stderr_expectation_file == " " ]] && exit 1
284+ [[ $stderr_expectation_file == " " ]] && fail
284285 fi
285286
286287 rm " $stdout_path " " $stderr_path "
@@ -300,10 +301,10 @@ function test_solc_assembly_output()
300301 if [ -z " $empty " ]
301302 then
302303 printError " Incorrect assembly output. Expected: "
303- echo -e " ${expected} "
304+ >&2 echo -e " ${expected} "
304305 printError " with arguments ${solc_args[*]} , but got:"
305- echo " ${output} "
306- exit 1
306+ >&2 echo " ${output} "
307+ fail
307308 fi
308309}
309310
@@ -373,7 +374,7 @@ printTask "Running general commandline tests..."
373374 then
374375 printError " Ambiguous input. Found input files in multiple formats:"
375376 echo -e " ${inputFiles} "
376- exit 1
377+ fail
377378 fi
378379
379380 # Use printf to get rid of the trailing newline
@@ -475,7 +476,8 @@ echo "Done."
475476
476477printTask " Testing library checksum..."
477478echo ' ' | msg_on_error --no-stdout " $SOLC " - --link --libraries a=0x90f20564390eAe531E810af625A22f51385Cd222
478- echo ' ' | " $SOLC " - --link --libraries a=0x80f20564390eAe531E810af625A22f51385Cd222 & > /dev/null && exit 1
479+ echo ' ' | " $SOLC " - --link --libraries a=0x80f20564390eAe531E810af625A22f51385Cd222 & > /dev/null && \
480+ fail " solc --link did not reject a library address with an invalid checksum."
479481
480482printTask " Testing long library names..."
481483echo ' ' | msg_on_error --no-stdout " $SOLC " - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname=0x90f20564390eAe531E810af625A22f51385Cd222
@@ -503,7 +505,8 @@ SOLTMPDIR=$(mktemp -d)
503505 # First time it works
504506 echo ' contract C {}' | msg_on_error --no-stderr " $SOLC " - --bin -o " $SOLTMPDIR /non-existing-stuff-to-create"
505507 # Second time it fails
506- echo ' contract C {}' | " $SOLC " - --bin -o " $SOLTMPDIR /non-existing-stuff-to-create" 2> /dev/null && exit 1
508+ echo ' contract C {}' | " $SOLC " - --bin -o " $SOLTMPDIR /non-existing-stuff-to-create" 2> /dev/null && \
509+ fail " solc did not refuse to overwrite $SOLTMPDIR /non-existing-stuff-to-create."
507510 # Unless we force
508511 echo ' contract C {}' | msg_on_error --no-stderr " $SOLC " - --overwrite --bin -o " $SOLTMPDIR /non-existing-stuff-to-create"
509512)
@@ -517,8 +520,8 @@ printTask "Testing assemble, yul, strict-assembly and optimize..."
517520
518521 # Test options above in conjunction with --optimize.
519522 # Using both, --assemble and --optimize should fail.
520- echo ' {}' | " $SOLC " - --assemble --optimize & > /dev/null && exit 1
521- echo ' {}' | " $SOLC " - --yul --optimize & > /dev/null && exit 1
523+ echo ' {}' | " $SOLC " - --assemble --optimize & > /dev/null && fail " solc --assemble --optimize did not fail as expected. "
524+ echo ' {}' | " $SOLC " - --yul --optimize & > /dev/null && fail " solc --yul --optimize did not fail as expected. "
522525
523526 # Test yul and strict assembly output
524527 # Non-empty code results in non-empty binary representation with optimizations turned off,
@@ -563,8 +566,8 @@ SOLTMPDIR=$(mktemp -d)
563566 cd " $SOLTMPDIR "
564567 if ! " $REPO_ROOT /scripts/ASTImportTest.sh"
565568 then
566- rm -rf " $SOLTMPDIR "
567- exit 1
569+ rm -r " $SOLTMPDIR "
570+ fail
568571 fi
569572)
570573rm -r " $SOLTMPDIR "
0 commit comments