From 40adf91cb02eba60480ed4a54bc8dcd659dc07af Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Tue, 13 Jan 2026 10:53:09 +0200 Subject: [PATCH] feat: add profiling options to tests in Makefile (#21488) Usage example: ```bash $ make test TEST_CPUPROFILE=cpu.prof TEST_MEMPROFILE=mem.prof TEST_PACKAGES=./coderd ``` Note that `TEST_PACKAGES` has to be specified, otherwise you get `cannot use -{cpu,memory}profile flag with multiple packages`. Signed-off-by: Danny Kopping --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index bcfbaebf09..39541c10b8 100644 --- a/Makefile +++ b/Makefile @@ -1033,6 +1033,14 @@ ifdef RUN GOTEST_FLAGS += -run $(RUN) endif +ifdef TEST_CPUPROFILE +GOTEST_FLAGS += -cpuprofile=$(TEST_CPUPROFILE) +endif + +ifdef TEST_MEMPROFILE +GOTEST_FLAGS += -memprofile=$(TEST_MEMPROFILE) +endif + TEST_PACKAGES ?= ./... test: