From 0971f84c479b611706686779884fb0a850be9d57 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 8 Oct 2012 17:22:10 +0100 Subject: [PATCH] Add a hook to gather backtraces from failing tests Vaguely based on Mission Control patches from me and Jonny. Also document check-valgrind while I'm looking at tests/README. --- tests/Makefile.am | 11 +++++++++++ tests/README | 12 ++++++++++++ tests/dbus/Makefile.am | 10 ++++++++++ tools/Makefile.am | 2 ++ tools/run_and_bt.gdb | 7 +++++++ 5 files changed, 42 insertions(+) create mode 100644 tools/run_and_bt.gdb diff --git a/tests/Makefile.am b/tests/Makefile.am index f6397ae..59f87ef 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -66,6 +66,17 @@ check-valgrind: TESTS_ENVIRONMENT="$(VALGRIND_TESTS_ENVIRONMENT)" $(MAKE) -C dbus check-valgrind +tests_gdb = $(top_builddir)/libtool --mode=execute \ + gdb -return-child-result -batch \ + -x @abs_top_srcdir@/tools/run_and_bt.gdb \ + $(NULL) + +check-gdb: + $(MAKE) check-TESTS \ + TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(tests_gdb)' \ + $(NULL) + $(MAKE) -C dbus check-gdb + EXTRA_DIST = README \ all-errors-documented.py \ tests.supp diff --git a/tests/README b/tests/README index a7bcca7..0612345 100644 --- a/tests/README +++ b/tests/README @@ -20,3 +20,15 @@ make clean ./configure --enable-compiler-coverage make check make lcov-report + +Getting a backtrace from a test +=============================== + +make -C tests check-gdb + +Running tests under valgrind +============================ + +make -C tests check-valgrind + +(You can set extra valgrind options by setting VALGRIND_FLAGS.) diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am index 78ce997..1332c97 100644 --- a/tests/dbus/Makefile.am +++ b/tests/dbus/Makefile.am @@ -304,6 +304,16 @@ check-valgrind: maybe_gc_friendly=,gc-friendly \ TESTS_ENVIRONMENT="$(VALGRIND_TESTS_ENVIRONMENT)" +tests_gdb = $(top_builddir)/libtool --mode=execute \ + gdb -return-child-result -batch \ + -x @abs_top_srcdir@/tools/run_and_bt.gdb \ + $(NULL) + +check-gdb: + $(MAKE) check-TESTS \ + TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(tests_gdb)' \ + $(NULL) + include $(top_srcdir)/tools/valgrind.mk VALGRIND_TESTS_ENVIRONMENT = \ diff --git a/tools/Makefile.am b/tools/Makefile.am index 761ee03..5c5f0de 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -9,6 +9,7 @@ telepathy-glib-env: telepathy-glib-env.in Makefile if ENABLE_INSTALLED_TESTS toolsdir = @tpglibtestsdir@/tools tools_SCRIPTS = \ + run_and_bt.gdb \ with-session-bus.sh \ test-wrapper.sh \ libglibcodegen.py \ @@ -39,6 +40,7 @@ EXTRA_DIST = \ make-release-mail.py \ make-version-script.py \ manager-file.py \ + run_and_bt.gdb \ shave.mk \ telepathy.am \ telepathy-glib.supp \ diff --git a/tools/run_and_bt.gdb b/tools/run_and_bt.gdb new file mode 100644 index 0000000..201353f --- /dev/null +++ b/tools/run_and_bt.gdb @@ -0,0 +1,7 @@ +run +echo ---- [bt full] -------------------------------------------\n +bt full +echo -----[thread apply all bt full] --------------------------\n +thread apply all bt full +echo ----------------------------------------------------------\n +quit -- 1.7.10.4