Run the tests with cgo off and without the race detector (closes #538)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
sneak ruled the race detector out (#538 (comment)), and on Linux it was the only reason the tests needed cgo. The test phase and the browser test binary now build with CGO_ENABLED=0 and without -race, so no test binary compiles mattn's C SQLite. The test phase keeps the builder stage's Debian Go image. Its comments, the README and the code comments that said the suite runs under -race now say what is true, and the README notes the exception to the vendored REPO_POLICIES.md. Model: opus-5-5
This commit is contained in:
@@ -303,7 +303,7 @@ func (r *racingWrites) wait() (bool, error) {
|
||||
// contending for the writer's mutex when the eviction takes it.
|
||||
// The write that wins the mutex after the eviction must abandon
|
||||
// its work rather than reopen the archive, leaving the writer
|
||||
// permanently handle-free. Run under -race.
|
||||
// permanently handle-free.
|
||||
func TestEvictWebhook_RacingWriteDoesNotReopenHandle(
|
||||
t *testing.T,
|
||||
) {
|
||||
|
||||
@@ -959,9 +959,11 @@ func TestArchiveSweep_SkipsDeletedWebhookTargets(t *testing.T) {
|
||||
)
|
||||
}
|
||||
|
||||
// TestArchiveSweep_ConcurrentWrites proves the sweep serialises
|
||||
// against writes through the target's writer mutex. Run under
|
||||
// -race, an unsynchronised sweep would be caught here.
|
||||
// TestArchiveSweep_ConcurrentWrites runs the sweep while writes to
|
||||
// the same target are under way. The sweep serialises against them
|
||||
// through the target's writer mutex; the suite runs without Go's race
|
||||
// detector, so a sweep that did not would fail this test only by
|
||||
// panicking, hanging or leaving no archive file.
|
||||
func TestArchiveSweep_ConcurrentWrites(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -67,9 +67,10 @@ func DefaultPasswordConfig() *PasswordConfig {
|
||||
// testArgon2Memory is the Argon2id memory cost, in KiB, that a test
|
||||
// binary hashes with: 1 MB instead of the shipped 64 MB. Every test
|
||||
// that starts a database hashes the bootstrap admin password, dozens
|
||||
// of them run in parallel, and under the race detector each 64 MB hash
|
||||
// holds about 150 MB. VerifyPassword reads the cost from the hash it
|
||||
// checks, so verification follows.
|
||||
// of them run in parallel, and each 64 MB hash holds at least 64 MB
|
||||
// while it runs (about 150 MB when the suite ran under the race
|
||||
// detector). VerifyPassword reads the cost from the hash it checks, so
|
||||
// verification follows.
|
||||
const testArgon2Memory = 1024
|
||||
|
||||
// hashAtShippedCostInTest makes a test binary hash at the shipped
|
||||
|
||||
@@ -21,8 +21,9 @@ const budget = 64
|
||||
|
||||
// batchRunes is how many consecutive code points the charge test logs
|
||||
// in one value from U+1000 up. Logging each of those on its own line
|
||||
// is too slow for the suite under the race detector; 4,096 at a time
|
||||
// is 271 batches, each logged on two lines, so 542 lines per handler.
|
||||
// was too slow for the suite when it ran under the race detector;
|
||||
// 4,096 at a time is 271 batches, each logged on two lines, so 542
|
||||
// lines per handler.
|
||||
const batchRunes = 4096
|
||||
|
||||
// newHandlers are the two handlers internal/logger can install. Time
|
||||
@@ -152,10 +153,10 @@ func TestEncodedBytes_ChargesAtLeastWhatTheHandlersEmit(t *testing.T) {
|
||||
batches = append(batches, batch.String())
|
||||
}
|
||||
|
||||
// What EncodedBytes charges for each batch. Under -race -cover this
|
||||
// takes longer than logging the batches, so it is worked out once,
|
||||
// by whichever handler finishes logging first, while the other is
|
||||
// still logging.
|
||||
// What EncodedBytes charges for each batch. When the suite ran
|
||||
// under -race -cover this took longer than logging the batches, so
|
||||
// it is worked out once, by whichever handler finishes logging
|
||||
// first, while the other is still logging.
|
||||
charged := sync.OnceValue(func() []int {
|
||||
costs := make([]int, len(batches))
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@ import (
|
||||
"sneak.berlin/go/webhooker/internal/server"
|
||||
)
|
||||
|
||||
// earlyStopIterations is how many start/stop cycles the race test
|
||||
// earlyStopIterations is how many start/stop cycles the test below
|
||||
// runs. The window it aims at is the gap between the OnStart hook
|
||||
// returning and the serving goroutine reaching its first field
|
||||
// access, which is microseconds wide. The race detector reports an
|
||||
// unsynchronised pair whenever it observes one, but it has to observe
|
||||
// one, so a single cycle can miss purely on scheduling. Repetition
|
||||
// makes the observation reliable; the collaborators are built once,
|
||||
// so the cycles themselves are cheap.
|
||||
// access, which is microseconds wide, so a single cycle can miss it
|
||||
// purely on scheduling. Repetition makes hitting it reliable; the
|
||||
// collaborators are built once, so the cycles themselves are cheap.
|
||||
const earlyStopIterations = 25
|
||||
|
||||
// TestEarlyShutdown_NoPanicAndNoRace stops the application
|
||||
@@ -38,8 +36,9 @@ const earlyStopIterations = 25
|
||||
//
|
||||
// httpServer is now built in New, on the constructing goroutine, so
|
||||
// it is written before any hook exists and can never be nil.
|
||||
// sentryEnabled is atomic. This test is what catches either one
|
||||
// coming back — under -race, which is how the suite runs.
|
||||
// sentryEnabled is atomic. This test catches the nil dereference
|
||||
// coming back, as a panic. The suite runs without Go's race
|
||||
// detector, so the data race coming back would go unreported here.
|
||||
func TestEarlyShutdown_NoPanicAndNoRace(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user