From a80b03208133023b3d2de1d32d3ce5a653f54104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 17 Apr 2020 14:32:38 +0200 Subject: [PATCH] Fix inconsistent indentation in scripts/ - NOT reindenting all files. Just choosing one style in files that were using multiple. --- scripts/ASTImportTest.sh | 14 +++---- scripts/build_emscripten.sh | 4 +- scripts/docs_version_pragma_check.sh | 2 +- scripts/install_deps.cmake | 6 +-- scripts/isolate_tests.py | 36 ++++++++--------- scripts/release.bat | 2 +- scripts/release_ppa.sh | 10 ++--- scripts/report_errors.sh | 20 +++++----- scripts/soltest.sh | 2 +- scripts/tests.sh | 58 ++++++++++++++-------------- 10 files changed, 77 insertions(+), 77 deletions(-) diff --git a/scripts/ASTImportTest.sh b/scripts/ASTImportTest.sh index b3a1b6724..c23b3dc34 100755 --- a/scripts/ASTImportTest.sh +++ b/scripts/ASTImportTest.sh @@ -21,8 +21,8 @@ UNCOMPILABLE=0 TESTED=0 if [ $(ls | wc -l) -ne 0 ]; then - echo "Test directory not empty. Skipping!" - exit -1 + echo "Test directory not empty. Skipping!" + exit -1 fi # 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 if [ $? -ne 0 ] then - # For investigating, use exit 1 here so the script stops at the - # first failing test - # exit 1 - FAILED=$((FAILED + 1)) - return 1 + # For investigating, use exit 1 here so the script stops at the + # first failing test + # exit 1 + FAILED=$((FAILED + 1)) + return 1 fi DIFF="$(diff expected.json obtained.json)" if [ "$DIFF" != "" ] diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh index b457b741d..cf6cbdd79 100755 --- a/scripts/build_emscripten.sh +++ b/scripts/build_emscripten.sh @@ -29,9 +29,9 @@ set -e if test -z "$1"; then - BUILD_DIR="emscripten_build" + BUILD_DIR="emscripten_build" else - BUILD_DIR="$1" + BUILD_DIR="$1" fi docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \ diff --git a/scripts/docs_version_pragma_check.sh b/scripts/docs_version_pragma_check.sh index c56bdc6c9..67accc68d 100755 --- a/scripts/docs_version_pragma_check.sh +++ b/scripts/docs_version_pragma_check.sh @@ -184,4 +184,4 @@ SOLTMPDIR=$(mktemp -d) done ) rm -rf "$SOLTMPDIR" -echo "Done." \ No newline at end of file +echo "Done." diff --git a/scripts/install_deps.cmake b/scripts/install_deps.cmake index 0cb0ed621..d90d4ec32 100644 --- a/scripts/install_deps.cmake +++ b/scripts/install_deps.cmake @@ -43,7 +43,7 @@ function(download_and_unpack PACKAGE_URL DST_DIR) if (STATUS) message("Unpacking ${FILE_NAME} to ${DST_DIR}") execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${DST_FILE} - WORKING_DIRECTORY ${DST_DIR}) + WORKING_DIRECTORY ${DST_DIR}) endif() endfunction(download_and_unpack) @@ -59,8 +59,8 @@ function(create_package NAME DIR) set(PACKAGE_FILE "${PACKAGES_DIR}/${NAME}.tar.gz") execute_process(COMMAND ${CMAKE_COMMAND} -E - tar -czf ${PACKAGE_FILE} ${TOP_FILES} - WORKING_DIRECTORY ${DIR}) + tar -czf ${PACKAGE_FILE} ${TOP_FILES} + WORKING_DIRECTORY ${DIR}) endfunction(create_package) # Downloads the source code of the package and unpacks it to dedicated 'src' diff --git a/scripts/isolate_tests.py b/scripts/isolate_tests.py index 3a41d54c9..9dea81aa5 100755 --- a/scripts/isolate_tests.py +++ b/scripts/isolate_tests.py @@ -20,17 +20,17 @@ def extract_test_cases(path): tests = [] for l in lines: - if inside: - if l.strip().endswith(')' + delimiter + '";'): - inside = False + if inside: + if l.strip().endswith(')' + delimiter + '";'): + inside = False + else: + tests[-1] += l + '\n' else: - tests[-1] += l + '\n' - else: - m = re.search(r'R"([^(]*)\($', l.strip()) - if m: - inside = True - delimiter = m.group(1) - tests += [''] + m = re.search(r'R"([^(]*)\($', l.strip()) + if m: + inside = True + delimiter = m.group(1) + tests += [''] return tests @@ -75,20 +75,20 @@ def write_cases(f, tests): open(sol_filename, mode='w', encoding='utf8').write(remainder) def extract_and_write(f, path): - if docs: - cases = extract_docs_cases(path) + if docs: + cases = extract_docs_cases(path) + else: + if f.endswith('.sol'): + cases = [open(path, mode='r', encoding='utf8').read()] else: - if f.endswith('.sol'): - cases = [open(path, mode='r', encoding='utf8').read()] - else: - cases = extract_test_cases(path) - write_cases(f, cases) + cases = extract_test_cases(path) + write_cases(f, cases) if __name__ == '__main__': path = sys.argv[1] docs = False if len(sys.argv) > 2 and sys.argv[2] == 'docs': - docs = True + docs = True if isfile(path): extract_and_write(path, path) diff --git a/scripts/release.bat b/scripts/release.bat index cfd0c838e..caa56fc9a 100644 --- a/scripts/release.bat +++ b/scripts/release.bat @@ -31,7 +31,7 @@ set VERSION=%2 set "DLLS=MSVC_DLLS_NOT_FOUND" 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 ^ .\build\solc\%CONFIGURATION%\solc.exe .\build\test\%CONFIGURATION%\soltest.exe ^ diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index 49634a977..d84b3fd36 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -86,16 +86,16 @@ else if [ $distribution = focal ] then SMTDEPENDENCY="libz3-dev, - libcvc4-dev, - " + libcvc4-dev, + " elif [ $distribution = disco ] then SMTDEPENDENCY="libz3-static-dev, - libcvc4-dev, - " + libcvc4-dev, + " else SMTDEPENDENCY="libz3-static-dev, - " + " fi CMAKE_OPTIONS="" fi diff --git a/scripts/report_errors.sh b/scripts/report_errors.sh index 18a3c266d..296feb84b 100755 --- a/scripts/report_errors.sh +++ b/scripts/report_errors.sh @@ -39,11 +39,11 @@ function post_error_to_github FORMATTED_ERROR_MSG=$(echo $ESCAPED_ERROR_MSG | sed 's/\$/\\n/g' | tr -d '\n') curl --request POST \ - --url $GITHUB_API_URL \ - --header 'accept: application/vnd.github.v3+json' \ - --header 'content-type: application/json' \ - -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.\"}" + --url $GITHUB_API_URL \ + --header 'accept: application/vnd.github.v3+json' \ + --header 'content-type: application/json' \ + -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.\"}" post_review_comment_to_github } @@ -60,11 +60,11 @@ function post_review_comment_to_github ERROR_LINE=$(echo $line | grep -oE "[0-9]*") curl --request POST \ - --url $GITHUB_API_URL \ - --header 'accept: application/vnd.github.v3+json, application/vnd.github.comfort-fade-preview+json' \ - --header 'content-type: application/json' \ - -u stackenbotten:$GITHUB_ACCESS_TOKEN \ - --data "{\"commit_id\": \"$CIRCLE_SHA1\", \"path\": \"$ERROR_PATH\", \"line\": $ERROR_LINE, \"side\": \"RIGHT\", \"body\": \"Coding style error\"}" + --url $GITHUB_API_URL \ + --header 'accept: application/vnd.github.v3+json, application/vnd.github.comfort-fade-preview+json' \ + --header 'content-type: application/json' \ + -u stackenbotten:$GITHUB_ACCESS_TOKEN \ + --data "{\"commit_id\": \"$CIRCLE_SHA1\", \"path\": \"$ERROR_PATH\", \"line\": $ERROR_LINE, \"side\": \"RIGHT\", \"body\": \"Coding style error\"}" done < $ERROR_LOG } diff --git a/scripts/soltest.sh b/scripts/soltest.sh index d1c41404f..4ae08d5a4 100755 --- a/scripts/soltest.sh +++ b/scripts/soltest.sh @@ -9,7 +9,7 @@ SOLTEST_OPTIONS= SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-build} usage() { - echo 2>&1 " + echo 2>&1 " Usage: $0 [options] [soltest-options] Runs BOOST C++ unit test program, soltest. diff --git a/scripts/tests.sh b/scripts/tests.sh index 266c3184e..17da957d2 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -88,43 +88,43 @@ fi # and homestead / byzantium VM for optimize in "" "--optimize" do - 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 + for vm in $EVM_VERSIONS do - force_abiv2_flag="" - if [[ "$abiv2" == "yes" ]] + FORCE_ABIV2_RUNS="no" + if [[ "$vm" == "istanbul" ]] then - force_abiv2_flag="--abiencoderv2 --optimize-yul" + FORCE_ABIV2_RUNS="no yes" # run both in istanbul 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="" - if [ -n "$log_directory" ] - then - if [ -n "$optimize" ] - then - log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs - else - log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt - fi - fi + log="" + if [ -n "$log_directory" ] + then + if [ -n "$optimize" ] + then + log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs + else + log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt + fi + fi - 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 + 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 - if test "0" -ne "$?"; then - exit 1 - fi - set -e + if test "0" -ne "$?"; then + exit 1 + fi + set -e + done done - done done if [[ -n $CMDLINE_PID ]] && ! wait $CMDLINE_PID