[folks] When a test would print a message >= warning, print a stack trace.
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] When a test would print a message >= warning, print a stack trace.
- Date: Tue, 11 Jan 2011 20:20:47 +0000 (UTC)
commit 56c99d93af9191ed47cb05d0daec8c11ed060ad7
Author: Travis Reitter <travis reitter collabora co uk>
Date: Mon Jan 10 16:40:14 2011 -0800
When a test would print a message >= warning, print a stack trace.
This is largely to benefit remote debugging of build bots but also makes
debugging test errors easier.
Helps bgo#639195 - Print stack traces for failed tests to improve
remote debugging
tests/lib/test-case.vala | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/tests/lib/test-case.vala b/tests/lib/test-case.vala
index 0015ef4..0ace778 100644
--- a/tests/lib/test-case.vala
+++ b/tests/lib/test-case.vala
@@ -68,9 +68,26 @@ public abstract class Folks.TestCase : Object {
}
public void set_up (void* fixture) {
+ Log.set_default_handler (this._log_func_stack_trace);
+
this.test_case.set_up ();
}
+ private void _log_func_stack_trace (string? log_domain,
+ LogLevelFlags log_levels,
+ string message) {
+ Log.default_handler (log_domain, log_levels, message);
+
+ /* Print a stack trace for any message at the warning level or above */
+ if ((log_levels &
+ (LogLevelFlags.LEVEL_WARNING | LogLevelFlags.LEVEL_ERROR |
+ LogLevelFlags.LEVEL_CRITICAL))
+ != 0) {
+ GLib.on_error_stack_trace ("libtool --mode=execute gdb");
+ }
+ }
+
+
public void run (void* fixture) {
this.test ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]