For some background see the writeup in #1217.
-
Install valgrind, headers, libs (on Fedora
sudo dnf install valgrind valgrind-devel valgrind-tools-devel
is enough). -
Run
cargo pgrx init --valgrind
. The only major downside to using this as your primary pgrx installation is that its slow, but you can still run without valgrind. -
Set
USE_VALGRIND
in the environment when running tests, for exampleUSE_VALGRIND=1 cargo test
. valgrind must be on the path for this to work. This is slow -- taking about 15 minutes on a very beefy cloud server, so manage your timing expectations accordingly.
TODO
For basic usage of electric fence or scudo, LD_PRELOAD=libefence.so cargo test
or LD_PRELOAD=libscudo.so cargo test
. More advanced usage (like GWP-ASAN) is still TODO.