[libpeas] Add a make rule for running the tests under valgrind



commit 68af2550b2a8e8987110194c0723cf0c074c3ed7
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Jan 16 12:49:53 2011 -0800

    Add a make rule for running the tests under valgrind
    
    The rule runs all the tests under valgrind with the appropriate enviroment
    variables and options set and the log is saved to vgdump-$$test_prog.

 .gitignore           |    1 +
 Makefile.am          |    2 +-
 tests/Makefile.am    |    4 ++--
 tests/Makefile.tests |   14 ++++++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1472cab..b5611c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,6 +67,7 @@ Makefile.in
 /stamp-h1
 /tests/*-report.html
 /tests/*-report.xml
+/tests/*/vgdump-*
 /tests/libpeas/engine
 /tests/libpeas/extension
 /tests/libpeas/extension-set
diff --git a/Makefile.am b/Makefile.am
index 578de23..e02ffb5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,7 @@ dist-hook:
 		echo A git clone is required to generate a ChangeLog >&2; \
 	fi
 
-test test-gdb test-report perf-report full-report: all
+test test-gdb test-valgrind test-report perf-report full-report: all
 	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)
 
 .PHONY: all test test-gdb test-report perf-report full-report
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bbbf499..d146040 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,7 +6,7 @@ if ENABLE_GTK
 SUBDIRS += libpeas-gtk
 endif
 
-test test-gdb:
+test test-gdb test-valgrind:
 	@for subdir in $(SUBDIRS) ; do \
 	   test "$$subdir" = "plugins" || \
 	   ( cd $$subdir && \
@@ -65,7 +65,7 @@ test-report perf-report full-report:
 	 $(GTESTER_REPORT) $  xml >$  html ; \
 	 rm -rf "$$GTESTER_LOGDIR" ;
 
-.PHONY: test test-gdb test-report perf-report full-report
+.PHONY: test test-gdb test-valgrind test-report perf-report full-report
 
 check-local: test
 
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index a121a2e..e725fee 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -15,6 +15,20 @@ test-gdb: $(TEST_PROGS)
 	   } \
 	 done
 
+test-valgrind: $(TEST_PROGS)
+	@test -z "$(TEST_PROGS)" || \
+	 for test_prog in $(TEST_PROGS) ; do \
+	   if test -e vgdump-$$test_prog; then \
+	     unlink vgdump-$$test_prog; \
+	   fi ; \
+	   G_SLICE=always-malloc G_DEBUG=gc-friendly,resident-modules \
+	     libtool --mode=execute valgrind --leak-check=full \
+	     --leak-resolution=high --num-callers=20 \
+	     --log-file=vgdump-$$test_prog $$test_prog ; \
+	 done
+
 generate-report: $(TEST_PROGS)
 	@test -z "$(TEST_PROGS)" || \
 	 $(GTESTER) $(GTESTER_ARGS) $(TEST_PROGS)
+
+CLEANFILES = vgdump-*



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]