From eb67f2b417a1eaf2b1a960fe35568db7a06fb230 Mon Sep 17 00:00:00 2001 From: sneak Date: Tue, 6 Oct 2026 19:19:15 +0000 Subject: [PATCH] Make the internal/handlers tests fast (closes #113) -race also turns on Go's unsafe-pointer checks (checkptr) in every package. modernc.org/sqlite is SQLite machine-translated from C into Go, and every SQL statement the tests run passes through those checks thousands of times; they were half the CPU time of the internal/handlers tests. The test phase now turns them off for the modernc.org packages only. Race detection is unchanged everywhere, and the pointer checks stay on for this repository's code and every other dependency. Model: opus-5-5 --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 371400a..7003d1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,9 +32,12 @@ RUN go mod download COPY . . RUN mkdir -p web/dist && touch web/dist/index.html web/dist/style.css web/dist/app.js # -p 4 because test runs on a shared build host cap their parallelism. -RUN go test -p 4 -timeout 90s -race -cover ./... || \ +# -race also turns on Go's unsafe-pointer checks (checkptr) in every +# package. In modernc.org, SQLite machine-translated from C, they doubled +# the test time, so they are off there and stay on everywhere else. +RUN go test -p 4 -timeout 90s -race -gcflags='modernc.org/...=-d=checkptr=0' -cover ./... || \ { echo "--- Rerunning with -v for details ---"; \ - go test -p 4 -timeout 90s -race -v ./...; exit 1; } + go test -p 4 -timeout 90s -race -gcflags='modernc.org/...=-d=checkptr=0' -v ./...; exit 1; } # Build stage. Nothing is wanted from either phase above; the copies # are what make BuildKit build them first, so this stage cannot run