external test scripts: Replace global $SOLJSON variable with a parameter

This commit is contained in:
Kamil Śliwak 2020-12-01 20:44:21 +01:00
parent fcf0538224
commit 8080be9445
6 changed files with 28 additions and 24 deletions

View File

@ -33,15 +33,15 @@ function colony_test
OPTIMIZER_LEVEL=3
CONFIG="truffle.js"
truffle_setup https://github.com/solidity-external-tests/colonyNetwork.git develop_070
run_install install_fn
truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/colonyNetwork.git develop_070
run_install "$SOLJSON" install_fn
cd lib
rm -Rf dappsys
git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_060 dappsys
cd ..
truffle_run_test compile_fn test_fn "NO-FORCE-ABI-V2"
truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2"
}
external_test ColonyNetworks colony_test

View File

@ -40,9 +40,10 @@ function verify_version_input
function setup
{
local branch="$1"
local soljson="$1"
local branch="$2"
setup_solcjs "$DIR" "$SOLJSON" "$branch" "solc"
setup_solcjs "$DIR" "$soljson" "$branch" "solc"
cd solc
}
@ -92,10 +93,11 @@ function force_truffle_version
function truffle_setup
{
local repo="$1"
local branch="$2"
local soljson="$1"
local repo="$2"
local branch="$3"
setup_solcjs "$DIR" "$SOLJSON" "master" "solc"
setup_solcjs "$DIR" "$soljson" "master" "solc"
download_project "$repo" "$branch" "$DIR"
}
@ -207,11 +209,12 @@ function clean
function run_install
{
local init_fn="$1"
local soljson="$1"
local init_fn="$2"
printLog "Running install function..."
replace_version_pragmas
force_solc "$CONFIG" "$DIR" "$SOLJSON"
force_solc "$CONFIG" "$DIR" "$soljson"
$init_fn
}
@ -232,14 +235,15 @@ function run_test
function truffle_run_test
{
local compile_fn="$1"
local test_fn="$2"
local force_abi_v2_flag="$3"
local soljson="$1"
local compile_fn="$2"
local test_fn="$3"
local force_abi_v2_flag="$4"
test "$force_abi_v2_flag" = "FORCE-ABI-V2" || test "$force_abi_v2_flag" = "NO-FORCE-ABI-V2"
replace_version_pragmas
force_solc "$CONFIG" "$DIR" "$SOLJSON"
force_solc "$CONFIG" "$DIR" "$soljson"
printLog "Checking optimizer level..."
if [ -z "$OPTIMIZER_LEVEL" ]; then

View File

@ -35,14 +35,14 @@ function ens_test
export OPTIMIZER_LEVEL=1
export CONFIG="truffle-config.js"
truffle_setup https://github.com/solidity-external-tests/ens.git upgrade-0.8.0
truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/ens.git upgrade-0.8.0
# Use latest Truffle. Older versions crash on the output from 0.8.0.
force_truffle_version ^5.1.55
run_install install_fn
run_install "$SOLJSON" install_fn
truffle_run_test compile_fn test_fn "NO-FORCE-ABI-V2"
truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2"
}
external_test Ens ens_test

View File

@ -33,17 +33,17 @@ function gnosis_safe_test
OPTIMIZER_LEVEL=1
CONFIG="truffle.js"
truffle_setup https://github.com/solidity-external-tests/safe-contracts.git development_070
truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git development_070
force_truffle_version ^5.0.42
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json
rm -f package-lock.json
rm -rf node_modules/
run_install install_fn
run_install "$SOLJSON" install_fn
replace_libsolc_call
truffle_run_test compile_fn test_fn "NO-FORCE-ABI-V2"
truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2"
}
external_test Gnosis-Safe gnosis_safe_test

View File

@ -35,7 +35,7 @@ function solcjs_test
SOLCJS_INPUT_DIR="$TEST_DIR"/test/externalTests/solc-js
# set up solc-js on the branch specified
setup master
setup "$SOLJSON" master
printLog "Updating index.js file..."
echo "require('./determinism.js');" >> test/index.js

View File

@ -33,10 +33,10 @@ function zeppelin_test
OPTIMIZER_LEVEL=1
CONFIG="truffle-config.js"
truffle_setup https://github.com/solidity-external-tests/openzeppelin-contracts.git upgrade-0.7.0
run_install install_fn
truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/openzeppelin-contracts.git upgrade-0.7.0
run_install "$SOLJSON" install_fn
truffle_run_test compile_fn test_fn "NO-FORCE-ABI-V2"
truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2"
}
external_test Zeppelin zeppelin_test