Add a make valgrind target

Runs the existing suite with every fsnap invocation under memcheck,
rather than duplicating a list of commands in the Makefile: tests/run.sh
already funnels each call through fsnap(), so a command prefix is all it
takes. VALGRIND is empty for a plain `make test`.

-q keeps stderr clean, which matters because several tests compare it,
and --error-exitcode=99 turns a finding into a failing test instead of a
note nobody reads. The per-invocation timeout goes to 300s, since
memcheck costs an order of magnitude: the whole suite takes about 25
seconds against a fraction of a second without it.

Checked the same way as the suite itself. Dropping the free() of the
getline buffer in list keeps `make test` green at 91 passed while `make
valgrind` fails, which is the whole point of having it. Replacing the
calloc in RecordObjectNew with malloc is caught too, and named precisely:
free() on an uninitialised value at types.c:420. Baseline green either
side, and the missing-valgrind guard exits 2 with a clear message.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KyCHPAxWzqa3vHKdXJkgx
This commit is contained in:
Fabio Scotto di Santolo
2026-08-26 16:19:50 +02:00
parent aad607e5f0
commit 8c34ab4f4e
3 changed files with 29 additions and 4 deletions

View File

@@ -48,6 +48,11 @@ parser cases from §14 and §15 and the `diff` classifications. It is POSIX sh
with no dependencies, and skips rather than fails what the environment cannot
provide.
`make valgrind` runs that same suite with every invocation under memcheck,
which takes about 25 seconds against a fraction of a second for `make test`. It
reports a leak or an invalid access as a failed test rather than as a note in
the output, and exits 2 if valgrind is not installed.
`make install` copies the binary to `$(BINDIR)`, which defaults to
`/usr/local/bin`; `make uninstall` removes it again. Both honour `DESTDIR` for
staged installs: