Skip to content

ci: run the test suite under valgrind - #26

Merged
cryo2010 merged 3 commits into
mainfrom
ci/valgrind
Jul 25, 2026
Merged

cryo2010 merged 3 commits into
mainfrom
ci/valgrind

Conversation

@cryo2010

Copy link
Copy Markdown
Owner

Summary

Adds memory-checker coverage to back the library's memory-safety claims (DESIGN.md §7's memory-manager emphasis, the closure-free interpreter):

  • A nimble valgrind task: compiles the suite with --mm:orc -d:useMalloc --debugger:native and runs it under valgrind --leak-check=full --errors-for-leak-kinds=definite --error-exitcode=1. -d:useMalloc is the essential flag: it routes Nim's allocations through malloc/free so valgrind can actually observe them; without it Nim's pooled allocator hides both errors and leaks. Gating on definite leaks (not still reachable) avoids false failures from module-level globals alive at exit.
  • A valgrind CI job that installs valgrind and runs the task on every PR/push.

The task lives in the nimble file so it's runnable locally on any Linux box, not just in CI. The build half (exact flags, suite passes under the malloc allocator) is verified locally; valgrind itself can only run in CI on this macOS-arm64 dev machine, so this PR's own run is the proof.

cryo2010 added 3 commits July 24, 2026 14:21
Adds a nimble valgrind task (orc + -d:useMalloc so valgrind sees Nim's
allocations, native debug info for usable traces) gating on memory
errors and definite leaks, and a CI job that runs it. Backs the
memory-safety claims with an actual memory checker.
The valgrind job becomes a two-job matrix. The nimble task stays the
single source of truth: it runs both memory managers by default and
honors VALGRIND_MM=arc|orc to run one, which is what each matrix job
sets.
Verified empirically that nimble exits 0 both when a task's exec fails
and when nimble test runs a failing suite, so the nimble-invoked steps
were decorative gates: a regression would have shown green. The test
job's orc step and both valgrind jobs now run nim/valgrind directly
(direct nim c -r propagates exit code 1, also verified). The nimble
valgrind task remains for local use with a comment warning it cannot
gate.
@cryo2010
cryo2010 merged commit 564add1 into main Jul 25, 2026
6 checks passed
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.

1 participant