Run the tests under the race detector with make test-race (closes #18) #92

Merged
clawbot merged 1 commits from issue-18-test-race into next 2026-10-04 20:01:27 +02:00
Collaborator

Adds script/test-race and its make test-race shim, following the plan on #18. It runs go test -race -timeout 60s ./... with cgo on, in a digest-pinned golang:1.25-trixie image, with the checkout mounted read-only and the container removed on exit. It is not part of make check; the Makefile, the Dockerfile and the shipped binary keep CGO_ENABLED=0. README.md documents both entrypoints, and the accepted-divergence note in TODO.md now points at the new target.

What the diff does not show:

  • The image is Debian, not the Alpine one the Dockerfile builds with, because the Debian image ships gcc.
  • The tests run as the calling user, or as nobody (uid 65534) when that is root, because root reads the files the tests make unreadable. Only in that root case must the checkout be readable by other users.
  • Each run starts with empty module and build caches, so it downloads the dependencies and compiles them with the detector every time. It needs the network and takes a few minutes.
  • The detector found no races, so there are no code changes and no new issues.

Disclosures:

  • Judgement call: script/lint builds an image from a copy of the tree, but this script mounts the checkout as the plan says, so it needs a local docker daemon.
  • Judgement call: unlike script/test, there is no verbose rerun on failure; a race report names the failing test on its own.
  • Unverified: the root case was not re-run after the rework; it keeps the earlier behaviour unchanged.

Model: opus-5-5

Adds `script/test-race` and its `make test-race` shim, following the plan on https://git.eeqj.de/sneak/sfdupes/issues/18. It runs `go test -race -timeout 60s ./...` with cgo on, in a digest-pinned `golang:1.25-trixie` image, with the checkout mounted read-only and the container removed on exit. It is not part of `make check`; the `Makefile`, the `Dockerfile` and the shipped binary keep `CGO_ENABLED=0`. `README.md` documents both entrypoints, and the accepted-divergence note in `TODO.md` now points at the new target. What the diff does not show: - The image is Debian, not the Alpine one the `Dockerfile` builds with, because the Debian image ships `gcc`. - The tests run as the calling user, or as `nobody` (uid 65534) when that is root, because root reads the files the tests make unreadable. Only in that root case must the checkout be readable by other users. - Each run starts with empty module and build caches, so it downloads the dependencies and compiles them with the detector every time. It needs the network and takes a few minutes. - The detector found no races, so there are no code changes and no new issues. Disclosures: - Judgement call: `script/lint` builds an image from a copy of the tree, but this script mounts the checkout as the plan says, so it needs a local docker daemon. - Judgement call: unlike `script/test`, there is no verbose rerun on failure; a race report names the failing test on its own. - Unverified: the root case was not re-run after the rework; it keeps the earlier behaviour unchanged. Model: opus-5-5
clawbot added the needs-review label 2026-10-04 17:58:32 +02:00
clawbot self-assigned this 2026-10-04 17:58:32 +02:00
Author
Collaborator
  1. README.md (the script/test-race entry) and the header comment of script/test-race: the tests run as nobody, so the target only works on a checkout that other users can read, and nothing in the tree says so (only the PR body does). On a checkout made under umask 077 it fails with a Go error saying /src contains no module, which points nowhere near the cause. Acceptable: state the requirement in both places, or remove it, for example by running as the invoking user when that user is not root.

  2. The branch does not rebase cleanly onto next: its TODO.md Completed Steps entry conflicts with the one for #48. Acceptable: rebase with this entry at the top of the list.

Model: opus-5-5

1. `README.md` (the `script/test-race` entry) and the header comment of `script/test-race`: the tests run as `nobody`, so the target only works on a checkout that other users can read, and nothing in the tree says so (only the PR body does). On a checkout made under umask 077 it fails with a Go error saying `/src` contains no module, which points nowhere near the cause. Acceptable: state the requirement in both places, or remove it, for example by running as the invoking user when that user is not root. 2. The branch does not rebase cleanly onto `next`: its `TODO.md` Completed Steps entry conflicts with the one for https://git.eeqj.de/sneak/sfdupes/issues/48. Acceptable: rebase with this entry at the top of the list. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-04 18:43:13 +02:00
clawbot force-pushed issue-18-test-race from 2439b00f44 to a67a83fb42 2026-10-04 19:07:11 +02:00 Compare
Author
Collaborator
  1. Requirement removed: script/test-race now runs the tests as the calling user, falling back to nobody only when the caller is root; the README.md entry and the script's header comment say so. Run on a fresh checkout made under umask 077, where the previous version fails as described.
  2. Rebased onto current next with this entry at the top of Completed Steps; make fmt applied.

Model: opus-5-5

1. Requirement removed: `script/test-race` now runs the tests as the calling user, falling back to `nobody` only when the caller is root; the `README.md` entry and the script's header comment say so. Run on a fresh checkout made under umask 077, where the previous version fails as described. 2. Rebased onto current `next` with this entry at the top of Completed Steps; `make fmt` applied. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-04 19:07:24 +02:00
Author
Collaborator
  1. README.md line 745 (the script/bootstrap entry) and script/bootstrap (header comment at line 10, the comment at line 78, and the warning printed at lines 82-84) still say that everything except linting and formatting works without docker, and the warning lists make lint, make fmt, make fmt-check, make check and make docker as the targets that need it. make test-race now needs docker too, so the README sentence is no longer true and a user without docker is told the wrong set of targets. Acceptable: add make test-race to that list in the warning and both comments, and make the README sentence name it as well.

Model: opus-5-5

1. `README.md` line 745 (the `script/bootstrap` entry) and `script/bootstrap` (header comment at line 10, the comment at line 78, and the warning printed at lines 82-84) still say that everything except linting and formatting works without docker, and the warning lists `make lint`, `make fmt`, `make fmt-check`, `make check` and `make docker` as the targets that need it. `make test-race` now needs docker too, so the README sentence is no longer true and a user without docker is told the wrong set of targets. Acceptable: add `make test-race` to that list in the warning and both comments, and make the README sentence name it as well. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-04 19:26:08 +02:00
clawbot added 1 commit 2026-10-04 19:31:44 +02:00
script/test-race runs go test -race in a digest-pinned Debian golang
image that has gcc, since the detector needs cgo and the build keeps it
off. The checkout is mounted read-only and the container is removed
afterwards. The tests run as the calling user, or as nobody when that is
root, so the tests that make a file unreadable still see the read fail.
It is not part of make check. The detector found no races.

Model: opus-5-5
clawbot force-pushed issue-18-test-race from a67a83fb42 to e4e297aa60 2026-10-04 19:31:44 +02:00 Compare
Author
Collaborator
  1. make test-race is now named in the script/bootstrap warning, in both of its comments, and in the README.md sentence about what works without docker.

Rebased onto current next, with this entry still at the top of Completed Steps.

Model: opus-5-5

1. `make test-race` is now named in the `script/bootstrap` warning, in both of its comments, and in the `README.md` sentence about what works without docker. Rebased onto current `next`, with this entry still at the top of Completed Steps. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-04 19:37:13 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 546203afe5 into next 2026-10-04 20:01:27 +02:00
clawbot deleted branch issue-18-test-race 2026-10-04 20:01:27 +02:00
Sign in to join this conversation.