generated from m0-foundation/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.sh
executable file
·48 lines (41 loc) · 926 Bytes
/
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
47
48
#!/usr/bin/env bash
set -e
if [ -z "$MAINNET_RPC_URL" ]; then
. .env
fi
gas=false
verbose=false
while getopts d:g:p:t:v flag; do
case "${flag}" in
d) directory=${OPTARG} ;;
g) gas=true ;;
p) profile=${OPTARG} ;;
t) test=${OPTARG} ;;
v) verbose=true ;;
esac
done
export FOUNDRY_PROFILE=$profile
echo Using profile: $FOUNDRY_PROFILE
echo Higher verbosity: $verbose
echo Gas report: $gas
echo Test Match pattern: $test
if [ "$verbose" = false ]; then
verbosity="-vv"
else
verbosity="-vvvv"
fi
if [ "$gas" = false ];
then
gasReport=""
else
gasReport="--gas-report"
fi
if [ -z "$test" ]; then
if [ -z "$directory" ]; then
forge test --match-path "test/*" --fork-url $MAINNET_RPC_URL $gasReport $verbosity
else
forge test --match-path "$directory/*.t.sol" --fork-url $MAINNET_RPC_URL $gasReport $verbosity
fi
else
forge test --match-test "$test" --fork-url $MAINNET_RPC_URL $gasReport $verbosity
fi