tests: make memcheck fail on valgrind errors and leaks - #910
Merged
viferga merged 2 commits intoSep 26, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=1so 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: 1you 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 fromloader_impl_allocatethat we never saw before because it still passed. I'll look at that leak separately.MEMCHECK_TEST=adt-vector-test make memcheckstill passes.