I didn't get to this before you committed it, and that's OK.
I had some tiny style quibbles. Mostly it just seemed to me
that at least the lower layers of this where it's really just
a generic "command prefix before running a binary" should be
named generically. That could be plumbed all the way up to
configure, as --enable-tests-prefix="...". Then you can add
--enable-tests-valgrind as a shorthand for a particular value
of the prefix.
The log entry mentions valgrind-wrapper.sh but no such file nor
use of it appears in the patch.