mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
scripts/ImportExportTest.sh: disable --optimize tests for evm-assembly.
This commit is contained in:
parent
e8f76ff661
commit
6700a65f52
@ -99,13 +99,13 @@ function testImportExportEquivalence {
|
|||||||
UNCOMPILABLE=$((UNCOMPILABLE + 1))
|
UNCOMPILABLE=$((UNCOMPILABLE + 1))
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
$SOLC --optimize --combined-json bin,bin-runtime,opcodes,asm,srcmap,srcmap-runtime --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected_optimized.json 2> expected_optimized.error
|
# $SOLC --optimize --combined-json bin,bin-runtime,opcodes,asm,srcmap,srcmap-runtime --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected_optimized.json 2> expected_optimized.error || true
|
||||||
for contract in $(jq '.contracts | keys | .[]' expected.json 2> /dev/null)
|
for contract in $(jq '.contracts | keys | .[]' expected.json 2> /dev/null)
|
||||||
do
|
do
|
||||||
for type in "${types[@]}"
|
for type in "${types[@]}"
|
||||||
do
|
do
|
||||||
jq --raw-output ".contracts.${contract}.\"${type}\"" expected.json > "expected.${type}"
|
jq --raw-output ".contracts.${contract}.\"${type}\"" expected.json > "expected.${type}"
|
||||||
jq --raw-output ".contracts.${contract}.\"${type}\"" expected_optimized.json > "expected_optimized.${type}"
|
# jq --raw-output ".contracts.${contract}.\"${type}\"" expected_optimized.json > "expected_optimized.${type}"
|
||||||
done
|
done
|
||||||
|
|
||||||
assembly=$(cat expected.asm)
|
assembly=$(cat expected.asm)
|
||||||
@ -119,46 +119,51 @@ function testImportExportEquivalence {
|
|||||||
FAILED=$((FAILED + 1))
|
FAILED=$((FAILED + 1))
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
$SOLC --combined-json bin,bin-runtime,opcodes,asm,srcmap,srcmap-runtime --pretty-json --import-asm-json expected.asm > obtained_optimized.json 2> obtained_optimized.error
|
# try to optimize asm json import.
|
||||||
|
# (may fail, because of e.g. "Some immutables were read from but never assigned, possibly because of optimization")
|
||||||
|
# $SOLC --combined-json bin,bin-runtime,opcodes,asm,srcmap,srcmap-runtime --pretty-json --import-asm-json expected.asm > obtained_optimized.json 2> obtained_optimized.error || true
|
||||||
for type in "${types[@]}"
|
for type in "${types[@]}"
|
||||||
do
|
do
|
||||||
for obtained_contract in $(jq '.contracts | keys | .[]' obtained.json 2> /dev/null)
|
for obtained_contract in $(jq '.contracts | keys | .[]' obtained.json 2> /dev/null)
|
||||||
do
|
do
|
||||||
jq --raw-output ".contracts.${obtained_contract}.\"${type}\"" obtained.json > "obtained.${type}"
|
jq --raw-output ".contracts.${obtained_contract}.\"${type}\"" obtained.json > "obtained.${type}"
|
||||||
jq --raw-output ".contracts.${obtained_contract}.\"${type}\"" obtained_optimized.json > "obtained_optimized.${type}"
|
# jq --raw-output ".contracts.${obtained_contract}.\"${type}\"" obtained_optimized.json > "obtained_optimized.${type}"
|
||||||
set +e
|
set +e
|
||||||
DIFF="$(diff "expected.${type}" "obtained.${type}")"
|
DIFF="$(diff "expected.${type}" "obtained.${type}")"
|
||||||
# DIFF_OPTIMIZED="$(diff "expected_optimized.${type}" "obtained_optimized.${type}")"
|
# DIFF_OPTIMIZED="$(diff "expected_optimized.${type}" "obtained_optimized.${type}")"
|
||||||
set -e
|
set -e
|
||||||
if [ "$DIFFVIEW" == "" ]
|
if [ "$DIFF" != "" ] || [ "$DIFF_OPTIMIZED" != "" ]
|
||||||
then
|
then
|
||||||
if [ "$DIFF" != "" ]
|
if [ "$DIFFVIEW" == "" ]
|
||||||
then
|
then
|
||||||
echo -e "ERROR: JSONS differ for $1: \n $DIFF \n"
|
if [ "$DIFF" != "" ]
|
||||||
echo "Expected:"
|
then
|
||||||
cat "expected.${type}"
|
echo -e "ERROR: EVM Assembly JSON differ for $1: \n $DIFF \n"
|
||||||
echo "Obtained:"
|
echo "Expected:"
|
||||||
cat "obtained.${type}"
|
cat "expected.${type}"
|
||||||
fi
|
echo "Obtained:"
|
||||||
if [ "$DIFF_OPTIMIZED" != "" ]
|
cat "obtained.${type}"
|
||||||
then
|
fi
|
||||||
echo -e "ERROR: JSONS (optimized) differ for $1: \n $DIFF \n"
|
if [ "$DIFF_OPTIMIZED" != "" ]
|
||||||
echo "Expected (optimized):"
|
then
|
||||||
cat "expected_optimized.${type}"
|
echo -e "ERROR: EVM Assembly JSON (optimization was enabled) differ for $1: \n $DIFF \n"
|
||||||
echo "Obtained (optimized):"
|
echo "Expected (optimized):"
|
||||||
cat "obtained_optimized.${type}"
|
cat "expected_optimized.${type}"
|
||||||
fi
|
echo "Obtained (optimized):"
|
||||||
else
|
cat "obtained_optimized.${type}"
|
||||||
# Use user supplied diff view binary
|
fi
|
||||||
if [ "$DIFF" != "" ]
|
else
|
||||||
then
|
# Use user supplied diff view binary
|
||||||
echo "$DIFFVIEW expected.json obtained.json"
|
if [ "$DIFF" != "" ]
|
||||||
$DIFFVIEW expected.json obtained.json
|
then
|
||||||
fi
|
echo "$DIFFVIEW expected.json obtained.json"
|
||||||
if [ "$DIFF_OPTIMIZED" != "" ]
|
$DIFFVIEW expected.json obtained.json
|
||||||
then
|
fi
|
||||||
echo "$DIFFVIEW expected_optimized.json obtained_optimized.json"
|
if [ "$DIFF_OPTIMIZED" != "" ]
|
||||||
$DIFFVIEW expected_optimized.json obtained_optimized.json
|
then
|
||||||
|
echo "$DIFFVIEW expected_optimized.json obtained_optimized.json"
|
||||||
|
$DIFFVIEW expected_optimized.json obtained_optimized.json
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
_TESTED=
|
_TESTED=
|
||||||
FAILED=$((FAILED + 1))
|
FAILED=$((FAILED + 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user