mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8693 from ethereum/fix-inconsistent-indentation-in-scripts
Fix inconsistent indentation in scripts/
This commit is contained in:
commit
7eff836a6d
@ -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" != "" ]
|
||||
|
@ -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 \
|
||||
|
@ -184,4 +184,4 @@ SOLTMPDIR=$(mktemp -d)
|
||||
done
|
||||
)
|
||||
rm -rf "$SOLTMPDIR"
|
||||
echo "Done."
|
||||
echo "Done."
|
||||
|
@ -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'
|
||||
|
@ -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)
|
||||
|
@ -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 ^
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user