File tree Expand file tree Collapse file tree 2 files changed +16
-21
lines changed Expand file tree Collapse file tree 2 files changed +16
-21
lines changed Original file line number Diff line number Diff line change @@ -71,15 +71,23 @@ function setup_solc
71
71
local binary_path=" $3 "
72
72
local solcjs_branch=" ${4:- master} "
73
73
local install_dir=" ${5:- solc/ } "
74
+ local solcjs_dir=" $6 "
74
75
75
76
[[ $binary_type == native || $binary_type == solcjs ]] || assertFail
77
+ [[ $binary_type == solcjs || $solcjs_dir == " " ]] || assertFail
76
78
77
79
cd " $test_dir "
78
80
79
81
if [[ $binary_type == solcjs ]]
80
82
then
81
83
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
83
91
84
92
pushd " $install_dir "
85
93
npm install
@@ -323,20 +331,6 @@ function hardhat_clean
323
331
rm -rf artifacts/ cache/
324
332
}
325
333
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
-
340
334
function settings_from_preset
341
335
{
342
336
local preset=" $1 "
Original file line number Diff line number Diff line change @@ -26,19 +26,17 @@ source test/externalTests/common.sh
26
26
27
27
SOLJSON=" $1 "
28
28
VERSION=" $2 "
29
+ SOLCJS_CHECKOUT=" $3 " # optional
29
30
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>]"
34
32
35
33
function solcjs_test
36
34
{
37
35
TEST_DIR=$( pwd)
38
36
SOLCJS_INPUT_DIR=" $TEST_DIR " /test/externalTests/solc-js
39
37
40
38
# 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 "
42
40
cd solc/
43
41
44
42
printLog " Updating index.js file..."
@@ -60,7 +58,10 @@ function solcjs_test
60
58
echo " Updating package.json to version $VERSION "
61
59
npm version --allow-same-version --no-git-tag-version " $VERSION "
62
60
63
- run_test compile_fn test_fn
61
+ replace_version_pragmas
62
+
63
+ printLog " Running test function..."
64
+ npm test
64
65
}
65
66
66
67
external_test solc-js solcjs_test
You can’t perform that action at this time.
0 commit comments