Skip to content

Using Valgrind to detect memory leaks and other errors

Stefan Berger edited this page Oct 5, 2021 · 7 revisions

The following sequence of commands is useful for running the test suite with valgrind:

> ./autogen.sh --prefix=/usr --without-seccomp
> make
# The following must pass without errors
> make check
> sudo make install
# Depending on swtpm version, some non-memory leak related errors are expected; check logfiles
> sudo SWTPM_EXE="valgrind --leak-check=full -q --track-origins=yes /bin/swtpm" \
    SWTPM_IOCTL="valgrind --leak-check=full -q --track-origins=yes /bin/swtpm_ioctl" \
    SWTPM_BIOS="valgrind --leak-check=full -q --track-origins=yes /bin/swtpm_bios" \
    SWTPM_CERT="valgrind --leak-check=full -q --track-origins=yes /bin/swtpm_cert" \
    make check
> grep -E "^==[[:digit:]]" ./tests/*.log