Skip to content

Commit 3915768

Browse files
author
Leo
authored
Merge pull request #12594 from ethereum/solc-js-ext-test-local-checkout
solc-js external test on a local checkout
2 parents c7f1ead + 9e641e6 commit 3915768

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

test/externalTests/common.sh

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,23 @@ function setup_solc
7171
local binary_path="$3"
7272
local solcjs_branch="${4:-master}"
7373
local install_dir="${5:-solc/}"
74+
local solcjs_dir="$6"
7475

7576
[[ $binary_type == native || $binary_type == solcjs ]] || assertFail
77+
[[ $binary_type == solcjs || $solcjs_dir == "" ]] || assertFail
7678

7779
cd "$test_dir"
7880

7981
if [[ $binary_type == solcjs ]]
8082
then
8183
printLog "Setting up solc-js..."
82-
git clone --depth 1 -b "$solcjs_branch" https://github.com/ethereum/solc-js.git "$install_dir"
84+
if [[ $solcjs_dir == "" ]]; then
85+
printLog "Cloning branch ${solcjs_branch}..."
86+
git clone --depth 1 -b "$solcjs_branch" https://github.com/ethereum/solc-js.git "$install_dir"
87+
else
88+
printLog "Using local solc-js from ${solcjs_dir}..."
89+
cp -ra "$solcjs_dir" solc
90+
fi
8391

8492
pushd "$install_dir"
8593
npm install
@@ -323,20 +331,6 @@ function hardhat_clean
323331
rm -rf artifacts/ cache/
324332
}
325333

326-
function run_test
327-
{
328-
local compile_fn="$1"
329-
local test_fn="$2"
330-
331-
replace_version_pragmas
332-
333-
printLog "Running compile function..."
334-
time $compile_fn
335-
336-
printLog "Running test function..."
337-
$test_fn
338-
}
339-
340334
function settings_from_preset
341335
{
342336
local preset="$1"

test/externalTests/solc-js/solc-js.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,17 @@ source test/externalTests/common.sh
2626

2727
SOLJSON="$1"
2828
VERSION="$2"
29+
SOLCJS_CHECKOUT="$3" # optional
2930

30-
[[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version>"
31-
32-
function compile_fn { echo "Nothing to compile."; }
33-
function test_fn { npm test; }
31+
[[ $SOLJSON != "" && -f "$SOLJSON" && $VERSION != "" ]] || fail "Usage: $0 <path to soljson.js> <version> [<path to solc-js>]"
3432

3533
function solcjs_test
3634
{
3735
TEST_DIR=$(pwd)
3836
SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js
3937

4038
# set up solc-js on the branch specified
41-
setup_solc "$DIR" solcjs "$SOLJSON" master solc/
39+
setup_solc "$DIR" solcjs "$SOLJSON" master solc/ "$SOLCJS_CHECKOUT"
4240
cd solc/
4341

4442
printLog "Updating index.js file..."
@@ -60,7 +58,10 @@ function solcjs_test
6058
echo "Updating package.json to version $VERSION"
6159
npm version --allow-same-version --no-git-tag-version "$VERSION"
6260

63-
run_test compile_fn test_fn
61+
replace_version_pragmas
62+
63+
printLog "Running test function..."
64+
npm test
6465
}
6566

6667
external_test solc-js solcjs_test

0 commit comments

Comments
 (0)