From ab35e0fb936e2e8d109fe01239c6abacb41828d8 Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:56:50 -0400 Subject: [PATCH] chore(make): add simulator support --- Makefile | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 44f1a87..9da194f 100644 --- a/Makefile +++ b/Makefile @@ -212,4 +212,49 @@ lint-fix: @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) @$(golangci_lint_cmd) run ./... --fix --timeout 15m -.PHONY: lint lint-fix \ No newline at end of file +.PHONY: lint lint-fix + +################## +### Simulation ### +################## + +SIM_NUM_BLOCKS ?= 100 +SIM_PERIOD ?= 5 +SIM_COMMIT ?= true +SIM_ENABLED ?= true +SIM_VERBOSE ?= false +SIM_TIMEOUT ?= 24h +SIM_SEED ?= 42 +SIM_COMMON_ARGS = -NumBlocks=${SIM_NUM_BLOCKS} -Enabled=${SIM_ENABLED} -Commit=${SIM_COMMIT} -Period=${SIM_PERIOD} -Verbose=${SIM_VERBOSE} -Seed=${SIM_SEED} -v -timeout ${SIM_TIMEOUT} + +sim-full-app: + @echo "--> Running full app simulation (blocks: ${SIM_NUM_BLOCKS}, commit: ${SIM_COMMIT}, period: ${SIM_PERIOD}, seed: ${SIM_SEED}" + @go test ./app -run TestFullAppSimulation ${SIM_COMMON_ARGS} + +sim-full-app-random: + $(MAKE) sim-full-app SIM_SEED=$$RANDOM + +# Note: known to fail when using app wiring v1 +sim-import-export: + @echo "--> Running app import/export simulation (blocks: ${SIM_NUM_BLOCKS}, commit: ${SIM_COMMIT}, period: ${SIM_PERIOD}, seed: ${SIM_SEED}" + @go test ./app -run TestAppImportExport ${SIM_COMMON_ARGS} + +# Note: known to fail when using app wiring v1 +sim-import-export-random: + $(MAKE) sim-import-export SIM_SEED=$$RANDOM + +sim-after-import: + @echo "--> Running app after import simulation (blocks: ${SIM_NUM_BLOCKS}, commit: ${SIM_COMMIT}, period: ${SIM_PERIOD}, seed: ${SIM_SEED}" + @go test ./app -run TestAppSimulationAfterImport ${SIM_COMMON_ARGS} + +sim-after-import-random: + $(MAKE) sim-after-import SIM_SEED=$$RANDOM + +sim-app-determinism: + @echo "--> Running app determinism simulation (blocks: ${SIM_NUM_BLOCKS}, commit: ${SIM_COMMIT}, period: ${SIM_PERIOD}, seed: ${SIM_SEED}" + @go test ./app -run TestAppStateDeterminism ${SIM_COMMON_ARGS} + +sim-app-determinism-random: + $(MAKE) sim-app-determinism SIM_SEED=$$RANDOM + +.PHONY: sim-full-app sim-full-app-random sim-import-export sim-after-import sim-app-determinism sim-import-export-random sim-after-import-random sim-app-determinism-random