Quote stuff properly

This commit is contained in:
Kamil Śliwak
2021-02-01 17:14:38 +01:00
parent 566d49a1d1
commit 27754d3e3d
27 changed files with 124 additions and 124 deletions
+13 -13
View File
@@ -16,7 +16,7 @@ SPLITSOURCES=${REPO_ROOT}/scripts/splitSources.py
SYNTAXTESTS_DIR="${REPO_ROOT}/test/libsolidity/syntaxTests"
ASTJSONTESTS_DIR="${REPO_ROOT}/test/libsolidity/ASTJSON"
NSOURCES="$(find $SYNTAXTESTS_DIR -type f | wc -l)"
NSOURCES="$(find "$SYNTAXTESTS_DIR" -type f | wc -l)"
# DEV_DIR="${REPO_ROOT}/../tmp/contracts/"
# NSOURCES="$(find $DEV_DIR -type f | wc -l)" #TODO use find command
@@ -25,7 +25,7 @@ FAILED=0
UNCOMPILABLE=0
TESTED=0
if [ $(ls | wc -l) -ne 0 ]; then
if [ "$(ls | wc -l)" -ne 0 ]; then
echo "Test directory not empty. Skipping!"
exit -1
fi
@@ -37,10 +37,10 @@ fi
# $1 name of the file to be exported and imported
# $2 any files needed to do so that might be in parent directories
function testImportExportEquivalence {
if $SOLC $1 $2 > /dev/null 2>&1
if $SOLC "$1" $2 > /dev/null 2>&1
then
# save exported json as expected result (silently)
$SOLC --combined-json ast,compact-format --pretty-json $1 $2> expected.json 2> /dev/null
$SOLC --combined-json ast,compact-format --pretty-json "$1" $2 > expected.json 2> /dev/null
# import it, and export it again as obtained result (silently)
$SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
if [ $? -ne 0 ]
@@ -81,15 +81,15 @@ echo "Looking at $NSOURCES .sol files..."
WORKINGDIR=$PWD
# for solfile in $(find $DEV_DIR -name *.sol)
for solfile in $(find $SYNTAXTESTS_DIR $ASTJSONTESTS_DIR -name *.sol)
for solfile in $(find "$SYNTAXTESTS_DIR" "$ASTJSONTESTS_DIR" -name *.sol)
do
echo -n "."
# create a temporary sub-directory
FILETMP=$(mktemp -d)
cd $FILETMP
cd "$FILETMP"
set +e
OUTPUT=$($SPLITSOURCES $solfile)
OUTPUT=$("$SPLITSOURCES" "$solfile")
SPLITSOURCES_RC=$?
set -e
if [ ${SPLITSOURCES_RC} == 0 ]
@@ -103,29 +103,29 @@ do
done
elif [ ${SPLITSOURCES_RC} == 1 ]
then
testImportExportEquivalence $solfile
testImportExportEquivalence "$solfile"
elif [ ${SPLITSOURCES_RC} == 2 ]
then
# The script will exit with return code 2, if an UnicodeDecodeError occurred.
# This is the case if e.g. some tests are using invalid utf-8 sequences. We will ignore
# these errors, but print the actual output of the script.
echo -e "\n${OUTPUT}\n"
testImportExportEquivalence $solfile
testImportExportEquivalence "$solfile"
else
# All other return codes will be treated as critical errors. The script will exit.
echo -e "\nGot unexpected return code ${SPLITSOURCES_RC} from ${SPLITSOURCES}. Aborting."
echo -e "\n${OUTPUT}\n"
cd $WORKINGDIR
cd "$WORKINGDIR"
# Delete temporary files
rm -rf $FILETMP
rm -rf "$FILETMP"
exit 1
fi
cd $WORKINGDIR
cd "$WORKINGDIR"
# Delete temporary files
rm -rf $FILETMP
rm -rf "$FILETMP"
done
echo ""