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:
Leo 2022-02-14 19:44:46 +01:00 committed by GitHub
commit 3915768753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 21 deletions

View File

@ -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"

View File

@ -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