From 61d2652ca4ea9667596cffd9a812c7a01eaf5fbe Mon Sep 17 00:00:00 2001 From: "Vic (Chun-Ju) Yang" Date: Tue, 7 Jan 2014 12:03:24 +0800 Subject: Dump stack trace on emulator test failure Emulator test failures are sometimes hard to debug, especially when the test is stuck somewhere and times out. Let's have the emulator dump stack trace when an assertion fails or a test times out. The produced stack trace is in this format: #0 build/host/kb_8042/kb_8042.exe() [0x412421] /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:104 #1 build/host/kb_8042/kb_8042.exe() [0x4124a9] /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:129 #2 build/host/kb_8042/kb_8042.exe(run_test+0x3a) [0x412e2c] /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:262 #3 build/host/kb_8042/kb_8042.exe(_run_test+0x11) [0x4061de] /home/victoryang/trunk/src/platform/ec/core/host/task.c:90 #4 build/host/kb_8042/kb_8042.exe(_task_start_impl+0x79) [0x406b72] /home/victoryang/trunk/src/platform/ec/core/host/task.c:408 #5 /lib64/libpthread.so.0(+0x70b1) [0x7f6dc2fa10b1] ??:0 #6 /lib64/libc.so.6(clone+0x6d) [0x7f6dc2cd8efd] ??:0 The file name and line number in the trace is generated by addr2line. BUG=chrome-os-partner:19235 chromium:331548 TEST=Put in a infinite loop in a test, and see stack trace when it times out. TEST=Add a failing assertion, and see stack trace when it fails. BRANCH=None Change-Id: I4494ffd1ebc98081ce40e860a146202084aa2a1e Signed-off-by: Vic (Chun-Ju) Yang Reviewed-on: https://chromium-review.googlesource.com/181730 --- util/run_host_test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/run_host_test b/util/run_host_test index ba59454527..a12c44053f 100755 --- a/util/run_host_test +++ b/util/run_host_test @@ -6,6 +6,7 @@ from cStringIO import StringIO import pexpect +import signal import sys import time @@ -39,7 +40,9 @@ def RunOnce(test_name, log, timeout_secs): child.close() raise finally: - child.kill(15) + if child.isalive(): + child.kill(signal.SIGTERM) + child.read() log = StringIO() tee_log = Tee(log) -- cgit v1.2.1