1 Commits
Author SHA1 Message Date
sneak eb67f2b417 Make the internal/handlers tests fast (closes #113)
check / check (push) Waiting to run
-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
2026-10-06 19:19:15 +00:00
+5 -2
View File
@@ -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