Set up CI, with an opt lane and a sanitizer lane #1
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
bcox/tymbal#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There is no CI configuration in the repository — no
.github,.forgejo,.woodpeckeror.drone. Everything is verified by runningbazel test //...by hand, at the default
fastbuildconfiguration.That gap has already hidden a real bug for an unknown length of time.
What it cost
//dsp:lfo_testfailed under-c optwhile passing atfastbuild. The causewas a lifetime bug, not a numerical one:
Lfo::NoteOnkeeps a pointer to thepatch rather than copying it, and twelve call sites in the test passed a
temporary, so
patch_referred to dead stack for the rest of the note.AddressSanitizer named it exactly —
stack-use-after-scope.It survived at
-O0, where the stack slot happens to still hold the values,and failed at
-O3, where it does not. Nothing caught it because the suiteonly ever ran at one optimisation level.
It also meant
.bazelrc's stated invariant was false the whole time:Fixed in
80db42a. The suite now passes atfastbuild,-c optand--config=opt, andNoteOn(Patch&&)is deleted onLfo,LayerandFmPairLayerso the same mistake is a compile error rather than aconfiguration-dependent miscompile.
What is wanted
Three lanes, because each catches a different class:
bazel test //...— the defaultfastbuildlane.bazel test //... --config=opt— this is the one that would have caughtthe above. Worth treating as non-optional given the bit-reproducibility
claim the project makes about
dsp/.bazel test //... --copt=-fsanitize=address,undefined --copt=-fno-sanitize-recover=all --copt=-fsanitize-address-use-after-return=always --linkopt=-fsanitize=address,undefined— ASan is what actually named thebug once the opt lane exposed it. UBSan is nearly free alongside it.
Notes for whoever picks this up:
toolchains_llvm), so a runner needs only Bazeland network access to fetch it; no system compiler or dev packages.
--expungebuild is expensive. Caching Bazel's repository cachebetween runs is worth setting up early.
//tools:patch_editorlinks GLFW/OpenGL but is not run by any test, so aheadless runner can still
bazel buildit. It should be built, since it isthe one target the test suite does not cover.
27e06bf/08c4b3a, so--copt=-Werroris worth considering for our own code — note
.bazelrcdeliberatelysuppresses warnings for
external/.ThreadSanitizer is deliberately not in this list; see the separate issue.
test comment