Fix inconsistent indentation in scripts/

- NOT reindenting all files. Just choosing one style in files that were using multiple.
This commit is contained in:
Kamil Śliwak 2020-04-17 14:32:38 +02:00
parent 96ea8b3148
commit a80b032081
10 changed files with 77 additions and 77 deletions

View File

@ -21,8 +21,8 @@ UNCOMPILABLE=0
TESTED=0 TESTED=0
if [ $(ls | wc -l) -ne 0 ]; then if [ $(ls | wc -l) -ne 0 ]; then
echo "Test directory not empty. Skipping!" echo "Test directory not empty. Skipping!"
exit -1 exit -1
fi fi
# function tests whether exporting and importing again leaves the JSON ast unchanged # function tests whether exporting and importing again leaves the JSON ast unchanged
@ -40,11 +40,11 @@ function testImportExportEquivalence {
$SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null $SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
if [ $? -ne 0 ] if [ $? -ne 0 ]
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))
return 1 return 1
fi fi
DIFF="$(diff expected.json obtained.json)" DIFF="$(diff expected.json obtained.json)"
if [ "$DIFF" != "" ] if [ "$DIFF" != "" ]

View File

@ -29,9 +29,9 @@
set -e set -e
if test -z "$1"; then if test -z "$1"; then
BUILD_DIR="emscripten_build" BUILD_DIR="emscripten_build"
else else
BUILD_DIR="$1" BUILD_DIR="$1"
fi fi
docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \ docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \

View File

@ -184,4 +184,4 @@ SOLTMPDIR=$(mktemp -d)
done done
) )
rm -rf "$SOLTMPDIR" rm -rf "$SOLTMPDIR"
echo "Done." echo "Done."

View File

@ -43,7 +43,7 @@ function(download_and_unpack PACKAGE_URL DST_DIR)
if (STATUS) if (STATUS)
message("Unpacking ${FILE_NAME} to ${DST_DIR}") message("Unpacking ${FILE_NAME} to ${DST_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${DST_FILE} execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${DST_FILE}
WORKING_DIRECTORY ${DST_DIR}) WORKING_DIRECTORY ${DST_DIR})
endif() endif()
endfunction(download_and_unpack) endfunction(download_and_unpack)
@ -59,8 +59,8 @@ function(create_package NAME DIR)
set(PACKAGE_FILE "${PACKAGES_DIR}/${NAME}.tar.gz") set(PACKAGE_FILE "${PACKAGES_DIR}/${NAME}.tar.gz")
execute_process(COMMAND ${CMAKE_COMMAND} -E execute_process(COMMAND ${CMAKE_COMMAND} -E
tar -czf ${PACKAGE_FILE} ${TOP_FILES} tar -czf ${PACKAGE_FILE} ${TOP_FILES}
WORKING_DIRECTORY ${DIR}) WORKING_DIRECTORY ${DIR})
endfunction(create_package) endfunction(create_package)
# Downloads the source code of the package and unpacks it to dedicated 'src' # Downloads the source code of the package and unpacks it to dedicated 'src'

View File

@ -20,17 +20,17 @@ def extract_test_cases(path):
tests = [] tests = []
for l in lines: for l in lines:
if inside: if inside:
if l.strip().endswith(')' + delimiter + '";'): if l.strip().endswith(')' + delimiter + '";'):
inside = False inside = False
else:
tests[-1] += l + '\n'
else: else:
tests[-1] += l + '\n' m = re.search(r'R"([^(]*)\($', l.strip())
else: if m:
m = re.search(r'R"([^(]*)\($', l.strip()) inside = True
if m: delimiter = m.group(1)
inside = True tests += ['']
delimiter = m.group(1)
tests += ['']
return tests return tests
@ -75,20 +75,20 @@ def write_cases(f, tests):
open(sol_filename, mode='w', encoding='utf8').write(remainder) open(sol_filename, mode='w', encoding='utf8').write(remainder)
def extract_and_write(f, path): def extract_and_write(f, path):
if docs: if docs:
cases = extract_docs_cases(path) cases = extract_docs_cases(path)
else:
if f.endswith('.sol'):
cases = [open(path, mode='r', encoding='utf8').read()]
else: else:
if f.endswith('.sol'): cases = extract_test_cases(path)
cases = [open(path, mode='r', encoding='utf8').read()] write_cases(f, cases)
else:
cases = extract_test_cases(path)
write_cases(f, cases)
if __name__ == '__main__': if __name__ == '__main__':
path = sys.argv[1] path = sys.argv[1]
docs = False docs = False
if len(sys.argv) > 2 and sys.argv[2] == 'docs': if len(sys.argv) > 2 and sys.argv[2] == 'docs':
docs = True docs = True
if isfile(path): if isfile(path):
extract_and_write(path, path) extract_and_write(path, path)

View File

@ -31,7 +31,7 @@ set VERSION=%2
set "DLLS=MSVC_DLLS_NOT_FOUND" set "DLLS=MSVC_DLLS_NOT_FOUND"
FOR /d %%d IN ("C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Redist\MSVC\*" FOR /d %%d IN ("C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Redist\MSVC\*"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\*") DO set "DLLS=%%d\x86\Microsoft.VC141.CRT\msvc*.dll" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\*") DO set "DLLS=%%d\x86\Microsoft.VC141.CRT\msvc*.dll"
7z a solidity-windows.zip ^ 7z a solidity-windows.zip ^
.\build\solc\%CONFIGURATION%\solc.exe .\build\test\%CONFIGURATION%\soltest.exe ^ .\build\solc\%CONFIGURATION%\solc.exe .\build\test\%CONFIGURATION%\soltest.exe ^

View File

@ -86,16 +86,16 @@ else
if [ $distribution = focal ] if [ $distribution = focal ]
then then
SMTDEPENDENCY="libz3-dev, SMTDEPENDENCY="libz3-dev,
libcvc4-dev, libcvc4-dev,
" "
elif [ $distribution = disco ] elif [ $distribution = disco ]
then then
SMTDEPENDENCY="libz3-static-dev, SMTDEPENDENCY="libz3-static-dev,
libcvc4-dev, libcvc4-dev,
" "
else else
SMTDEPENDENCY="libz3-static-dev, SMTDEPENDENCY="libz3-static-dev,
" "
fi fi
CMAKE_OPTIONS="" CMAKE_OPTIONS=""
fi fi

View File

@ -39,11 +39,11 @@ function post_error_to_github
FORMATTED_ERROR_MSG=$(echo $ESCAPED_ERROR_MSG | sed 's/\$/\\n/g' | tr -d '\n') FORMATTED_ERROR_MSG=$(echo $ESCAPED_ERROR_MSG | sed 's/\$/\\n/g' | tr -d '\n')
curl --request POST \ curl --request POST \
--url $GITHUB_API_URL \ --url $GITHUB_API_URL \
--header 'accept: application/vnd.github.v3+json' \ --header 'accept: application/vnd.github.v3+json' \
--header 'content-type: application/json' \ --header 'content-type: application/json' \
-u stackenbotten:$GITHUB_ACCESS_TOKEN \ -u stackenbotten:$GITHUB_ACCESS_TOKEN \
--data "{\"body\": \"There was an error when running \`$CIRCLE_JOB\` for commit \`$CIRCLE_SHA1\`:\n\`\`\`\n$FORMATTED_ERROR_MSG\n\`\`\`\nPlease check that your changes are working as intended.\"}" --data "{\"body\": \"There was an error when running \`$CIRCLE_JOB\` for commit \`$CIRCLE_SHA1\`:\n\`\`\`\n$FORMATTED_ERROR_MSG\n\`\`\`\nPlease check that your changes are working as intended.\"}"
post_review_comment_to_github post_review_comment_to_github
} }
@ -60,11 +60,11 @@ function post_review_comment_to_github
ERROR_LINE=$(echo $line | grep -oE "[0-9]*") ERROR_LINE=$(echo $line | grep -oE "[0-9]*")
curl --request POST \ curl --request POST \
--url $GITHUB_API_URL \ --url $GITHUB_API_URL \
--header 'accept: application/vnd.github.v3+json, application/vnd.github.comfort-fade-preview+json' \ --header 'accept: application/vnd.github.v3+json, application/vnd.github.comfort-fade-preview+json' \
--header 'content-type: application/json' \ --header 'content-type: application/json' \
-u stackenbotten:$GITHUB_ACCESS_TOKEN \ -u stackenbotten:$GITHUB_ACCESS_TOKEN \
--data "{\"commit_id\": \"$CIRCLE_SHA1\", \"path\": \"$ERROR_PATH\", \"line\": $ERROR_LINE, \"side\": \"RIGHT\", \"body\": \"Coding style error\"}" --data "{\"commit_id\": \"$CIRCLE_SHA1\", \"path\": \"$ERROR_PATH\", \"line\": $ERROR_LINE, \"side\": \"RIGHT\", \"body\": \"Coding style error\"}"
done < $ERROR_LOG done < $ERROR_LOG
} }

View File

@ -9,7 +9,7 @@ SOLTEST_OPTIONS=
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-build} SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-build}
usage() { usage() {
echo 2>&1 " echo 2>&1 "
Usage: $0 [options] [soltest-options] Usage: $0 [options] [soltest-options]
Runs BOOST C++ unit test program, soltest. Runs BOOST C++ unit test program, soltest.

View File

@ -88,43 +88,43 @@ fi
# and homestead / byzantium VM # and homestead / byzantium VM
for optimize in "" "--optimize" for optimize in "" "--optimize"
do do
for vm in $EVM_VERSIONS for vm in $EVM_VERSIONS
do
FORCE_ABIV2_RUNS="no"
if [[ "$vm" == "istanbul" ]]
then
FORCE_ABIV2_RUNS="no yes" # run both in istanbul
fi
for abiv2 in $FORCE_ABIV2_RUNS
do do
force_abiv2_flag="" FORCE_ABIV2_RUNS="no"
if [[ "$abiv2" == "yes" ]] if [[ "$vm" == "istanbul" ]]
then then
force_abiv2_flag="--abiencoderv2 --optimize-yul" FORCE_ABIV2_RUNS="no yes" # run both in istanbul
fi fi
printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv2_flag..." for abiv2 in $FORCE_ABIV2_RUNS
do
force_abiv2_flag=""
if [[ "$abiv2" == "yes" ]]
then
force_abiv2_flag="--abiencoderv2 --optimize-yul"
fi
printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv2_flag..."
log="" log=""
if [ -n "$log_directory" ] if [ -n "$log_directory" ]
then then
if [ -n "$optimize" ] if [ -n "$optimize" ]
then then
log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs
else else
log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt
fi fi
fi fi
set +e set +e
"$REPO_ROOT"/${SOLIDITY_BUILD_DIR}/test/soltest --show-progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv2_flag "$REPO_ROOT"/${SOLIDITY_BUILD_DIR}/test/soltest --show-progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv2_flag
if test "0" -ne "$?"; then if test "0" -ne "$?"; then
exit 1 exit 1
fi fi
set -e set -e
done
done done
done
done done
if [[ -n $CMDLINE_PID ]] && ! wait $CMDLINE_PID if [[ -n $CMDLINE_PID ]] && ! wait $CMDLINE_PID