Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: webkit/tools/layout_tests/layout_package/test_shell_thread.py

Issue 346018: 1. Show crash stacks in run_webkit_tests.py stdio... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/tools/layout_tests/layout_package/test_shell_thread.py
===================================================================
--- webkit/tools/layout_tests/layout_package/test_shell_thread.py (revision 30489)
+++ webkit/tools/layout_tests/layout_package/test_shell_thread.py (working copy)
@@ -24,7 +24,7 @@
import path_utils
import test_failures
-def ProcessOutput(proc, test_info, test_types, test_args, target):
+def ProcessOutput(proc, test_info, test_types, test_args, target, output_dir):
"""Receives the output from a test_shell process, subjects it to a number
of tests, and returns a list of failure types the test produced.
@@ -34,6 +34,7 @@
test_types: list of test types to subject the output to
test_args: arguments to be passed to each test
target: Debug or Release
+ output_dir: directory to put crash stack traces into
Returns: a list of failure objects and times for the test being processed
"""
@@ -51,7 +52,8 @@
line = proc.stdout.readline()
# Only start saving output lines once we've loaded the URL for the test.
- hit_load_url = False
+ url = None
+ test_string = test_info.uri.strip()
while line.rstrip() != "#EOF":
# Make sure we haven't crashed.
@@ -73,8 +75,6 @@
# Don't include #URL lines in our output
if line.startswith("#URL:"):
- hit_load_url = True
- test_string = test_info.uri.strip()
url = line.rstrip()[5:]
if url != test_string:
logging.fatal("Test got out of sync:\n|%s|\n|%s|" %
@@ -85,7 +85,7 @@
elif line.startswith("#TEST_TIMED_OUT"):
# Test timed out, but we still need to read until #EOF.
failures.append(test_failures.FailureTimeout())
- elif hit_load_url:
+ elif url:
outlines.append(line)
else:
extra_lines.append(line)
@@ -95,8 +95,18 @@
end_test_time = time.time()
if len(extra_lines):
- logging.warning("Previous test output extra lines after dump:\n%s" % (
- "".join(extra_lines)))
+ extra = "".join(extra_lines)
+ if crash:
+ logging.info("Stacktrace for %s:\n%s" % (test_string, extra))
+ # Strip off "file://" since RelativeTestFilename expects filesystem paths.
+ filename = os.path.join(output_dir,
+ path_utils.RelativeTestFilename(test_string[7:]))
+ filename = os.path.splitext(filename)[0] + "-stack.txt"
+ path_utils.MaybeMakeDirectory(os.path.split(filename)[0])
+ open(filename, "wb").write(extra)
+ else:
+ logging.warning("Previous test output extra lines after dump:\n%s" %
+ extra)
# Check the output and save the results.
time_for_diffs = {}
@@ -147,7 +157,7 @@
class SingleTestThread(threading.Thread):
"""Thread wrapper for running a single test file."""
def __init__(self, test_shell_command, shell_args, test_info, test_types,
- test_args, target):
+ test_args, target, output_dir):
"""
Args:
test_info: Object containing the test filename, uri and timeout
@@ -161,12 +171,13 @@
self._test_types = test_types
self._test_args = test_args
self._target = target
+ self._output_dir = output_dir
def run(self):
proc = StartTestShell(self._command, self._shell_args +
["--time-out-ms=" + self._test_info.timeout, self._test_info.uri])
self._test_stats = ProcessOutput(proc, self._test_info, self._test_types,
- self._test_args, self._target)
+ self._test_args, self._target, self._output_dir)
def GetTestStats(self):
return self._test_stats
@@ -174,7 +185,7 @@
class TestShellThread(threading.Thread):
def __init__(self, filename_list_queue, test_shell_command, test_types,
- test_args, shell_args, options):
+ test_args, shell_args, output_dir, options):
"""Initialize all the local state for this test shell thread.
Args:
@@ -184,6 +195,7 @@
test_types: A list of TestType objects to run the test output against.
test_args: A TestArguments object to pass to each TestType.
shell_args: Any extra arguments to be passed to test_shell.exe.
+ output_dir: Directory to put crash stacks into.
options: A property dictionary as produced by optparse. The command-line
options should match those expected by run_webkit_tests; they
are typically passed via the run_webkit_tests.TestRunner class.
@@ -196,6 +208,7 @@
self._test_args = test_args
self._test_shell_proc = None
self._shell_args = shell_args
+ self._output_dir = output_dir
tony 2009/10/29 23:13:51 Nit: Maybe just use options.results_directory rath
self._options = options
self._failures = {}
self._canceled = False
@@ -357,7 +370,8 @@
test_info,
self._test_types,
self._test_args,
- self._options.target)
+ self._options.target,
+ self._output_dir)
worker.start()
@@ -416,7 +430,7 @@
self._test_shell_proc.stdin.flush()
stats = ProcessOutput(self._test_shell_proc, test_info, self._test_types,
- self._test_args, self._options.target)
+ self._test_args, self._options.target, self._output_dir)
self._test_stats.append(stats)
return stats.failures
« no previous file with comments | « webkit/tools/layout_tests/layout_package/test_failures.py ('k') | webkit/tools/layout_tests/run_webkit_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698