externalTests/solc-js: Allow using a local checkout of solc-js

This commit is contained in:
Kamil Śliwak 2022-01-28 20:51:04 +01:00
parent b925250705
commit 9e641e60e7
2 changed files with 12 additions and 3 deletions

View File

@ -71,15 +71,23 @@ function setup_solc
local binary_path="$3" local binary_path="$3"
local solcjs_branch="${4:-master}" local solcjs_branch="${4:-master}"
local install_dir="${5:-solc/}" local install_dir="${5:-solc/}"
local solcjs_dir="$6"
[[ $binary_type == native || $binary_type == solcjs ]] || assertFail [[ $binary_type == native || $binary_type == solcjs ]] || assertFail
[[ $binary_type == solcjs || $solcjs_dir == "" ]] || assertFail
cd "$test_dir" cd "$test_dir"
if [[ $binary_type == solcjs ]] if [[ $binary_type == solcjs ]]
then then
printLog "Setting up solc-js..." printLog "Setting up solc-js..."
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" 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" pushd "$install_dir"
npm install npm install

View File

@ -26,8 +26,9 @@ source test/externalTests/common.sh
SOLJSON="$1" SOLJSON="$1"
VERSION="$2" VERSION="$2"
SOLCJS_CHECKOUT="$3" # optional
[[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version>" [[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version> [<path to solc-js>]"
function solcjs_test function solcjs_test
{ {
@ -35,7 +36,7 @@ function solcjs_test
SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js
# set up solc-js on the branch specified # 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/ cd solc/
printLog "Updating index.js file..." printLog "Updating index.js file..."