It is not desirable to apply valgrind to shell scripts or other non-binaries, because
There are two ways to avoid this:
TEST_EXTENSIONS = .pl .sh LOG_COMPILER = $(LOG_VALGRIND)
Then valgrind will only be used for the non-.sh and non-.pl tests.
For old automake (before 1.11.3), you will need AUTOMAKE_OPTIONS =
parallel-tests to enable the parallel test harness.
build-aux/run-test script from Gnulib.
Add these lines to your Makefile.am:
LOG_COMPILER += $(SHELL) $(top_srcdir)/build-aux/run-test '$(LOG_VALGRIND)'
Replace LOG_COMPILER with TESTS_ENVIRONMENT if you use the
old serial test harness.
However, with this measure in place, binaries invoked through scripts will
not be invoked under valgrind. This can be solved by defining environment
variables in the TESTS_ENVIRONMENT variable that are then used by the
shell scripts. For example, add the following:
TESTS_ENVIRONMENT = VALGRIND='$(LOG_VALGRIND)'
And then modify the shell scripts to invoke the binary prefixed with
$VALGRIND.