forked from makerdao/dss-direct-deposit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·46 lines (41 loc) · 1.84 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -e
[[ "$ETH_RPC_URL" && "$(cast chain)" == "ethlive" ]] || { echo "Please set a mainnet ETH_RPC_URL"; exit 1; }
export FOUNDRY_OPTIMIZER=true
export FOUNDRY_OPTIMIZER_RUNS=200
for ARGUMENT in "$@"
do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
VALUE=$(echo $ARGUMENT | cut -f2 -d=)
case "$KEY" in
solc) SOLC="$VALUE" ;;
match) MATCH="$VALUE" ;;
match-test) MATCH_TEST="$VALUE" ;;
match-contract) MATCH_CONTRACT="$VALUE" ;;
block) BLOCK="$VALUE" ;;
*)
esac
done
if [[ -z "$MATCH" && -z "$BLOCK" && -z "$MATCH_TEST" && -z "$MATCH_CONTRACT" ]]; then
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" -vv --force
elif [[ -z "$MATCH" && -z "$MATCH_TEST" && -z "$MATCH_CONTRACT" ]]; then
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --fork-block-number "$BLOCK" -vv --force
else
if [[ -n "$BLOCK" ]]; then
if [[ -n "$MATCH" ]]; then
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --match "$MATCH" --fork-block-number "$BLOCK" -vvv --force
elif [[ -n "$MATCH_TEST" ]]; then
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --match-test "$MATCH_TEST" --fork-block-number "$BLOCK" -vvv --force
else
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --match-contract "$MATCH_CONTRACT" --fork-block-number "$BLOCK" -vvv --force
fi
else
if [[ -n "$MATCH" ]]; then
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --match "$MATCH" -vvv --force
elif [[ -n "$MATCH_TEST" ]]; then
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --match-test "$MATCH_TEST" -vvv --force
else
forge test --use "$SOLC" --fork-url "$ETH_RPC_URL" --match-contract "$MATCH_CONTRACT" -vvv --force
fi
fi
fi