mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12594 from ethereum/solc-js-ext-test-local-checkout
solc-js external test on a local checkout
This commit is contained in:
commit
3915768753
@ -71,15 +71,23 @@ function setup_solc
|
||||
local binary_path="$3"
|
||||
local solcjs_branch="${4:-master}"
|
||||
local install_dir="${5:-solc/}"
|
||||
local solcjs_dir="$6"
|
||||
|
||||
[[ $binary_type == native || $binary_type == solcjs ]] || assertFail
|
||||
[[ $binary_type == solcjs || $solcjs_dir == "" ]] || assertFail
|
||||
|
||||
cd "$test_dir"
|
||||
|
||||
if [[ $binary_type == solcjs ]]
|
||||
then
|
||||
printLog "Setting up solc-js..."
|
||||
git clone --depth 1 -b "$solcjs_branch" https://github.com/ethereum/solc-js.git "$install_dir"
|
||||
if [[ $solcjs_dir == "" ]]; then
|
||||
printLog "Cloning branch ${solcjs_branch}..."
|
||||
git clone --depth 1 -b "$solcjs_branch" https://github.com/ethereum/solc-js.git "$install_dir"
|
||||
else
|
||||
printLog "Using local solc-js from ${solcjs_dir}..."
|
||||
cp -ra "$solcjs_dir" solc
|
||||
fi
|
||||
|
||||
pushd "$install_dir"
|
||||
npm install
|
||||
@ -323,20 +331,6 @@ function hardhat_clean
|
||||
rm -rf artifacts/ cache/
|
||||
}
|
||||
|
||||
function run_test
|
||||
{
|
||||
local compile_fn="$1"
|
||||
local test_fn="$2"
|
||||
|
||||
replace_version_pragmas
|
||||
|
||||
printLog "Running compile function..."
|
||||
time $compile_fn
|
||||
|
||||
printLog "Running test function..."
|
||||
$test_fn
|
||||
}
|
||||
|
||||
function settings_from_preset
|
||||
{
|
||||
local preset="$1"
|
||||
|
@ -26,11 +26,9 @@ source test/externalTests/common.sh
|
||||
|
||||
SOLJSON="$1"
|
||||
VERSION="$2"
|
||||
SOLCJS_CHECKOUT="$3" # optional
|
||||
|
||||
[[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version>"
|
||||
|
||||
function compile_fn { echo "Nothing to compile."; }
|
||||
function test_fn { npm test; }
|
||||
[[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version> [<path to solc-js>]"
|
||||
|
||||
function solcjs_test
|
||||
{
|
||||
@ -38,7 +36,7 @@ function solcjs_test
|
||||
SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js
|
||||
|
||||
# set up solc-js on the branch specified
|
||||
setup_solc "$DIR" solcjs "$SOLJSON" master solc/
|
||||
setup_solc "$DIR" solcjs "$SOLJSON" master solc/ "$SOLCJS_CHECKOUT"
|
||||
cd solc/
|
||||
|
||||
printLog "Updating index.js file..."
|
||||
@ -60,7 +58,10 @@ function solcjs_test
|
||||
echo "Updating package.json to version $VERSION"
|
||||
npm version --allow-same-version --no-git-tag-version "$VERSION"
|
||||
|
||||
run_test compile_fn test_fn
|
||||
replace_version_pragmas
|
||||
|
||||
printLog "Running test function..."
|
||||
npm test
|
||||
}
|
||||
|
||||
external_test solc-js solcjs_test
|
||||
|
Loading…
Reference in New Issue
Block a user