Skip to content

torture: use sqlite3.SQLiteDriver instead of cgo-only ErrNo#123

Merged
brianmcgee merged 1 commit intomainfrom
aldo/fix-torture-nocgo-sqlite3
Apr 16, 2026
Merged

torture: use sqlite3.SQLiteDriver instead of cgo-only ErrNo#123
brianmcgee merged 1 commit intomainfrom
aldo/fix-torture-nocgo-sqlite3

Conversation

@aldoborrero
Copy link
Copy Markdown
Member

Summary

The torture fixture's internal/{conflict-a,conflict-b,db} use sqlite3.ErrNo(0) to force the mattn/go-sqlite3 import. ErrNo only exists in the cgo build — the package's //go:build !cgo stub defines SQLiteDriver/SQLiteConn but not the error types. So bench-incremental --fixture torture --tools nix-*-nocgo (and any CGO_ENABLED=0 build of the fixture) fails at compile.

SQLiteDriver{} is defined in both builds; swap to that. Also updates the testgen template.

Test plan

  • CGO_ENABLED=0 go build ./internal/conflict-a — was undefined: sqlite3.ErrNo, now OK
  • CGO_ENABLED=1 go build ./internal/conflict-a — still OK

mattn/go-sqlite3's `//go:build !cgo` stub doesn't define ErrNo, so the
torture fixture has never compiled with CGO_ENABLED=0 — which is what
bench-incremental's `nix-*-nocgo` tools and the bazel comparison need.
SQLiteDriver{} is in both the cgo and nocgo builds (it's the type
init() registers).

Also updates the testgen template so a regen doesn't reintroduce it.

:house: Remote-Dev: homespace
@github-actions
Copy link
Copy Markdown

Benchmark Regression Check

Scenario Tool Base (s) Current (s) Change Drvs (base) Drvs (curr) Status
no_change nix-ca-nocgo 0.67 0.68 +1.1% 0 0 ok
no_change nix-nocgo 0.66 0.68 +2.4% 0 0 ok
leaf-private nix-ca-nocgo 2.40 2.38 -1.1% 2 2 ok
leaf-private nix-nocgo 1.64 1.74 +5.7% 2 2 ok
mid-private nix-ca-nocgo 2.53 2.44 -3.5% 2 2 ok
mid-private nix-nocgo 1.74 1.76 +1.0% 4 4 ok
deep-private nix-ca-nocgo 2.92 2.70 -7.8% 3 3 ok
deep-private nix-nocgo 2.05 2.09 +1.9% 8 8 ok

Baseline: main | Current: 1f90a03c0c9e7b4b1297e62a8a81ff305a8035fe

@aldoborrero aldoborrero requested a review from brianmcgee April 16, 2026 09:34
Copy link
Copy Markdown
Member

@brianmcgee brianmcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brianmcgee brianmcgee added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit fae0c40 Apr 16, 2026
3 checks passed
@brianmcgee brianmcgee deleted the aldo/fix-torture-nocgo-sqlite3 branch April 16, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants