Skip to content

tests: make memcheck fail on valgrind errors and leaks - #910

Merged
viferga merged 2 commits into
metacall:developfrom
bhuvan-somisetty:memcheck-fail-on-leaks
Sep 26, 2026
Merged

viferga merged 2 commits into
metacall:developfrom
bhuvan-somisetty:memcheck-fail-on-leaks

Conversation

@bhuvan-somisetty

@bhuvan-somisetty bhuvan-somisetty commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Follow up to #909, as discussed with @viferga. Valgrind was exiting with the test's own exit code, so a test that leaks or does an invalid read still passed under make memcheck. This adds --error-exitcode=1 so those tests get marked as failed by ctest (the python valgrind job already does the same).

"Still reachable" memory isn't counted as an error by valgrind, so it doesn't fail anything. Those are the Defects: 1 you see on most metacall tests because of --show-reachable=yes, they stay as they are.

Tested locally with valgrind 3.26 on the core tests (mock loader only). The only one that fails now is metacall-path-overflow-test, which has 176 bytes definitely lost from loader_impl_allocate that we never saw before because it still passed. I'll look at that leak separately. MEMCHECK_TEST=adt-vector-test make memcheck still passes.

bhuvan-somisetty and others added 2 commits September 26, 2026 15:26
Valgrind always exited with the test's own exit code, so tests with
leaks or invalid accesses still passed under memcheck and the target
only failed when a test failed on its own. Add --error-exitcode=1 so
ctest marks those tests as failed, same as the python valgrind job.
Still reachable memory doesn't count as an error, so it won't fail.
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