2018-02-09 16:21:36 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# This file is part of solidity.
|
|
|
|
#
|
|
|
|
# solidity is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# solidity is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with solidity. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
#
|
2019-09-25 13:59:52 +00:00
|
|
|
# (c) 2019 solidity contributors.
|
2018-02-09 16:21:36 +00:00
|
|
|
#------------------------------------------------------------------------------
|
2021-10-25 12:30:15 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2019-09-25 13:59:52 +00:00
|
|
|
source scripts/common.sh
|
2023-04-26 12:14:36 +00:00
|
|
|
source scripts/externalTests/common.sh
|
2018-02-09 16:21:36 +00:00
|
|
|
|
|
|
|
SOLJSON="$1"
|
2018-02-09 17:08:29 +00:00
|
|
|
VERSION="$2"
|
2022-01-28 19:51:04 +00:00
|
|
|
SOLCJS_CHECKOUT="$3" # optional
|
2018-02-09 16:21:36 +00:00
|
|
|
|
2022-01-28 19:51:04 +00:00
|
|
|
[[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version> [<path to solc-js>]"
|
2021-12-03 11:57:39 +00:00
|
|
|
|
2019-09-25 13:59:52 +00:00
|
|
|
function solcjs_test
|
|
|
|
{
|
|
|
|
TEST_DIR=$(pwd)
|
|
|
|
SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js
|
|
|
|
|
|
|
|
# set up solc-js on the branch specified
|
2022-01-28 19:51:04 +00:00
|
|
|
setup_solc "$DIR" solcjs "$SOLJSON" master solc/ "$SOLCJS_CHECKOUT"
|
2021-12-03 11:57:39 +00:00
|
|
|
cd solc/
|
2019-09-25 13:59:52 +00:00
|
|
|
|
|
|
|
printLog "Updating index.js file..."
|
|
|
|
echo "require('./determinism.js');" >> test/index.js
|
|
|
|
|
|
|
|
printLog "Copying determinism.js..."
|
2020-12-01 19:31:30 +00:00
|
|
|
cp -f "$SOLCJS_INPUT_DIR/determinism.js" test/
|
2019-09-25 13:59:52 +00:00
|
|
|
|
|
|
|
printLog "Copying contracts..."
|
2020-12-01 19:31:30 +00:00
|
|
|
cp -Rf "$SOLCJS_INPUT_DIR/DAO" test/
|
2019-09-25 13:59:52 +00:00
|
|
|
|
2019-09-17 14:06:43 +00:00
|
|
|
printLog "Copying SMTChecker tests..."
|
2021-05-19 15:35:19 +00:00
|
|
|
# We do not copy all tests because that takes too long.
|
|
|
|
cp -Rf "$TEST_DIR"/test/libsolidity/smtCheckerTests/external_calls test/smtCheckerTests/
|
|
|
|
cp -Rf "$TEST_DIR"/test/libsolidity/smtCheckerTests/loops test/smtCheckerTests/
|
|
|
|
cp -Rf "$TEST_DIR"/test/libsolidity/smtCheckerTests/invariants test/smtCheckerTests/
|
2019-09-17 14:06:43 +00:00
|
|
|
|
2018-02-09 16:21:36 +00:00
|
|
|
# Update version (needed for some tests)
|
|
|
|
echo "Updating package.json to version $VERSION"
|
2020-12-01 19:31:30 +00:00
|
|
|
npm version --allow-same-version --no-git-tag-version "$VERSION"
|
2018-02-09 16:21:36 +00:00
|
|
|
|
2022-01-28 18:14:29 +00:00
|
|
|
replace_version_pragmas
|
|
|
|
|
|
|
|
printLog "Running test function..."
|
|
|
|
npm test
|
2019-09-25 13:59:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
external_test solc-js solcjs_test
|