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



commit 5bb947ec977551e45e1e0850ddc6e81f127ec664
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Feb 6 04:53:15 2011 -0800

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

 .gitignore           |    1 +
 Makefile.am          |    2 +-
 tests/Makefile.am    |    2 +-
 tests/Makefile.tests |   11 +++++++++++
 4 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ae4fc73..607bacc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,6 +67,7 @@ Makefile.in
 /stamp-h1
 /tests/*-report.html
 /tests/*-report.xml
+/tests/*/cgdump-*
 /tests/*/vgdump-*
 /tests/libpeas/engine
 /tests/libpeas/extension-c
diff --git a/Makefile.am b/Makefile.am
index b69b8f9..b7e1057 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-valgrind test-report perf-report full-report: all
+test test-gdb test-valgrind test-callgrind test-report perf-report full-report: all
 	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)
 
 demo: all
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9debc8f..db618c8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,7 +6,7 @@ if ENABLE_GTK
 SUBDIRS += libpeas-gtk
 endif
 
-test test-gdb test-valgrind:
+test test-gdb test-valgrind test-callgrind:
 	@for subdir in $(SUBDIRS) ; do \
 	   test "$$subdir" = "plugins" || \
 	   ( cd $$subdir && \
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 4315269..cf663c2 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -28,6 +28,17 @@ test-valgrind: $(TEST_PROGS)
 	     --log-file=vgdump-$$test_prog $$test_prog ; \
 	 done
 
+test-callgrind: $(TEST_PROGS)
+	@test -z "$(TEST_PROGS)" || \
+	 for test_prog in $(TEST_PROGS) ; do \
+	   if test -e cgdump-$$test_prog; then \
+	     unlink cgdump-$$test_prog; \
+	   fi ; \
+	   libtool --mode=execute valgrind --tool=callgrind \
+	     --callgrind-out-file=cgdump-$$test_prog \
+	     --log-file=/dev/null $$test_prog ; \
+	 done
+
 generate-report: $(TEST_PROGS)
 	@test -z "$(TEST_PROGS)" || \
 	 G_SLICE=debug-blocks $(GTESTER) $(GTESTER_ARGS) $(TEST_PROGS)



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