mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10586 from ethereum/shellcheck-fixes-part1
Fixes for shellcheck warnings, part 1
This commit is contained in:
commit
093ea4612b
@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#------------------------------------------------------------------------------
|
||||
# Bash script to execute the Solidity tests by CircleCI.
|
||||
#
|
||||
@ -56,7 +56,7 @@ get_logfile_basename() {
|
||||
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[@]}")
|
||||
|
||||
test "${OPTIMIZE}" = "1" && SOLTEST_ARGS+=(--optimize)
|
||||
|
@ -32,38 +32,35 @@ EVM_VALUES=(homestead byzantium constantinople petersburg istanbul)
|
||||
OPTIMIZE_VALUES=(0 1)
|
||||
STEPS=$(( 2 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))
|
||||
|
||||
if (( $CIRCLE_NODE_TOTAL )) && (( $CIRCLE_NODE_TOTAL > 1 ))
|
||||
if (( CIRCLE_NODE_TOTAL )) && (( CIRCLE_NODE_TOTAL > 1 ))
|
||||
then
|
||||
# Run step 1 as the only step on the first executor
|
||||
# and evenly distribute the other steps among
|
||||
# the other executors.
|
||||
# The first step takes much longer than the other steps.
|
||||
if (( $CIRCLE_NODE_INDEX == 0 ))
|
||||
if (( CIRCLE_NODE_INDEX == 0 ))
|
||||
then
|
||||
RUN_STEPS="1"
|
||||
else
|
||||
export CIRCLE_NODE_INDEX=$(($CIRCLE_NODE_INDEX - 1))
|
||||
export CIRCLE_NODE_TOTAL=$(($CIRCLE_NODE_TOTAL - 1))
|
||||
RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split)
|
||||
export CIRCLE_NODE_INDEX=$((CIRCLE_NODE_INDEX - 1))
|
||||
export CIRCLE_NODE_TOTAL=$((CIRCLE_NODE_TOTAL - 1))
|
||||
RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split | xargs)
|
||||
fi
|
||||
else
|
||||
RUN_STEPS=$(seq "$STEPS")
|
||||
RUN_STEPS=$(seq "$STEPS" | xargs)
|
||||
fi
|
||||
|
||||
# turn newlines into spaces
|
||||
RUN_STEPS=$(echo $RUN_STEPS)
|
||||
|
||||
echo "Running steps $RUN_STEPS..."
|
||||
|
||||
STEP=1
|
||||
|
||||
# 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"
|
||||
STEP=$(($STEP + 1))
|
||||
[[ " $RUN_STEPS " == *" $STEP "* ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t smtCheckerTests/*" "${REPODIR}/.circleci/soltest.sh"
|
||||
STEP=$((STEP + 1))
|
||||
|
||||
# Run without SMTChecker tests.
|
||||
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
|
||||
STEP=$(($STEP + 1))
|
||||
[[ " $RUN_STEPS " == *" $STEP "* ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
|
||||
STEP=$((STEP + 1))
|
||||
|
||||
for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
|
||||
do
|
||||
@ -73,12 +70,12 @@ do
|
||||
EWASM_ARGS=""
|
||||
[ "${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"
|
||||
STEP=$(($STEP + 1))
|
||||
[[ " $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))
|
||||
done
|
||||
done
|
||||
|
||||
if (($STEP != $STEPS + 1))
|
||||
if ((STEP != STEPS + 1))
|
||||
then
|
||||
echo "Step counter not properly adjusted!" >&2
|
||||
exit 1
|
||||
|
@ -27,7 +27,7 @@ TESTED=0
|
||||
|
||||
if [ "$(ls | wc -l)" -ne 0 ]; then
|
||||
echo "Test directory not empty. Skipping!"
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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)
|
||||
$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)
|
||||
$SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
if ! $SOLC --import-ast --combined-json ast,compact-format --pretty-json expected.json > obtained.json 2> /dev/null
|
||||
then
|
||||
# For investigating, use exit 1 here so the script stops at the
|
||||
# first failing test
|
||||
@ -61,9 +60,9 @@ function testImportExportEquivalence {
|
||||
then
|
||||
echo -e "ERROR: JSONS differ for $1: \n $DIFF \n"
|
||||
echo "Expected:"
|
||||
echo "$(cat ./expected.json)"
|
||||
cat ./expected.json
|
||||
echo "Obtained:"
|
||||
echo "$(cat ./obtained.json)"
|
||||
cat ./obtained.json
|
||||
else
|
||||
# Use user supplied diff view binary
|
||||
$DIFFVIEW expected.json obtained.json
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
ERROR_LOG="$(mktemp -t check_style_XXXXXX.log)"
|
||||
|
||||
EXCLUDE_FILES=(
|
||||
@ -20,7 +22,7 @@ REPO_ROOT="$(dirname "$0")"/..
|
||||
cd "$REPO_ROOT" || exit 1
|
||||
|
||||
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" != "" ]]
|
||||
@ -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)
|
||||
# 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 "^*//.*"
|
||||
) | 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" != "" ]]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
REPO_ROOT="$(dirname "$0")"/../..
|
||||
REPO_ROOT=$(realpath "${REPO_ROOT}")
|
||||
|
@ -1,20 +1,10 @@
|
||||
./test/cmdlineTests.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/uniqueErrors.sh
|
||||
./scripts/tests.sh
|
||||
./scripts/bytecodecompare/storebytecode.sh
|
||||
./scripts/deps-ppa/static_z3.sh
|
||||
./scripts/ASTImportTest.sh
|
||||
./scripts/install_static_z3.sh
|
||||
./scripts/install_deps.sh
|
||||
./scripts/common_cmdline.sh
|
||||
./scripts/docker_deploy_manual.sh
|
||||
./scripts/endToEndExtraction/create_traces.sh
|
||||
./scripts/release_ppa.sh
|
||||
./scripts/create_source_tarball.sh
|
||||
./.circleci/soltest.sh
|
||||
./.circleci/soltest_all.sh
|
||||
|
@ -78,6 +78,6 @@ mkdir -p upload
|
||||
cp "$BUILD_DIR/libsolc/soljson.js" upload/
|
||||
cp "$BUILD_DIR/libsolc/soljson.js" ./
|
||||
|
||||
OUTPUT_SIZE=`ls -la soljson.js`
|
||||
OUTPUT_SIZE=$(ls -la soljson.js)
|
||||
|
||||
echo "Emscripten output size: $OUTPUT_SIZE"
|
||||
|
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# ------------------------------------------------------------------------------
|
||||
# vim:ts=4:et
|
||||
# This file is part of solidity.
|
||||
@ -50,12 +51,12 @@ function compileFull()
|
||||
|
||||
local files=("$@")
|
||||
|
||||
local stderr_path=$(mktemp)
|
||||
local stderr_path; stderr_path=$(mktemp)
|
||||
|
||||
set +e
|
||||
"$SOLC" "${args[@]}" "${files[@]}" >/dev/null 2>"$stderr_path"
|
||||
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
|
||||
rm "$stderr_path"
|
||||
|
||||
|
@ -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?/./')
|
||||
|
||||
# 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
|
||||
versionstring="$version"
|
||||
else
|
||||
@ -25,7 +25,7 @@ REPO_ROOT="$(dirname "$0")"/..
|
||||
git checkout-index -a --prefix="$SOLDIR"
|
||||
# Store the commit hash
|
||||
echo "$commithash" > "$SOLDIR/commit_hash.txt"
|
||||
if [ -e prerelease.txt -a ! -s prerelease.txt ]
|
||||
if [ -e prerelease.txt ] && [ ! -s prerelease.txt ]
|
||||
then
|
||||
cp prerelease.txt "$SOLDIR/"
|
||||
fi
|
||||
|
@ -214,12 +214,12 @@ if wget --quiet -O $orig-tmp "$ppafilesurl/$orig"
|
||||
then
|
||||
echo "[WARN] Original tarball found in Ubuntu archive, using it instead"
|
||||
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_sha256=$(sha256sum $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" *.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" ./*.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
|
||||
fi
|
||||
)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
@ -21,7 +21,7 @@ cd solidity
|
||||
commithash=$(git rev-parse --short=8 HEAD)
|
||||
echo -n "$commithash" > commit_hash.txt
|
||||
version=$("$(dirname "$0")/get_version.sh")
|
||||
if [ "$branch" = "release" -o "$branch" = v"$version" ]
|
||||
if [ "$branch" = "release" ] || [ "$branch" = v"$version" ]
|
||||
then
|
||||
echo -n > prerelease.txt
|
||||
else
|
||||
|
@ -66,11 +66,12 @@ function versionEqual()
|
||||
function getAllAvailableVersions()
|
||||
{
|
||||
allVersions=()
|
||||
local allListedVersions=( $(
|
||||
local allListedVersions
|
||||
mapfile -t allListedVersions <<< "$(
|
||||
wget -q -O- https://binaries.soliditylang.org/bin/list.txt |
|
||||
grep -Po '(?<=soljson-v)\d+.\d+.\d+(?=\+commit)' |
|
||||
sort -V
|
||||
) )
|
||||
)"
|
||||
for listed in "${allListedVersions[@]}"
|
||||
do
|
||||
if versionGreater "$listed" "0.4.10"
|
||||
@ -187,8 +188,7 @@ SOLTMPDIR=$(mktemp -d)
|
||||
ln -sf "$solc_bin" "solc"
|
||||
chmod a+x solc
|
||||
|
||||
SOLC="$SOLTMPDIR/solc"
|
||||
compileFull "${opts[@]}" "$SOLTMPDIR/$f"
|
||||
SOLC="$SOLTMPDIR/solc" compileFull "${opts[@]}" "$SOLTMPDIR/$f"
|
||||
done
|
||||
)
|
||||
rm -rf "$SOLTMPDIR"
|
||||
|
@ -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
|
||||
cd build || exit
|
||||
cd build
|
||||
cmake ../../../
|
||||
make soltest
|
||||
cd test/ || exit
|
||||
cd test/
|
||||
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"
|
||||
echo "running soltest on 'semanticTests/extracted'... done"
|
||||
|
||||
cd "$BASE_PATH" || exit
|
||||
cd "$BASE_PATH"
|
||||
git clone git@github.com:ethereum/solidity.git solidity-develop
|
||||
cd solidity-develop || exit
|
||||
cd solidity-develop
|
||||
mkdir -p build
|
||||
cd build || exit
|
||||
cd build
|
||||
cmake ..
|
||||
make soltest
|
||||
cd test/ || exit
|
||||
cd test/
|
||||
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"
|
||||
echo "running soltest on 'SolidityEndToEndTest'... done"
|
||||
|
@ -4,7 +4,7 @@
|
||||
# (the cmake executable will be in ~/.local/bin).
|
||||
# This is mostly suitable for CIs, not end users.
|
||||
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
VERSION_MAJOR=3
|
||||
VERSION_MINOR=15
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
(
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
git clone --depth 1 --branch z3-4.8.7 https://github.com/Z3Prover/z3.git
|
||||
cd z3
|
||||
mkdir build
|
||||
|
@ -274,12 +274,12 @@ if wget --quiet -O "$orig-tmp" "$ppafilesurl/$orig"
|
||||
then
|
||||
echo "[WARN] Original tarball found in Ubuntu archive, using it instead"
|
||||
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_sha256=$(sha256sum "$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" *.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" ./*.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
|
||||
fi
|
||||
)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
REPO_ROOT="$(dirname "$0")"/..
|
||||
USE_DEBUGGER=0
|
||||
|
@ -34,7 +34,7 @@ IFS=" " read -r -a SMT_FLAGS <<< "$SMT_FLAGS"
|
||||
|
||||
source "${REPO_ROOT}/scripts/common.sh"
|
||||
|
||||
WORKDIR=`mktemp -d`
|
||||
WORKDIR=$(mktemp -d)
|
||||
CMDLINE_PID=
|
||||
|
||||
cleanup() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
REPO="$(dirname "$0")/.."
|
||||
|
||||
echo "Finding unique failures..."
|
||||
(
|
||||
for x in $*
|
||||
for x in "$@"
|
||||
do
|
||||
echo -n "$x" " # "
|
||||
# This subshell is a workaround to prevent the shell from printing
|
||||
|
@ -93,6 +93,6 @@ for (var optimize of [false, true])
|
||||
}
|
||||
EOF
|
||||
chmod +x solc
|
||||
./solc *.sol > /tmp/report.txt
|
||||
./solc -- *.sol > /tmp/report.txt
|
||||
)
|
||||
rm -rf "$TMPDIR"
|
||||
|
@ -41,7 +41,14 @@ if [ -d jsoncpp ]; then
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
mkdir -p upload
|
||||
|
@ -86,7 +86,7 @@ function process_tag() {
|
||||
local TAG=$1
|
||||
cd /src
|
||||
# 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
|
||||
clean_git_checkout "$HISTORIC_COMMIT_HASH"
|
||||
else
|
||||
@ -103,7 +103,7 @@ function process_tag() {
|
||||
VERSION=$(echo "$TAG" | cut -d v -f 2)
|
||||
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 HISTORIC_VERSION_SUFFIX="${TAG}+commit.${HISTORIC_COMMIT_HASH}"
|
||||
|
||||
|
@ -91,7 +91,7 @@ function ask_expectation_update
|
||||
|
||||
while true
|
||||
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
|
||||
case $REPLY in
|
||||
e*) "$editor" "$expectationFile"; break;;
|
||||
@ -121,8 +121,8 @@ function test_solc_behaviour()
|
||||
local stderr_expected="${7}"
|
||||
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 stdout_path=`mktemp`
|
||||
local stderr_path=`mktemp`
|
||||
local stdout_path; stdout_path=$(mktemp)
|
||||
local stderr_path; stderr_path=$(mktemp)
|
||||
|
||||
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)"
|
||||
inputCount="$(echo "${inputFiles}" | wc -w)"
|
||||
if (( ${inputCount} > 1 ))
|
||||
if (( inputCount > 1 ))
|
||||
then
|
||||
printError "Ambiguous input. Found input files in multiple formats:"
|
||||
echo -e "${inputFiles}"
|
||||
@ -333,7 +333,7 @@ printTask "Compiling various other contracts and libraries..."
|
||||
do
|
||||
echo " - $dir"
|
||||
cd "$dir"
|
||||
compileFull -w *.sol */*.sol
|
||||
compileFull -w ./*.sol ./*/*.sol
|
||||
cd ..
|
||||
done
|
||||
)
|
||||
@ -378,7 +378,7 @@ echo "Done."
|
||||
|
||||
printTask "Testing library checksum..."
|
||||
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..."
|
||||
echo '' | "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname=0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null
|
||||
@ -408,7 +408,7 @@ SOLTMPDIR=$(mktemp -d)
|
||||
# First time it works
|
||||
echo 'contract C {} ' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null
|
||||
# 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
|
||||
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.
|
||||
# Using both, --assemble and --optimize should fail.
|
||||
! echo '{}' | "$SOLC" - --assemble --optimize &>/dev/null
|
||||
! echo '{}' | "$SOLC" - --yul --optimize &>/dev/null
|
||||
echo '{}' | "$SOLC" - --assemble --optimize &>/dev/null && exit 1
|
||||
echo '{}' | "$SOLC" - --yul --optimize &>/dev/null && exit 1
|
||||
|
||||
# Test yul and strict assembly output
|
||||
# Non-empty code results in non-empty binary representation with optimizations turned off,
|
||||
@ -451,24 +451,15 @@ SOLTMPDIR=$(mktemp -d)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set +e
|
||||
output=$(echo 'contract C {} ' | "$SOLC" - --bin 2>/dev/null | grep -q "<stdin>:C")
|
||||
result=$?
|
||||
set -e
|
||||
|
||||
# The contract should be compiled
|
||||
if [[ "$result" != 0 ]]
|
||||
if ! output=$(echo 'contract C {} ' | "$SOLC" - --bin 2>/dev/null | grep -q "<stdin>:C")
|
||||
then
|
||||
printError "Failed to compile a simple contract from standard input"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This should not fail
|
||||
set +e
|
||||
output=$(echo '' | "$SOLC" --ast-compact-json - 2>/dev/null)
|
||||
result=$?
|
||||
set -e
|
||||
if [[ $result != 0 ]]
|
||||
if ! output=$(echo '' | "$SOLC" --ast-compact-json - 2>/dev/null)
|
||||
then
|
||||
printError "Incorrect response to --ast-compact-json option with empty stdin"
|
||||
exit 1
|
||||
@ -479,8 +470,7 @@ printTask "Testing AST import..."
|
||||
SOLTMPDIR=$(mktemp -d)
|
||||
(
|
||||
cd "$SOLTMPDIR"
|
||||
"$REPO_ROOT/scripts/ASTImportTest.sh"
|
||||
if [ $? -ne 0 ]
|
||||
if ! "$REPO_ROOT/scripts/ASTImportTest.sh"
|
||||
then
|
||||
rm -rf "$SOLTMPDIR"
|
||||
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"/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" --without-optimizer --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
|
||||
)
|
||||
rm -rf "$SOLTMPDIR"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user