Skip to content

Commit 7b4522f

Browse files
committed
External test for Tracer Perpetual Pools
1 parent 8f80433 commit 7b4522f

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,13 @@ defaults:
559559
binary_type: native
560560
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
561561
nodejs_version: '16'
562+
- job_native_test_ext_perpetual_pools: &job_native_test_ext_perpetual_pools
563+
<<: *workflow_ubuntu2004_static
564+
name: t_native_test_ext_perpetual_pools
565+
project: perpetual-pools
566+
binary_type: native
567+
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
568+
nodejs_version: '16'
562569
- job_ems_test_ext_colony: &job_ems_test_ext_colony
563570
<<: *workflow_emscripten
564571
name: t_ems_test_ext_colony
@@ -1441,6 +1448,7 @@ workflows:
14411448
- t_ems_ext: *job_native_test_ext_yield_liquidator
14421449
- t_ems_ext: *job_native_test_ext_bleeps
14431450
- t_ems_ext: *job_native_test_ext_pool_together
1451+
- t_ems_ext: *job_native_test_ext_perpetual_pools
14441452

14451453
# Windows build and tests
14461454
- b_win: *workflow_trigger_on_tags

test/externalTests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ printTask "Running external tests..."
4747
"$REPO_ROOT/externalTests/yield-liquidator.sh" "$@"
4848
"$REPO_ROOT/externalTests/bleeps.sh" "$@"
4949
"$REPO_ROOT/externalTests/pool-together.sh" "$@"
50+
"$REPO_ROOT/externalTests/perpetual-pools.sh" "$@"

test/externalTests/perpetual-pools.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------------------------------------------------------------------------
4+
# This file is part of solidity.
5+
#
6+
# solidity is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# solidity is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with solidity. If not, see <http://www.gnu.org/licenses/>
18+
#
19+
# (c) 2022 solidity contributors.
20+
#------------------------------------------------------------------------------
21+
22+
set -e
23+
24+
source scripts/common.sh
25+
source test/externalTests/common.sh
26+
27+
verify_input "$@"
28+
BINARY_TYPE="$1"
29+
BINARY_PATH="$2"
30+
SELECTED_PRESETS="$3"
31+
32+
function compile_fn { yarn build; }
33+
function test_fn { yarn test; }
34+
35+
function perpetual_pools_test
36+
{
37+
local repo="https://github.com/tracer-protocol/perpetual-pools-contracts"
38+
local ref_type=branch
39+
local ref=pools-v2
40+
local config_file="hardhat.config.ts"
41+
local config_var="config"
42+
43+
local compile_only_presets=()
44+
local settings_presets=(
45+
"${compile_only_presets[@]}"
46+
#ir-no-optimize # Compilation fails with "YulException: Variable var_amount_527 is 9 slot(s) too deep inside the stack."
47+
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var_amount_527 is 9 slot(s) too deep inside the stack."
48+
#ir-optimize-evm+yul # Compilation fails with "YulException: Variable expr_mpos is 1 too deep in the stack"
49+
legacy-no-optimize
50+
legacy-optimize-evm-only
51+
legacy-optimize-evm+yul
52+
)
53+
54+
[[ $SELECTED_PRESETS != "" ]] || SELECTED_PRESETS=$(circleci_select_steps_multiarg "${settings_presets[@]}")
55+
print_presets_or_exit "$SELECTED_PRESETS"
56+
57+
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
58+
download_project "$repo" "$ref_type" "$ref" "$DIR"
59+
60+
neutralize_package_lock
61+
neutralize_package_json_hooks
62+
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
63+
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var"
64+
force_hardhat_unlimited_contract_size "$config_file" "$config_var"
65+
yarn install
66+
67+
replace_version_pragmas
68+
69+
for preset in $SELECTED_PRESETS; do
70+
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn "$config_var"
71+
done
72+
}
73+
74+
external_test Tracer-Perpetual-Pools perpetual_pools_test

0 commit comments

Comments
 (0)