Skip to content

Commit ed9c09b

Browse files
committed
[scripts/AsmJsonImportTest.sh] Enable checks of source maps & minor improvements.
1 parent 5c3a618 commit ed9c09b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

scripts/AsmJsonImportTest.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
22

33
# Bash script to test the asm-json-import input mode of the compiler by
4-
# first exporting a .sol file to JSON that containing assembly json and corresponding bytecode,
4+
# first exporting a .sol file to JSON that containing assembly json, deploy & runtime bytecode, opcodes and source mappings,
55
# then the compiler is invoked in assembly json import mode `--import-asm-json` and uses the previously
6-
# generated assembly json as input, where the corresponding bytecode output will be stored.
7-
# Finally, the originally generated bytecode will be compared with the one that was generated by using the
8-
# assembly json file as input.
6+
# generated assembly. This output will be stored.
7+
# Finally, the originally generated outputs (bin, bin-runtime, opcodes, asm, srcmap and srcmap-runtime)
8+
# will be compared with the outputs that where generated by using the assembly json file as input.
99

1010
set -eo pipefail
1111
READLINK=readlink
@@ -34,7 +34,6 @@ function testImportExportEquivalence {
3434
if $SOLC "$nth_input_file" "${all_input_files[@]}" --combined-json asm,bin > /dev/null 2>&1
3535
then
3636
local types=( "bin" "bin-runtime" "opcodes" "asm" "srcmap" "srcmap-runtime" )
37-
local test_types=( "bin" "bin-runtime" "opcodes" "asm" )
3837

3938
# save exported json as expected result (silently)
4039
$SOLC --combined-json asm,opcodes,bin,srcmap,srcmap-runtime,bin-runtime --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected.json 2> /dev/null
@@ -62,7 +61,7 @@ function testImportExportEquivalence {
6261
return 1
6362
fi
6463

65-
for type in "${test_types[@]}"
64+
for type in "${types[@]}"
6665
do
6766
jq --raw-output ".contracts.\"expected.asm\".\"${type}\"" imported.json > "imported.${type}"
6867
if ! diff "expected.${type}" "imported.${type}"
@@ -77,7 +76,7 @@ function testImportExportEquivalence {
7776
echo "Obtained:"
7877
cat "./imported.${type}"
7978
else
80-
# Use user supplied diff view binary
79+
# Use user supplied diff view mismatched output
8180
$DIFFVIEW "expected.${type}" "imported.${type}"
8281
fi
8382
FAILED=$((FAILED + 1))
@@ -86,12 +85,17 @@ function testImportExportEquivalence {
8685
done
8786
done
8887
TESTED=$((TESTED + 1))
89-
rm -f expected.json asm.json expected.bin imported.bin
88+
rm -f expected.json
89+
rm -f imported.json
90+
for type in "${types[@]}"
91+
do
92+
rm -f "expected.${type}"
93+
rm -f "imported.${type}"
94+
done
9095
else
9196
# echo "contract $solfile could not be compiled "
9297
UNCOMPILABLE=$((UNCOMPILABLE + 1))
9398
fi
94-
# return 0
9599
}
96100
echo "Looking at $NSOURCES .sol files..."
97101

0 commit comments

Comments
 (0)