TESTSUITE = $(srcdir)/tests/testsuite
DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
+AUTOTEST_PATH = tests/data:tests/language/lexer:tests/libpspp:tests/output:src/ui/terminal
$(srcdir)/tests/testsuite.at: tests/testsuite.in tests/automake.mk
cp $< $@
CHECK_LOCAL += tests_check
tests_check: tests/atconfig tests/atlocal $(TESTSUITE) $(check_PROGRAMS)
- $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=tests/data:tests/language/lexer:tests/libpspp:tests/output:src/ui/terminal $(TESTSUITEFLAGS)
+ $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
CLEAN_LOCAL += tests_clean
tests_clean:
echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])'; \
} >'$(srcdir)/package.m4'
+\f
+# valgrind support for Autotest testsuite
+
+valgrind_wrappers = \
+ tests/valgrind/pspp \
+ tests/valgrind/render-test
+
+$(valgrind_wrappers): tests/valgrind-wrapper.in
+ @test -d tests/valgrind || mkdir tests/valgrind
+ sed -e 's,[@]wrap_program[@],$@,' \
+ $(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp
+ chmod +x $@.tmp
+ mv $@.tmp $@
+CLEANFILES += $(valgrind_wrappers)
+EXTRA_DIST += tests/valgrind-wrapper.in
+
+VALGRIND = $(SHELL) $(abs_top_builddir)/libtool --mode=execute valgrind --log-file=valgrind.%p --leak-check=full --num-callers=20
+check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) $(valgrind_wrappers)
+ $(SHELL) '$(TESTSUITE)' -C tests VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
+ @echo
+ @echo '--------------------------------'
+ @echo 'Valgrind output is in:'
+ @echo 'tests/testsuite.dir/*/valgrind.*'
+ @echo '--------------------------------'
--- /dev/null
+#! /bin/sh
+
+program=`basename "$0"`
+
+new_PATH=
+save_IFS=$IFS
+IFS=:
+found=no
+for dir in $PATH; do
+ IFS=$save_IFS
+ if test "X$dir" = X; then
+ dir=.
+ fi
+ if test -x "$dir/$program"; then
+ if test $found = no; then
+ found=yes
+ continue
+ else
+ if test "X$next_program" = X; then
+ next_program=$dir/$program
+ fi
+ fi
+ fi
+done
+IFS=$save_IFS
+
+if test $found = no; then
+ echo "$0: $program not found in PATH ($PATH)" >&2
+ exit 1
+elif test "X$next_program" = X; then
+ echo "$0: $program found only once in PATH ($PATH)" >&2
+ exit 1
+fi
+
+: ${VALGRIND:=libtool --mode=execute valgrind --log-file=valgrind.%p --leak-check=full --num-callers=20}
+exec $VALGRIND $next_program "$@"
+echo "$0: $VALGRIND $wrap_program $* failed" >&2
+exit 1