Use valgrind.h to query whether the test suite is run in valgrind
Currently the test suite sets the USING_VALGRING=1
environment variable. That's not automatically the case when run manually though, causing some confusing errors. The valgrind documentation describes what's available to programs, basically seems to down to
#include <valgrind.h>
if (RUNNING_ON_VALGRIND) {
// do stuff
}
Also noteworthy from the valgrind docs linked above:
You are encouraged to copy the valgrind/*.h headers into your project's include directory, so your program doesn't have a compile-time dependency on Valgrind being installed. The Valgrind headers, unlike most of the rest of the code, are under a BSD-style license so you may include them without worrying about license incompatibility.
This needs to be investigated whether it is worth the effort