Skip to content

Using Valgrind to detect memory leaks and other errors

Stefan Berger edited this page Nov 18, 2019 · 7 revisions

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

> ./autogen.sh --prefix=/usr
> make
# The following must pass without errors
> make check
> sudo make install
# Some tests may not pass when running with valgrind, so some test errors are expected:
> 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" \
    make check
> grep -E "^==[[:digit:]]" ./tests/*.log