Skip to content

Commit

Permalink
feat: add no-match option to make test-forge
Browse files Browse the repository at this point in the history
  • Loading branch information
amusingaxl committed Jul 26, 2023
1 parent 5e7dcd1 commit 56232c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all :; DAPP_LIBRARIES=' lib/dss-exec-lib/src/DssExecLib.sol:Dss
clean :; forge clean
# Usage example: make test match=SpellIsCast
test :; ./scripts/test-dssspell-forge.sh match="$(match)" block="$(block)"
test-forge :; ./scripts/test-dssspell-forge.sh match="$(match)" block="$(block)"
test-forge :; ./scripts/test-dssspell-forge.sh match="$(match)" no-match="$(no-match)" block="$(block)"
estimate :; ./scripts/estimate-deploy-gas.sh
deploy :; ./scripts/deploy.sh
deploy-info :; ./scripts/get-deploy-info.sh tx=$(tx)
Expand Down
23 changes: 14 additions & 9 deletions scripts/test-dssspell-forge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ do

case "$KEY" in
match) MATCH="$VALUE" ;;
no-match) NO_MATCH="$VALUE" ;;
block) BLOCK="$VALUE" ;;
*)
esac
Expand All @@ -18,16 +19,20 @@ done
DSS_EXEC_LIB=$(< DssExecLib.address)
echo "Using DssExecLib at: $DSS_EXEC_LIB"
export FOUNDRY_LIBRARIES="lib/dss-exec-lib/src/DssExecLib.sol:DssExecLib:$DSS_EXEC_LIB"
export FOUNDRY_OPTIMIZER=true
export FOUNDRY_OPTIMIZER=false
export FOUNDRY_OPTIMIZER_RUNS=200
export FOUNDRY_ROOT_CHAINID=1

if [[ -z "$MATCH" && -z "$BLOCK" ]]; then
forge test --fork-url "$ETH_RPC_URL"
elif [[ -z "$BLOCK" ]]; then
forge test --fork-url "$ETH_RPC_URL" --match-test "$MATCH" -vvv
elif [[ -z "$MATCH" ]]; then
forge test --fork-url "$ETH_RPC_URL" --fork-block-number "$BLOCK"
else
forge test --fork-url "$ETH_RPC_URL" --match-test "$MATCH" --fork-block-number "$BLOCK" -vvv
EXTRA_ARGS=''

if [[ -n "$MATCH" ]]; then
EXTRA_ARGS="${EXTRA_ARGS} -vvv --match-test ${MATCH}"
elif [[ -n "$NO_MATCH" ]]; then
EXTRA_ARGS="${EXTRA_ARGS} -vvv --no-match-test ${NO_MATCH}"
fi

if [[ -n "$BLOCK" ]]; then
EXTRA_ARGS="${EXTRA_ARGS} --fork-block-number ${BLOCK}"
fi

forge test --fork-url "$ETH_RPC_URL" $EXTRA_ARGS

0 comments on commit 56232c5

Please sign in to comment.