From 5864cf82f5d06fbcc996be41b2d37793a1602bd0 Mon Sep 17 00:00:00 2001 From: Alexander Peters Date: Tue, 25 Jun 2024 17:24:55 +0200 Subject: [PATCH] fix: benchmark start command (#20772) --- scripts/build/simulations.mk | 8 ++++---- x/simulation/doc.go | 23 ++++++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/build/simulations.mk b/scripts/build/simulations.mk index 28fd2d30e2..6d0f077e6d 100644 --- a/scripts/build/simulations.mk +++ b/scripts/build/simulations.mk @@ -82,7 +82,7 @@ test-sim-fuzz: #? test-sim-benchmark: Run benchmark test for simapp test-sim-benchmark: @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" - @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ + @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -tags='sims' -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h # Requires an exported plugin. See store/streaming/README.md for documentation. @@ -96,12 +96,12 @@ test-sim-benchmark: # make test-sim-benchmark-streaming test-sim-benchmark-streaming: @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" - @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ + @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -tags='sims' -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -EnableStreaming=true test-sim-profile: @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" - @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -benchmem -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ + @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -tags='sims' -benchmem -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out # Requires an exported plugin. See store/streaming/README.md for documentation. @@ -115,7 +115,7 @@ test-sim-profile: # make test-sim-profile-streaming test-sim-profile-streaming: @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" - @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -benchmem -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ + @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -tags='sims' -benchmem -run=^$$ $(.) -bench ^BenchmarkFullAppSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out -EnableStreaming=true .PHONY: test-sim-profile test-sim-benchmark test-sim-fuzz diff --git a/x/simulation/doc.go b/x/simulation/doc.go index e01040c359..a4bd12c174 100644 --- a/x/simulation/doc.go +++ b/x/simulation/doc.go @@ -46,9 +46,14 @@ others state execution outcome. # Usage +Switch to `simapp/` directory: + + $ cd simapp/ + To execute a completely pseudo-random simulation: - $ go test -mod=readonly github.com/cosmos/cosmos-sdk/simapp \ + $ go test -mod=readonly . \ + -tags='sims' \ -run=TestFullAppSimulation \ -Enabled=true \ -NumBlocks=100 \ @@ -60,7 +65,8 @@ To execute a completely pseudo-random simulation: To execute simulation from a genesis file: - $ go test -mod=readonly github.com/cosmos/cosmos-sdk/simapp \ + $ go test -mod=readonly . \ + -tags='sims' \ -run=TestFullAppSimulation \ -Enabled=true \ -NumBlocks=100 \ @@ -73,7 +79,8 @@ To execute simulation from a genesis file: To execute simulation from a simulation params file: - $ go test -mod=readonly github.com/cosmos/cosmos-sdk/simapp \ + $ go test -mod=readonly . \ + -tags='sims' \ -run=TestFullAppSimulation \ -Enabled=true \ -NumBlocks=100 \ @@ -86,7 +93,8 @@ To execute simulation from a simulation params file: To export the simulation params to a file at a given block height: - $ go test -mod=readonly github.com/cosmos/cosmos-sdk/simapp \ + $ go test -mod=readonly . \ + -tags='sims' \ -run=TestFullAppSimulation \ -Enabled=true \ -NumBlocks=100 \ @@ -96,11 +104,12 @@ To export the simulation params to a file at a given block height: -Period=5 \ -ExportParamsPath=/path/to/params.json \ -ExportParamsHeight=50 \ - -v -timeout 24h + -v -timeout 24h To export the simulation app state (i.e genesis) to a file: - $ go test -mod=readonly github.com/cosmos/cosmos-sdk/simapp \ + $ go test -mod=readonly . \ + -tags='sims' \ -run=TestFullAppSimulation \ -Enabled=true \ -NumBlocks=100 \ @@ -109,7 +118,7 @@ To export the simulation app state (i.e genesis) to a file: -Seed=99 \ -Period=5 \ -ExportStatePath=/path/to/genesis.json \ - v -timeout 24h + -v -timeout 24h # Params