Merge pull request #10586 from ethereum/shellcheck-fixes-part1

Fixes for shellcheck warnings, part 1
This commit is contained in:
Kamil Śliwak 2021-03-05 17:13:46 +01:00 committed by GitHub
commit 093ea4612b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 86 additions and 95 deletions

View File

@ -1,4 +1,4 @@
#! /bin/bash #!/usr/bin/env bash
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Bash script to execute the Solidity tests by CircleCI. # Bash script to execute the Solidity tests by CircleCI.
# #
@ -56,7 +56,7 @@ get_logfile_basename() {
echo -ne "${filename}" echo -ne "${filename}"
} }
BOOST_TEST_ARGS=("--color_output=no" "--show_progress=yes" "--logger=JUNIT,error,test_results/`get_logfile_basename`.xml" "${BOOST_TEST_ARGS[@]}") BOOST_TEST_ARGS=("--color_output=no" "--show_progress=yes" "--logger=JUNIT,error,test_results/$(get_logfile_basename).xml" "${BOOST_TEST_ARGS[@]}")
SOLTEST_ARGS=("--evm-version=$EVM" "${SOLTEST_FLAGS[@]}") SOLTEST_ARGS=("--evm-version=$EVM" "${SOLTEST_FLAGS[@]}")
test "${OPTIMIZE}" = "1" && SOLTEST_ARGS+=(--optimize) test "${OPTIMIZE}" = "1" && SOLTEST_ARGS+=(--optimize)

View File

@ -32,38 +32,35 @@ EVM_VALUES=(homestead byzantium constantinople petersburg istanbul)
OPTIMIZE_VALUES=(0 1) OPTIMIZE_VALUES=(0 1)
STEPS=$(( 2 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} )) STEPS=$(( 2 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))
if (( $CIRCLE_NODE_TOTAL )) && (( $CIRCLE_NODE_TOTAL > 1 )) if (( CIRCLE_NODE_TOTAL )) && (( CIRCLE_NODE_TOTAL > 1 ))
then then
# Run step 1 as the only step on the first executor # Run step 1 as the only step on the first executor
# and evenly distribute the other steps among # and evenly distribute the other steps among
# the other executors. # the other executors.
# The first step takes much longer than the other steps. # The first step takes much longer than the other steps.
if (( $CIRCLE_NODE_INDEX == 0 )) if (( CIRCLE_NODE_INDEX == 0 ))
then then
RUN_STEPS="1" RUN_STEPS="1"
else else
export CIRCLE_NODE_INDEX=$(($CIRCLE_NODE_INDEX - 1)) export CIRCLE_NODE_INDEX=$((CIRCLE_NODE_INDEX - 1))
export CIRCLE_NODE_TOTAL=$(($CIRCLE_NODE_TOTAL - 1)) export CIRCLE_NODE_TOTAL=$((CIRCLE_NODE_TOTAL - 1))
RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split) RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split | xargs)
fi fi
else else
RUN_STEPS=$(seq "$STEPS") RUN_STEPS=$(seq "$STEPS" | xargs)
fi fi
# turn newlines into spaces
RUN_STEPS=$(echo $RUN_STEPS)
echo "Running steps $RUN_STEPS..." echo "Running steps $RUN_STEPS..."
STEP=1 STEP=1
# Run SMTChecker tests separately, as the heaviest expected run. # Run SMTChecker tests separately, as the heaviest expected run.
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t smtCheckerTests/*" "${REPODIR}/.circleci/soltest.sh" [[ " $RUN_STEPS " == *" $STEP "* ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t smtCheckerTests/*" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1)) STEP=$((STEP + 1))
# Run without SMTChecker tests. # Run without SMTChecker tests.
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh" [[ " $RUN_STEPS " == *" $STEP "* ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1)) STEP=$((STEP + 1))
for OPTIMIZE in "${OPTIMIZE_VALUES[@]}" for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
do do
@ -73,12 +70,12 @@ do
EWASM_ARGS="" EWASM_ARGS=""
[ "${EVM}" = "byzantium" ] && [ "${OPTIMIZE}" = "0" ] && EWASM_ARGS="--ewasm" [ "${EVM}" = "byzantium" ] && [ "${OPTIMIZE}" = "0" ] && EWASM_ARGS="--ewasm"
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM="$EVM" OPTIMIZE="$OPTIMIZE" SOLTEST_FLAGS="$SOLTEST_FLAGS $EWASM_ARGS" BOOST_TEST_ARGS="-t !@nooptions" "${REPODIR}/.circleci/soltest.sh" [[ " $RUN_STEPS " == *" $STEP "* ]] && EVM="$EVM" OPTIMIZE="$OPTIMIZE" SOLTEST_FLAGS="$SOLTEST_FLAGS $EWASM_ARGS" BOOST_TEST_ARGS="-t !@nooptions" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1)) STEP=$((STEP + 1))
done done
done done
if (($STEP != $STEPS + 1)) if ((STEP != STEPS + 1))
then then
echo "Step counter not properly adjusted!" >&2 echo "Step counter not properly adjusted!" >&2
exit 1 exit 1

View File

@ -27,7 +27,7 @@ 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
@ -45,8 +45,7 @@ function testImportExportEquivalence {
# save exported json as expected result (silently) # save exported json as expected result (silently)
$SOLC --combined-json ast,compact-format --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected.json 2> /dev/null $SOLC --combined-json ast,compact-format --pretty-json "$nth_input_file" "${all_input_files[@]}" > expected.json 2> /dev/null
# import it, and export it again as obtained result (silently) # 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 ! $SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
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
@ -61,9 +60,9 @@ function testImportExportEquivalence {
then then
echo -e "ERROR: JSONS differ for $1: \n $DIFF \n" echo -e "ERROR: JSONS differ for $1: \n $DIFF \n"
echo "Expected:" echo "Expected:"
echo "$(cat ./expected.json)" cat ./expected.json
echo "Obtained:" echo "Obtained:"
echo "$(cat ./obtained.json)" cat ./obtained.json
else else
# Use user supplied diff view binary # Use user supplied diff view binary
$DIFFVIEW expected.json obtained.json $DIFFVIEW expected.json obtained.json

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
ERROR_LOG="$(mktemp -t check_style_XXXXXX.log)" ERROR_LOG="$(mktemp -t check_style_XXXXXX.log)"
EXCLUDE_FILES=( EXCLUDE_FILES=(
@ -20,7 +22,7 @@ REPO_ROOT="$(dirname "$0")"/..
cd "$REPO_ROOT" || exit 1 cd "$REPO_ROOT" || exit 1
WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" | WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" |
grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE\|${EXCLUDE_FILES_JOINED}" grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE\|${EXCLUDE_FILES_JOINED}" || true
) )
if [[ "$WHITESPACE" != "" ]] if [[ "$WHITESPACE" != "" ]]
@ -49,7 +51,7 @@ FORMATERROR=$(
preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return) preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
# right-aligned reference pointer star (needs to exclude return and comments) # right-aligned reference pointer star (needs to exclude return and comments)
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*" preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*"
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" ) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true
) )
if [[ "$FORMATERROR" != "" ]] if [[ "$FORMATERROR" != "" ]]

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -eu
REPO_ROOT="$(dirname "$0")"/../.. REPO_ROOT="$(dirname "$0")"/../..
REPO_ROOT=$(realpath "${REPO_ROOT}") REPO_ROOT=$(realpath "${REPO_ROOT}")

View File

@ -1,20 +1,10 @@
./test/cmdlineTests.sh ./test/cmdlineTests.sh
./scripts/wasm-rebuild/docker-scripts/rebuild_tags.sh ./scripts/wasm-rebuild/docker-scripts/rebuild_tags.sh
./scripts/wasm-rebuild/docker-scripts/rebuild_current.sh
./scripts/wasm-rebuild/docker-scripts/genbytecode.sh
./scripts/ci/build_emscripten.sh
./scripts/docs_version_pragma_check.sh ./scripts/docs_version_pragma_check.sh
./scripts/uniqueErrors.sh
./scripts/tests.sh ./scripts/tests.sh
./scripts/bytecodecompare/storebytecode.sh ./scripts/bytecodecompare/storebytecode.sh
./scripts/deps-ppa/static_z3.sh ./scripts/deps-ppa/static_z3.sh
./scripts/ASTImportTest.sh ./scripts/ASTImportTest.sh
./scripts/install_static_z3.sh
./scripts/install_deps.sh ./scripts/install_deps.sh
./scripts/common_cmdline.sh
./scripts/docker_deploy_manual.sh
./scripts/endToEndExtraction/create_traces.sh
./scripts/release_ppa.sh ./scripts/release_ppa.sh
./scripts/create_source_tarball.sh
./.circleci/soltest.sh ./.circleci/soltest.sh
./.circleci/soltest_all.sh

View File

@ -78,6 +78,6 @@ mkdir -p upload
cp "$BUILD_DIR/libsolc/soljson.js" upload/ cp "$BUILD_DIR/libsolc/soljson.js" upload/
cp "$BUILD_DIR/libsolc/soljson.js" ./ cp "$BUILD_DIR/libsolc/soljson.js" ./
OUTPUT_SIZE=`ls -la soljson.js` OUTPUT_SIZE=$(ls -la soljson.js)
echo "Emscripten output size: $OUTPUT_SIZE" echo "Emscripten output size: $OUTPUT_SIZE"

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# vim:ts=4:et # vim:ts=4:et
# This file is part of solidity. # This file is part of solidity.
@ -50,12 +51,12 @@ function compileFull()
local files=("$@") local files=("$@")
local stderr_path=$(mktemp) local stderr_path; stderr_path=$(mktemp)
set +e set +e
"$SOLC" "${args[@]}" "${files[@]}" >/dev/null 2>"$stderr_path" "$SOLC" "${args[@]}" "${files[@]}" >/dev/null 2>"$stderr_path"
local exit_code=$? local exit_code=$?
local errors=$(grep -v -E 'Warning: This is a pre-release compiler version|Warning: Experimental features are turned on|pragma experimental ABIEncoderV2|^ +--> |^ +\||^[0-9]+ +\|' < "$stderr_path") local errors; errors=$(grep -v -E 'Warning: This is a pre-release compiler version|Warning: Experimental features are turned on|pragma experimental ABIEncoderV2|^ +--> |^ +\||^[0-9]+ +\|' < "$stderr_path")
set -e set -e
rm "$stderr_path" rm "$stderr_path"

View File

@ -11,7 +11,7 @@ REPO_ROOT="$(dirname "$0")"/..
commitdate=$(git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./') commitdate=$(git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./')
# file exists and has zero size -> not a prerelease # file exists and has zero size -> not a prerelease
if [ -e prerelease.txt -a ! -s prerelease.txt ] if [ -e prerelease.txt ] && [ ! -s prerelease.txt ]
then then
versionstring="$version" versionstring="$version"
else else
@ -25,7 +25,7 @@ REPO_ROOT="$(dirname "$0")"/..
git checkout-index -a --prefix="$SOLDIR" git checkout-index -a --prefix="$SOLDIR"
# Store the commit hash # Store the commit hash
echo "$commithash" > "$SOLDIR/commit_hash.txt" echo "$commithash" > "$SOLDIR/commit_hash.txt"
if [ -e prerelease.txt -a ! -s prerelease.txt ] if [ -e prerelease.txt ] && [ ! -s prerelease.txt ]
then then
cp prerelease.txt "$SOLDIR/" cp prerelease.txt "$SOLDIR/"
fi fi

View File

@ -214,12 +214,12 @@ if wget --quiet -O $orig-tmp "$ppafilesurl/$orig"
then then
echo "[WARN] Original tarball found in Ubuntu archive, using it instead" echo "[WARN] Original tarball found in Ubuntu archive, using it instead"
mv $orig-tmp $orig mv $orig-tmp $orig
new_size=$(ls -l *.orig.tar.gz | cut -d ' ' -f 5) new_size=$(ls -l ./*.orig.tar.gz | cut -d ' ' -f 5)
new_sha1=$(sha1sum $orig | cut -d ' ' -f 1) new_sha1=$(sha1sum $orig | cut -d ' ' -f 1)
new_sha256=$(sha256sum $orig | cut -d ' ' -f 1) new_sha256=$(sha256sum $orig | cut -d ' ' -f 1)
new_md5=$(md5sum $orig | cut -d ' ' -f 1) new_md5=$(md5sum $orig | cut -d ' ' -f 1)
sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" *.dsc sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" ./*.dsc
sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" *.changes sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" ./*.changes
fi fi
) )

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
set -e set -e
@ -21,7 +21,7 @@ cd solidity
commithash=$(git rev-parse --short=8 HEAD) commithash=$(git rev-parse --short=8 HEAD)
echo -n "$commithash" > commit_hash.txt echo -n "$commithash" > commit_hash.txt
version=$("$(dirname "$0")/get_version.sh") version=$("$(dirname "$0")/get_version.sh")
if [ "$branch" = "release" -o "$branch" = v"$version" ] if [ "$branch" = "release" ] || [ "$branch" = v"$version" ]
then then
echo -n > prerelease.txt echo -n > prerelease.txt
else else

View File

@ -66,11 +66,12 @@ function versionEqual()
function getAllAvailableVersions() function getAllAvailableVersions()
{ {
allVersions=() allVersions=()
local allListedVersions=( $( local allListedVersions
mapfile -t allListedVersions <<< "$(
wget -q -O- https://binaries.soliditylang.org/bin/list.txt | wget -q -O- https://binaries.soliditylang.org/bin/list.txt |
grep -Po '(?<=soljson-v)\d+.\d+.\d+(?=\+commit)' | grep -Po '(?<=soljson-v)\d+.\d+.\d+(?=\+commit)' |
sort -V sort -V
) ) )"
for listed in "${allListedVersions[@]}" for listed in "${allListedVersions[@]}"
do do
if versionGreater "$listed" "0.4.10" if versionGreater "$listed" "0.4.10"
@ -187,8 +188,7 @@ SOLTMPDIR=$(mktemp -d)
ln -sf "$solc_bin" "solc" ln -sf "$solc_bin" "solc"
chmod a+x solc chmod a+x solc
SOLC="$SOLTMPDIR/solc" SOLC="$SOLTMPDIR/solc" compileFull "${opts[@]}" "$SOLTMPDIR/$f"
compileFull "${opts[@]}" "$SOLTMPDIR/$f"
done done
) )
rm -rf "$SOLTMPDIR" rm -rf "$SOLTMPDIR"

View File

@ -1,22 +1,25 @@
BASE_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P )" #!/usr/bin/env bash
set -eu
BASE_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 && pwd -P )"
mkdir -p build mkdir -p build
cd build || exit cd build
cmake ../../../ cmake ../../../
make soltest make soltest
cd test/ || exit cd test/
echo "running soltest on 'semanticTests/extracted'..." echo "running soltest on 'semanticTests/extracted'..."
./soltest --color_output=false --log_level=test_suite -t semanticTests/extracted/ -- --testpath "${BASE_PATH}/../../test" --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > "${BASE_PATH}/extracted-tests.trace" ./soltest --color_output=false --log_level=test_suite -t semanticTests/extracted/ -- --testpath "${BASE_PATH}/../../test" --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > "${BASE_PATH}/extracted-tests.trace"
echo "running soltest on 'semanticTests/extracted'... done" echo "running soltest on 'semanticTests/extracted'... done"
cd "$BASE_PATH" || exit cd "$BASE_PATH"
git clone git@github.com:ethereum/solidity.git solidity-develop git clone git@github.com:ethereum/solidity.git solidity-develop
cd solidity-develop || exit cd solidity-develop
mkdir -p build mkdir -p build
cd build || exit cd build
cmake .. cmake ..
make soltest make soltest
cd test/ || exit cd test/
echo "running soltest on 'SolidityEndToEndTest'..." echo "running soltest on 'SolidityEndToEndTest'..."
./soltest --color_output=false --log_level=test_suite -t SolidityEndToEndTest/ -- --testpath "${BASE_PATH}/solidity-develop/test" --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > "${BASE_PATH}/endToEndExtraction-tests.trace" ./soltest --color_output=false --log_level=test_suite -t SolidityEndToEndTest/ -- --testpath "${BASE_PATH}/solidity-develop/test" --no-smt --evmonepath /Users/alex/evmone/lib/libevmone.dylib --show-messages --show-metadata > "${BASE_PATH}/endToEndExtraction-tests.trace"
echo "running soltest on 'SolidityEndToEndTest'... done" echo "running soltest on 'SolidityEndToEndTest'... done"

View File

@ -4,7 +4,7 @@
# (the cmake executable will be in ~/.local/bin). # (the cmake executable will be in ~/.local/bin).
# This is mostly suitable for CIs, not end users. # This is mostly suitable for CIs, not end users.
set -e set -eu
VERSION_MAJOR=3 VERSION_MAJOR=3
VERSION_MINOR=15 VERSION_MINOR=15

View File

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env bash
set -e set -eu
TEMPDIR=$(mktemp -d) TEMPDIR=$(mktemp -d)
( (

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
git clone --depth 1 --branch z3-4.8.7 https://github.com/Z3Prover/z3.git git clone --depth 1 --branch z3-4.8.7 https://github.com/Z3Prover/z3.git
cd z3 cd z3
mkdir build mkdir build

View File

@ -274,12 +274,12 @@ if wget --quiet -O "$orig-tmp" "$ppafilesurl/$orig"
then then
echo "[WARN] Original tarball found in Ubuntu archive, using it instead" echo "[WARN] Original tarball found in Ubuntu archive, using it instead"
mv "$orig-tmp" "$orig" mv "$orig-tmp" "$orig"
new_size=$(ls -l *.orig.tar.gz | cut -d ' ' -f 5) new_size=$(ls -l ./*.orig.tar.gz | cut -d ' ' -f 5)
new_sha1=$(sha1sum "$orig" | cut -d ' ' -f 1) new_sha1=$(sha1sum "$orig" | cut -d ' ' -f 1)
new_sha256=$(sha256sum "$orig" | cut -d ' ' -f 1) new_sha256=$(sha256sum "$orig" | cut -d ' ' -f 1)
new_md5=$(md5sum "$orig" | cut -d ' ' -f 1) new_md5=$(md5sum "$orig" | cut -d ' ' -f 1)
sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" *.dsc sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" ./*.dsc
sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" *.changes sed -i -e "s,$orig_sha1,$new_sha1,g" -e "s,$orig_sha256,$new_sha256,g" -e "s,$orig_size,$new_size,g" -e "s,$orig_md5,$new_md5,g" ./*.changes
fi fi
) )

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -eu
REPO_ROOT="$(dirname "$0")"/.. REPO_ROOT="$(dirname "$0")"/..
USE_DEBUGGER=0 USE_DEBUGGER=0

View File

@ -34,7 +34,7 @@ IFS=" " read -r -a SMT_FLAGS <<< "$SMT_FLAGS"
source "${REPO_ROOT}/scripts/common.sh" source "${REPO_ROOT}/scripts/common.sh"
WORKDIR=`mktemp -d` WORKDIR=$(mktemp -d)
CMDLINE_PID= CMDLINE_PID=
cleanup() { cleanup() {

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/usr/bin/env bash
REPO="$(dirname "$0")/.." REPO="$(dirname "$0")/.."
echo "Finding unique failures..." echo "Finding unique failures..."
( (
for x in $* for x in "$@"
do do
echo -n "$x" " # " echo -n "$x" " # "
# This subshell is a workaround to prevent the shell from printing # This subshell is a workaround to prevent the shell from printing

View File

@ -93,6 +93,6 @@ for (var optimize of [false, true])
} }
EOF EOF
chmod +x solc chmod +x solc
./solc *.sol > /tmp/report.txt ./solc -- *.sol > /tmp/report.txt
) )
rm -rf "$TMPDIR" rm -rf "$TMPDIR"

View File

@ -41,7 +41,14 @@ if [ -d jsoncpp ]; then
fi fi
set +e set +e
scripts/*/build_emscripten.sh
if [ -e scripts/ci/build_emscripten.sh ]; then
scripts/ci/build_emscripten.sh
else
# The script used to be in scripts/ci/ in earlier versions.
scripts/travis-emscripten/build_emscripten.sh
fi
set -e set -e
mkdir -p upload mkdir -p upload

View File

@ -86,7 +86,7 @@ function process_tag() {
local TAG=$1 local TAG=$1
cd /src cd /src
# Checkout the historic commit instead of the tag directly. # Checkout the historic commit instead of the tag directly.
local HISTORIC_COMMIT_HASH="$(grep "${TAG}+" /tmp/release_commit_list.txt | cut -d '+' -f 2 | cut -d '.' -f 2)" local HISTORIC_COMMIT_HASH; HISTORIC_COMMIT_HASH="$(grep "${TAG}+" /tmp/release_commit_list.txt | cut -d '+' -f 2 | cut -d '.' -f 2)"
if [ "$(git cat-file -t "${HISTORIC_COMMIT_HASH}" 2>/dev/null)" == "commit" ]; then if [ "$(git cat-file -t "${HISTORIC_COMMIT_HASH}" 2>/dev/null)" == "commit" ]; then
clean_git_checkout "$HISTORIC_COMMIT_HASH" clean_git_checkout "$HISTORIC_COMMIT_HASH"
else else
@ -103,7 +103,7 @@ function process_tag() {
VERSION=$(echo "$TAG" | cut -d v -f 2) VERSION=$(echo "$TAG" | cut -d v -f 2)
fi fi
local COMMIT_HASH=$(git rev-parse --short=8 HEAD) local COMMIT_HASH; COMMIT_HASH=$(git rev-parse --short=8 HEAD)
local FULL_VERSION_SUFFIX="${TAG}+commit.${COMMIT_HASH}" local FULL_VERSION_SUFFIX="${TAG}+commit.${COMMIT_HASH}"
local HISTORIC_VERSION_SUFFIX="${TAG}+commit.${HISTORIC_COMMIT_HASH}" local HISTORIC_VERSION_SUFFIX="${TAG}+commit.${HISTORIC_COMMIT_HASH}"

View File

@ -91,7 +91,7 @@ function ask_expectation_update
while true while true
do do
read -N 1 -p "(e)dit/(u)pdate expectations/(s)kip/(q)uit? " read -r -N 1 -p "(e)dit/(u)pdate expectations/(s)kip/(q)uit? "
echo echo
case $REPLY in case $REPLY in
e*) "$editor" "$expectationFile"; break;; e*) "$editor" "$expectationFile"; break;;
@ -121,8 +121,8 @@ function test_solc_behaviour()
local stderr_expected="${7}" local stderr_expected="${7}"
local stdout_expectation_file="${8}" # the file to write to when user chooses to update stdout expectation local stdout_expectation_file="${8}" # the file to write to when user chooses to update stdout expectation
local stderr_expectation_file="${9}" # the file to write to when user chooses to update stderr expectation local stderr_expectation_file="${9}" # the file to write to when user chooses to update stderr expectation
local stdout_path=`mktemp` local stdout_path; stdout_path=$(mktemp)
local stderr_path=`mktemp` local stderr_path; stderr_path=$(mktemp)
trap "rm -f $stdout_path $stderr_path" EXIT trap "rm -f $stdout_path $stderr_path" EXIT
@ -282,7 +282,7 @@ printTask "Running general commandline tests..."
inputFiles="$(ls -1 "${tdir}/input."* 2> /dev/null || true)" inputFiles="$(ls -1 "${tdir}/input."* 2> /dev/null || true)"
inputCount="$(echo "${inputFiles}" | wc -w)" inputCount="$(echo "${inputFiles}" | wc -w)"
if (( ${inputCount} > 1 )) if (( inputCount > 1 ))
then then
printError "Ambiguous input. Found input files in multiple formats:" printError "Ambiguous input. Found input files in multiple formats:"
echo -e "${inputFiles}" echo -e "${inputFiles}"
@ -333,7 +333,7 @@ printTask "Compiling various other contracts and libraries..."
do do
echo " - $dir" echo " - $dir"
cd "$dir" cd "$dir"
compileFull -w *.sol */*.sol compileFull -w ./*.sol ./*/*.sol
cd .. cd ..
done done
) )
@ -378,7 +378,7 @@ echo "Done."
printTask "Testing library checksum..." printTask "Testing library checksum..."
echo '' | "$SOLC" - --link --libraries a=0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null echo '' | "$SOLC" - --link --libraries a=0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null
! echo '' | "$SOLC" - --link --libraries a=0x80f20564390eAe531E810af625A22f51385Cd222 &>/dev/null echo '' | "$SOLC" - --link --libraries a=0x80f20564390eAe531E810af625A22f51385Cd222 &>/dev/null && exit 1
printTask "Testing long library names..." printTask "Testing long library names..."
echo '' | "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname=0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null echo '' | "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname=0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null
@ -408,7 +408,7 @@ SOLTMPDIR=$(mktemp -d)
# First time it works # First time it works
echo 'contract C {} ' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null echo 'contract C {} ' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null
# Second time it fails # Second time it fails
! echo 'contract C {} ' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null echo 'contract C {} ' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null && exit 1
# Unless we force # Unless we force
echo 'contract C {} ' | "$SOLC" - --overwrite --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null echo 'contract C {} ' | "$SOLC" - --overwrite --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null
) )
@ -422,8 +422,8 @@ printTask "Testing assemble, yul, strict-assembly and optimize..."
# Test options above in conjunction with --optimize. # Test options above in conjunction with --optimize.
# Using both, --assemble and --optimize should fail. # Using both, --assemble and --optimize should fail.
! echo '{}' | "$SOLC" - --assemble --optimize &>/dev/null echo '{}' | "$SOLC" - --assemble --optimize &>/dev/null && exit 1
! echo '{}' | "$SOLC" - --yul --optimize &>/dev/null echo '{}' | "$SOLC" - --yul --optimize &>/dev/null && exit 1
# Test yul and strict assembly output # Test yul and strict assembly output
# Non-empty code results in non-empty binary representation with optimizations turned off, # Non-empty code results in non-empty binary representation with optimizations turned off,
@ -451,24 +451,15 @@ SOLTMPDIR=$(mktemp -d)
exit 1 exit 1
fi fi
set +e
output=$(echo 'contract C {} ' | "$SOLC" - --bin 2>/dev/null | grep -q "<stdin>:C")
result=$?
set -e
# The contract should be compiled # The contract should be compiled
if [[ "$result" != 0 ]] if ! output=$(echo 'contract C {} ' | "$SOLC" - --bin 2>/dev/null | grep -q "<stdin>:C")
then then
printError "Failed to compile a simple contract from standard input" printError "Failed to compile a simple contract from standard input"
exit 1 exit 1
fi fi
# This should not fail # This should not fail
set +e if ! output=$(echo '' | "$SOLC" --ast-compact-json - 2>/dev/null)
output=$(echo '' | "$SOLC" --ast-compact-json - 2>/dev/null)
result=$?
set -e
if [[ $result != 0 ]]
then then
printError "Incorrect response to --ast-compact-json option with empty stdin" printError "Incorrect response to --ast-compact-json option with empty stdin"
exit 1 exit 1
@ -479,8 +470,7 @@ printTask "Testing AST import..."
SOLTMPDIR=$(mktemp -d) SOLTMPDIR=$(mktemp -d)
( (
cd "$SOLTMPDIR" cd "$SOLTMPDIR"
"$REPO_ROOT/scripts/ASTImportTest.sh" if ! "$REPO_ROOT/scripts/ASTImportTest.sh"
if [ $? -ne 0 ]
then then
rm -rf "$SOLTMPDIR" rm -rf "$SOLTMPDIR"
exit 1 exit 1
@ -499,8 +489,8 @@ SOLTMPDIR=$(mktemp -d)
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/ "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
echo *.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --quiet --input-files echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --quiet --input-files
echo *.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --without-optimizer --quiet --input-files echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --without-optimizer --quiet --input-files
) )
rm -rf "$SOLTMPDIR" rm -rf "$SOLTMPDIR"