[libpeas] Added check for gdb and valgrind for test-gdb and test-valgrind



commit db510cf8a4e6b33601642b64ee9c7b9a830645e5
Author: Garrett Regier <alias301 gmail com>
Date:   Sat Mar 5 06:42:08 2011 -0800

    Added check for gdb and valgrind for test-gdb and test-valgrind

 Makefile.am          |   26 +++++++++++++++++++++++++-
 configure.ac         |   20 ++++++++++++++++++++
 tests/Makefile.am    |    3 ++-
 tests/Makefile.tests |   20 +++++++++++++++++++-
 4 files changed, 66 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f5d5729..0eefef5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,9 +26,33 @@ dist-hook:
 		echo A git clone is required to generate a ChangeLog >&2; \
 	fi
 
-test test-gdb test-valgrind test-callgrind test-report perf-report full-report: all
+test test-report perf-report full-report: all
 	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)
 
+if GDB_ENABLED
+
+test-gdb:
+	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)
+
+else
+
+test-gdb:
+	@echo "You need to GDB"
+
+endif # GDB_ENABLED
+
+if VALGRIND_ENABLED
+
+test-valgrind test-callgrind:
+	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)
+
+else
+
+test-valgrind test-callgrind:
+	@echo "You need to Valgrind"
+
+endif # VALGRIND_ENABLED
+
 demo: all
 	@cd peas-demo && $(MAKE) $(AM_MAKEFLAGS) $(@)
 
diff --git a/configure.ac b/configure.ac
index 3cdb0d9..1b67a31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,26 @@ if test "$os_osx" = "yes"; then
 fi
 
 dnl ================================================================
+dnl Check for GDB
+dnl ================================================================
+
+if test "x$GCC" = "xno"; then
+  enable_gdb=no
+else
+  AC_PATH_PROG([enable_gdb], [gdb], [no])
+fi
+
+AM_CONDITIONAL([GDB_ENABLED], [test "x$enable_gdb" != "xno"])
+
+dnl ================================================================
+dnl Check for Valgrind
+dnl ================================================================
+
+AC_PATH_PROG([enable_valgrind], [valgrind], [no])
+
+AM_CONDITIONAL([VALGRIND_ENABLED], [test "x$enable_valgrind" != "xno"])
+
+dnl ================================================================
 dnl Coverage testing
 dnl ================================================================
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ba63eb9..619f975 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,7 +65,8 @@ test-report perf-report full-report:
 	 $(GTESTER_REPORT) $  xml >$  html ; \
 	 rm -rf "$$GTESTER_LOGDIR" ;
 
-.PHONY: test test-gdb test-valgrind test-report perf-report full-report
+.PHONY: test test-gdb test-valgrind test-callgrind \
+	test-report perf-report full-report
 
 check-local: test
 
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 03f6e66..22406d4 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -6,6 +6,8 @@ test: $(TEST_PROGS)
 	@test -z "$(TEST_PROGS)" || \
 	 G_SLICE=debug-blocks $(GTESTER) --verbose $(TEST_PROGS)
 
+if GDB_ENABLED
+
 test-gdb: $(TEST_PROGS)
 	@test -z "$(TEST_PROGS)" || \
 	 for test_prog in $(TEST_PROGS) ; do \
@@ -16,6 +18,15 @@ test-gdb: $(TEST_PROGS)
 	   } \
 	 done
 
+else
+
+test-gdb:
+	@echo "You need GDB"
+
+endif # GDB_ENABLED
+
+if VALGRIND_ENABLED
+
 test-valgrind: $(TEST_PROGS)
 	@test -z "$(TEST_PROGS)" || \
 	 for test_prog in $(TEST_PROGS) ; do \
@@ -28,7 +39,7 @@ test-valgrind: $(TEST_PROGS)
 	     --log-file=vgdump-$$test_prog $$test_prog ; \
 	 done
 
-test-callgrind: $(TEST_PROGS)
+test-callgrind:
 	@test -z "$(TEST_PROGS)" || \
 	 for test_prog in $(TEST_PROGS) ; do \
 	   if test -e cgdump-$$test_prog; then \
@@ -39,6 +50,13 @@ test-callgrind: $(TEST_PROGS)
 	     --log-file=/dev/null $$test_prog ; \
 	 done
 
+else
+
+test-valgrind test-callgrind:
+	@echo "You need to Valgrind"
+
+endif # VALGRIND_ENABLED
+
 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]