mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12018 from ethereum/fix-silent-errors-in-ast-import-tests
Fix silent errors in AST import tests
This commit is contained in:
commit
487c5ce613
@ -42,15 +42,24 @@ function testImportExportEquivalence {
|
|||||||
|
|
||||||
if $SOLC "$nth_input_file" "${all_input_files[@]}" > /dev/null 2>&1
|
if $SOLC "$nth_input_file" "${all_input_files[@]}" > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
|
! [[ -e stderr.txt ]] || { echo "stderr.txt already exists. Refusing to overwrite."; exit 1; }
|
||||||
|
|
||||||
# save exported json as expected result (silently)
|
# save exported json as expected result (silently)
|
||||||
$SOLC --combined-json ast,compact-format --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected.json 2> /dev/null
|
$SOLC --combined-json ast,compact-format --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected.json 2> /dev/null
|
||||||
# import it, and export it again as obtained result (silently)
|
# import it, and export it again as obtained result (silently)
|
||||||
if ! $SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
|
if ! $SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> stderr.txt
|
||||||
then
|
then
|
||||||
# For investigating, use exit 1 here so the script stops at the
|
# For investigating, use exit 1 here so the script stops at the
|
||||||
# first failing test
|
# first failing test
|
||||||
# exit 1
|
# exit 1
|
||||||
FAILED=$((FAILED + 1))
|
FAILED=$((FAILED + 1))
|
||||||
|
echo -e "ERROR: AST reimport failed for input file $nth_input_file"
|
||||||
|
echo
|
||||||
|
echo "Compiler stderr:"
|
||||||
|
cat ./stderr.txt
|
||||||
|
echo
|
||||||
|
echo "Compiler stdout:"
|
||||||
|
cat ./obtained.json
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
DIFF="$(diff expected.json obtained.json)"
|
DIFF="$(diff expected.json obtained.json)"
|
||||||
@ -72,6 +81,7 @@ function testImportExportEquivalence {
|
|||||||
fi
|
fi
|
||||||
TESTED=$((TESTED + 1))
|
TESTED=$((TESTED + 1))
|
||||||
rm expected.json obtained.json
|
rm expected.json obtained.json
|
||||||
|
rm -f stderr.txt
|
||||||
else
|
else
|
||||||
# echo "contract $solfile could not be compiled "
|
# echo "contract $solfile could not be compiled "
|
||||||
UNCOMPILABLE=$((UNCOMPILABLE + 1))
|
UNCOMPILABLE=$((UNCOMPILABLE + 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user