build system: option for running unit tests with valgrind

This commit is contained in:
Moritz Bunkus 2017-12-18 22:02:50 +01:00
parent 89ee5e50f3
commit 0fc23cd7bd
3 changed files with 9 additions and 0 deletions

View File

@ -27,3 +27,4 @@ AC_DEFUN([AX_GTEST],[
])
AX_GTEST
AC_PATH_PROG(VALGRIND, valgrind,, $PATH)

View File

@ -66,6 +66,7 @@ RANLIB = @RANLIB@
RCC = @RCC@
STRIP = @STRIP@
UIC = @UIC@
VALGRIND = @VALGRIND@
WINDRES = @WINDRES@
# Variable stuff as set by configure

View File

@ -11,6 +11,13 @@ namespace :tests do
task :run_unit => 'tests:unit' do
$gtest_apps.each { |app| run "LC_ALL=C ./tests/unit/#{app}/#{app}" }
end
if !c(:VALGRIND).to_s.empty?
desc "Build and run the unit tests under valgrind's memcheck"
task :run_valgrind_unit => 'tests:unit' do
$gtest_apps.each { |app| run "LC_ALL=C #{c(:VALGRIND)} --tool=memcheck --num-callers=12 ./tests/unit/#{app}/#{app}" }
end
end
end
$build_system_modules[:gtest] = {