externalTests: Refactor to be more explicit and easier to adjust for special cases

This commit is contained in:
Kamil Śliwak
2021-11-08 16:37:23 +01:00
parent 7ccdbd5b08
commit b57c0a0b81
7 changed files with 125 additions and 83 deletions
+17 -6
View File
@@ -27,16 +27,19 @@ source test/externalTests/common.sh
verify_input "$1"
export SOLJSON="$1"
function install_fn { npm install; }
function compile_fn { npx truffle compile; }
function test_fn { npm run test; }
function ens_test
{
export OPTIMIZER_LEVEL=1
export CONFIG="truffle-config.js"
local repo="https://github.com/ensdomains/ens.git"
local branch=master
local config_file="truffle-config.js"
local min_optimizer_level=1
local max_optimizer_level=3
truffle_setup "$SOLJSON" https://github.com/ensdomains/ens.git master
setup_solcjs "$DIR" "$SOLJSON"
download_project "$repo" "$branch" "$DIR"
# Use latest Truffle. Older versions crash on the output from 0.8.0.
force_truffle_version ^5.1.55
@@ -44,9 +47,17 @@ function ens_test
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
rm -f package-lock.json
run_install "$SOLJSON" install_fn
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
npm install
truffle_run_test "$SOLJSON" compile_fn test_fn
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
for level in $(seq "$min_optimizer_level" "$max_optimizer_level"); do
truffle_run_test "$config_file" "${DIR}/solc" "$level" compile_fn test_fn
done
}
external_test Ens ens_test