Skip to content

Commit 7eff836

Browse files
authored
Merge pull request #8693 from ethereum/fix-inconsistent-indentation-in-scripts
Fix inconsistent indentation in scripts/
2 parents 96ea8b3 + a80b032 commit 7eff836

10 files changed

+81
-81
lines changed

scripts/ASTImportTest.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ UNCOMPILABLE=0
2121
TESTED=0
2222

2323
if [ $(ls | wc -l) -ne 0 ]; then
24-
echo "Test directory not empty. Skipping!"
25-
exit -1
24+
echo "Test directory not empty. Skipping!"
25+
exit -1
2626
fi
2727

2828
# function tests whether exporting and importing again leaves the JSON ast unchanged
@@ -40,11 +40,11 @@ function testImportExportEquivalence {
4040
$SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
4141
if [ $? -ne 0 ]
4242
then
43-
# For investigating, use exit 1 here so the script stops at the
44-
# first failing test
45-
# exit 1
46-
FAILED=$((FAILED + 1))
47-
return 1
43+
# For investigating, use exit 1 here so the script stops at the
44+
# first failing test
45+
# exit 1
46+
FAILED=$((FAILED + 1))
47+
return 1
4848
fi
4949
DIFF="$(diff expected.json obtained.json)"
5050
if [ "$DIFF" != "" ]

scripts/build_emscripten.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
set -e
3030

3131
if test -z "$1"; then
32-
BUILD_DIR="emscripten_build"
32+
BUILD_DIR="emscripten_build"
3333
else
34-
BUILD_DIR="$1"
34+
BUILD_DIR="$1"
3535
fi
3636

3737
docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \

scripts/docs_version_pragma_check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,4 @@ SOLTMPDIR=$(mktemp -d)
184184
done
185185
)
186186
rm -rf "$SOLTMPDIR"
187-
echo "Done."
187+
echo "Done."

scripts/install_deps.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function(download_and_unpack PACKAGE_URL DST_DIR)
4343
if (STATUS)
4444
message("Unpacking ${FILE_NAME} to ${DST_DIR}")
4545
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${DST_FILE}
46-
WORKING_DIRECTORY ${DST_DIR})
46+
WORKING_DIRECTORY ${DST_DIR})
4747
endif()
4848
endfunction(download_and_unpack)
4949

@@ -59,8 +59,8 @@ function(create_package NAME DIR)
5959

6060
set(PACKAGE_FILE "${PACKAGES_DIR}/${NAME}.tar.gz")
6161
execute_process(COMMAND ${CMAKE_COMMAND} -E
62-
tar -czf ${PACKAGE_FILE} ${TOP_FILES}
63-
WORKING_DIRECTORY ${DIR})
62+
tar -czf ${PACKAGE_FILE} ${TOP_FILES}
63+
WORKING_DIRECTORY ${DIR})
6464
endfunction(create_package)
6565

6666
# Downloads the source code of the package and unpacks it to dedicated 'src'

scripts/isolate_tests.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ def extract_test_cases(path):
2020
tests = []
2121

2222
for l in lines:
23-
if inside:
24-
if l.strip().endswith(')' + delimiter + '";'):
25-
inside = False
23+
if inside:
24+
if l.strip().endswith(')' + delimiter + '";'):
25+
inside = False
26+
else:
27+
tests[-1] += l + '\n'
2628
else:
27-
tests[-1] += l + '\n'
28-
else:
29-
m = re.search(r'R"([^(]*)\($', l.strip())
30-
if m:
31-
inside = True
32-
delimiter = m.group(1)
33-
tests += ['']
29+
m = re.search(r'R"([^(]*)\($', l.strip())
30+
if m:
31+
inside = True
32+
delimiter = m.group(1)
33+
tests += ['']
3434

3535
return tests
3636

@@ -75,20 +75,20 @@ def write_cases(f, tests):
7575
open(sol_filename, mode='w', encoding='utf8').write(remainder)
7676

7777
def extract_and_write(f, path):
78-
if docs:
79-
cases = extract_docs_cases(path)
78+
if docs:
79+
cases = extract_docs_cases(path)
80+
else:
81+
if f.endswith('.sol'):
82+
cases = [open(path, mode='r', encoding='utf8').read()]
8083
else:
81-
if f.endswith('.sol'):
82-
cases = [open(path, mode='r', encoding='utf8').read()]
83-
else:
84-
cases = extract_test_cases(path)
85-
write_cases(f, cases)
84+
cases = extract_test_cases(path)
85+
write_cases(f, cases)
8686

8787
if __name__ == '__main__':
8888
path = sys.argv[1]
8989
docs = False
9090
if len(sys.argv) > 2 and sys.argv[2] == 'docs':
91-
docs = True
91+
docs = True
9292

9393
if isfile(path):
9494
extract_and_write(path, path)

scripts/release.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ set VERSION=%2
3131

3232
set "DLLS=MSVC_DLLS_NOT_FOUND"
3333
FOR /d %%d IN ("C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Redist\MSVC\*"
34-
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\*") DO set "DLLS=%%d\x86\Microsoft.VC141.CRT\msvc*.dll"
34+
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\*") DO set "DLLS=%%d\x86\Microsoft.VC141.CRT\msvc*.dll"
3535

3636
7z a solidity-windows.zip ^
3737
.\build\solc\%CONFIGURATION%\solc.exe .\build\test\%CONFIGURATION%\soltest.exe ^

scripts/release_ppa.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ else
8686
if [ $distribution = focal ]
8787
then
8888
SMTDEPENDENCY="libz3-dev,
89-
libcvc4-dev,
90-
"
89+
libcvc4-dev,
90+
"
9191
elif [ $distribution = disco ]
9292
then
9393
SMTDEPENDENCY="libz3-static-dev,
94-
libcvc4-dev,
95-
"
94+
libcvc4-dev,
95+
"
9696
else
9797
SMTDEPENDENCY="libz3-static-dev,
98-
"
98+
"
9999
fi
100100
CMAKE_OPTIONS=""
101101
fi

scripts/report_errors.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ function post_error_to_github
3939
FORMATTED_ERROR_MSG=$(echo $ESCAPED_ERROR_MSG | sed 's/\$/\\n/g' | tr -d '\n')
4040

4141
curl --request POST \
42-
--url $GITHUB_API_URL \
43-
--header 'accept: application/vnd.github.v3+json' \
44-
--header 'content-type: application/json' \
45-
-u stackenbotten:$GITHUB_ACCESS_TOKEN \
46-
--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.\"}"
42+
--url $GITHUB_API_URL \
43+
--header 'accept: application/vnd.github.v3+json' \
44+
--header 'content-type: application/json' \
45+
-u stackenbotten:$GITHUB_ACCESS_TOKEN \
46+
--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.\"}"
4747

4848
post_review_comment_to_github
4949
}
@@ -60,11 +60,11 @@ function post_review_comment_to_github
6060
ERROR_LINE=$(echo $line | grep -oE "[0-9]*")
6161

6262
curl --request POST \
63-
--url $GITHUB_API_URL \
64-
--header 'accept: application/vnd.github.v3+json, application/vnd.github.comfort-fade-preview+json' \
65-
--header 'content-type: application/json' \
66-
-u stackenbotten:$GITHUB_ACCESS_TOKEN \
67-
--data "{\"commit_id\": \"$CIRCLE_SHA1\", \"path\": \"$ERROR_PATH\", \"line\": $ERROR_LINE, \"side\": \"RIGHT\", \"body\": \"Coding style error\"}"
63+
--url $GITHUB_API_URL \
64+
--header 'accept: application/vnd.github.v3+json, application/vnd.github.comfort-fade-preview+json' \
65+
--header 'content-type: application/json' \
66+
-u stackenbotten:$GITHUB_ACCESS_TOKEN \
67+
--data "{\"commit_id\": \"$CIRCLE_SHA1\", \"path\": \"$ERROR_PATH\", \"line\": $ERROR_LINE, \"side\": \"RIGHT\", \"body\": \"Coding style error\"}"
6868
done < $ERROR_LOG
6969
}
7070

scripts/soltest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SOLTEST_OPTIONS=
99
SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-build}
1010

1111
usage() {
12-
echo 2>&1 "
12+
echo 2>&1 "
1313
Usage: $0 [options] [soltest-options]
1414
Runs BOOST C++ unit test program, soltest.
1515

scripts/tests.sh

+33-33
Original file line numberDiff line numberDiff line change
@@ -88,43 +88,43 @@ fi
8888
# and homestead / byzantium VM
8989
for optimize in "" "--optimize"
9090
do
91-
for vm in $EVM_VERSIONS
92-
do
93-
FORCE_ABIV2_RUNS="no"
94-
if [[ "$vm" == "istanbul" ]]
95-
then
96-
FORCE_ABIV2_RUNS="no yes" # run both in istanbul
97-
fi
98-
for abiv2 in $FORCE_ABIV2_RUNS
91+
for vm in $EVM_VERSIONS
9992
do
100-
force_abiv2_flag=""
101-
if [[ "$abiv2" == "yes" ]]
102-
then
103-
force_abiv2_flag="--abiencoderv2 --optimize-yul"
104-
fi
105-
printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv2_flag..."
106-
107-
log=""
108-
if [ -n "$log_directory" ]
93+
FORCE_ABIV2_RUNS="no"
94+
if [[ "$vm" == "istanbul" ]]
10995
then
110-
if [ -n "$optimize" ]
111-
then
112-
log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs
113-
else
114-
log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt
115-
fi
96+
FORCE_ABIV2_RUNS="no yes" # run both in istanbul
11697
fi
117-
118-
set +e
119-
"$REPO_ROOT"/${SOLIDITY_BUILD_DIR}/test/soltest --show-progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv2_flag
120-
121-
if test "0" -ne "$?"; then
122-
exit 1
123-
fi
124-
set -e
125-
98+
for abiv2 in $FORCE_ABIV2_RUNS
99+
do
100+
force_abiv2_flag=""
101+
if [[ "$abiv2" == "yes" ]]
102+
then
103+
force_abiv2_flag="--abiencoderv2 --optimize-yul"
104+
fi
105+
printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv2_flag..."
106+
107+
log=""
108+
if [ -n "$log_directory" ]
109+
then
110+
if [ -n "$optimize" ]
111+
then
112+
log=--logger=JUNIT,error,$log_directory/opt_$vm.xml $testargs
113+
else
114+
log=--logger=JUNIT,error,$log_directory/noopt_$vm.xml $testargs_no_opt
115+
fi
116+
fi
117+
118+
set +e
119+
"$REPO_ROOT"/${SOLIDITY_BUILD_DIR}/test/soltest --show-progress $log -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv2_flag
120+
121+
if test "0" -ne "$?"; then
122+
exit 1
123+
fi
124+
set -e
125+
126+
done
126127
done
127-
done
128128
done
129129

130130
if [[ -n $CMDLINE_PID ]] && ! wait $CMDLINE_PID

0 commit comments

Comments
 (0)