From 9ef600e5726f67f802f3aa4bec2bba937d01b4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 9 Mar 2022 20:35:46 +0100 Subject: [PATCH] euler: Override Hardhat test timeout --- test/externalTests/common.sh | 24 +++++++++++++++++++++++- test/externalTests/euler.sh | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index e4e1e3adf..9c68c8828 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -233,7 +233,6 @@ function force_truffle_compiler_settings function name_hardhat_default_export { local config_file="$1" - local config_var_name="$2" local import="import {HardhatUserConfig} from 'hardhat/types';" local config="const config: HardhatUserConfig = {" @@ -241,6 +240,29 @@ function name_hardhat_default_export echo "export default config;" >> "$config_file" } +function force_hardhat_timeout +{ + local config_file="$1" + local config_var_name="$2" + local new_timeout="$3" + + printLog "Configuring Hardhat..." + echo "-------------------------------------" + echo "Timeout: ${new_timeout}" + echo "-------------------------------------" + + if [[ $config_file == *\.js ]]; then + [[ $config_var_name == "" ]] || assertFail + echo "module.exports.mocha = module.exports.mocha || {timeout: ${new_timeout}}" + echo "module.exports.mocha.timeout = ${new_timeout}" + else + [[ $config_file == *\.ts ]] || assertFail + [[ $config_var_name != "" ]] || assertFail + echo "${config_var_name}.mocha = ${config_var_name}.mocha ?? {timeout: ${new_timeout}};" + echo "${config_var_name}.mocha!.timeout = ${new_timeout}" + fi >> "$config_file" +} + function force_hardhat_compiler_binary { local config_file="$1" diff --git a/test/externalTests/euler.sh b/test/externalTests/euler.sh index b3b505051..6a73f00e5 100755 --- a/test/externalTests/euler.sh +++ b/test/externalTests/euler.sh @@ -63,6 +63,8 @@ function euler_test force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH" force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" force_hardhat_unlimited_contract_size "$config_file" + # Workaround for the timeout that's too short for unoptimized code (https://github.com/ethereum/solidity/pull/12765) + force_hardhat_timeout "$config_file" "" 100000 npm install replace_version_pragmas