Add backup extension to all sed commands in the command line tests for OSX sed.

This commit is contained in:
Daniel Kirchner 2019-09-06 14:19:49 +02:00
parent f84371b2e0
commit 94ce0462ba

View File

@ -143,9 +143,9 @@ function test_solc_behaviour()
if [[ "$solc_args" == *"--standard-json"* ]]
then
sed -i -e 's/{[^{]*Warning: This is a pre-release compiler version[^}]*},\{0,1\}//' "$stdout_path"
sed -i.bak -e 's/{[^{]*Warning: This is a pre-release compiler version[^}]*},\{0,1\}//' "$stdout_path"
sed -i.bak -E -e 's/ Consider adding \\"pragma solidity \^[0-9.]*;\\"//g' "$stdout_path"
sed -i -e 's/"errors":\[\],\{0,1\}//' "$stdout_path"
sed -i.bak -e 's/"errors":\[\],\{0,1\}//' "$stdout_path"
# Remove explicit bytecode and references to bytecode offsets
sed -i.bak -E -e 's/\"object\":\"[a-f0-9]+\"/\"object\":\"bytecode removed\"/g' "$stdout_path"
sed -i.bak -E -e 's/\"opcodes\":\"[^"]+\"/\"opcodes\":\"opcodes removed\"/g' "$stdout_path"
@ -154,16 +154,18 @@ function test_solc_behaviour()
sed -i.bak -E -e 's/\\n/\'$'\n/g' "$stdout_path"
rm "$stdout_path.bak"
else
sed -i -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
sed -i -e 's/ Consider adding "pragma .*$//' "$stderr_path"
sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
sed -i.bak -e 's/ Consider adding "pragma .*$//' "$stderr_path"
# Remove trailing empty lines. Needs a line break to make OSX sed happy.
sed -i -e '1{/^$/d
sed -i.bak -e '1{/^$/d
}' "$stderr_path"
rm "$stderr_path.bak"
fi
# Remove path to cpp file
sed -i -e 's/^\(Exception while assembling:\).*/\1/' "$stderr_path"
sed -i.bak -e 's/^\(Exception while assembling:\).*/\1/' "$stderr_path"
# Remove exception class name.
sed -i -e 's/^\(Dynamic exception type:\).*/\1/' "$stderr_path"
sed -i.bak -e 's/^\(Dynamic exception type:\).*/\1/' "$stderr_path"
rm "$stderr_path.bak"
if [[ $exitCode -ne "$exit_code_expected" ]]
then