diff options
author | ojan@chromium.org <ojan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:50:19 +0000 |
---|---|---|
committer | ojan@chromium.org <ojan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:50:19 +0000 |
commit | b6150ec56296e8a8b99b19d1a4e0acadba9c9aa7 (patch) | |
tree | 818c093ec29d642eecc9eac13c442a2584a9717d /webkit | |
parent | c7cfaa98f8f558ccb94ce8a0dbd7057d99be17d5 (diff) | |
download | chromium_src-b6150ec56296e8a8b99b19d1a4e0acadba9c9aa7.zip chromium_src-b6150ec56296e8a8b99b19d1a4e0acadba9c9aa7.tar.gz chromium_src-b6150ec56296e8a8b99b19d1a4e0acadba9c9aa7.tar.bz2 |
1. Show crash stacks in run_webkit_tests.py stdio
2. Write the crash stack out to layout-test-results/LayoutTests/foo/bar-stack.txt
3. Add a link to the stack file in results.html
Review URL: http://codereview.chromium.org/346018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
3 files changed, 45 insertions, 30 deletions
diff --git a/webkit/tools/layout_tests/layout_package/test_failures.py b/webkit/tools/layout_tests/layout_package/test_failures.py index 981b1dd..6f1d807 100644 --- a/webkit/tools/layout_tests/layout_package/test_failures.py +++ b/webkit/tools/layout_tests/layout_package/test_failures.py @@ -4,6 +4,8 @@ """Classes for failures that occur during tests.""" +import os + class FailureSort(object): """A repository for failure sort orders and tool to facilitate sorting.""" @@ -43,6 +45,21 @@ class TestFailure(object): """Returns True if we should kill the test shell before the next test.""" return False + def RelativeOutputFilename(self, filename, modifier): + """Returns a relative filename inside the output dir that contains + modifier. + + For example, if filename is fast\dom\foo.html and modifier is + "-expected.txt", the return value is fast\dom\foo-expected.txt + + Args: + filename: relative filename to test file + modifier: a string to replace the extension of filename with + + Return: + The relative windows path to the output filename + """ + return os.path.splitext(filename)[0] + modifier class FailureWithType(TestFailure): """Base class that produces standard HTML output based on the test type. @@ -52,6 +69,7 @@ class FailureWithType(TestFailure): """ def __init__(self, test_type): TestFailure.__init__(self) + # TODO(ojan): This class no longer needs to know the test_type. self._test_type = test_type # Filename suffixes used by ResultHtmlOutput. @@ -70,8 +88,7 @@ class FailureWithType(TestFailure): string. """ links = [''] - uris = [self._test_type.RelativeOutputFilename(filename, fn) - for fn in out_names] + uris = [self.RelativeOutputFilename(filename, fn) for fn in out_names] if len(uris) > 1: links.append("<a href='%s'>expected</a>" % uris[1]) if len(uris) > 0: @@ -108,7 +125,8 @@ class FailureCrash(TestFailure): def ResultHtmlOutput(self, filename): # TODO(tc): create a link to the minidump file - return "<strong>%s</strong>" % self.Message() + stack = self.RelativeOutputFilename(filename, "-stack.txt") + return "<strong>%s</strong> <a href=%s>stack</a>" % (self.Message(), stack) def ShouldKillTestShell(self): return True diff --git a/webkit/tools/layout_tests/layout_package/test_shell_thread.py b/webkit/tools/layout_tests/layout_package/test_shell_thread.py index 44d4792..865cae8 100644 --- a/webkit/tools/layout_tests/layout_package/test_shell_thread.py +++ b/webkit/tools/layout_tests/layout_package/test_shell_thread.py @@ -24,7 +24,7 @@ import time 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 @@ def ProcessOutput(proc, test_info, test_types, test_args, target): 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 @@ def ProcessOutput(proc, test_info, test_types, test_args, target): 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 @@ def ProcessOutput(proc, test_info, test_types, test_args, target): # 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 @@ def ProcessOutput(proc, test_info, test_types, test_args, target): 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 @@ def ProcessOutput(proc, test_info, test_types, test_args, target): 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,10 +157,11 @@ class TestStats: 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 + output_dir: Directory to put crash stacks into. See TestShellThread for documentation of the remaining arguments. """ @@ -161,12 +172,13 @@ class SingleTestThread(threading.Thread): 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 @@ -357,7 +369,8 @@ class TestShellThread(threading.Thread): test_info, self._test_types, self._test_args, - self._options.target) + self._options.target, + self._options.results_directory) worker.start() @@ -416,7 +429,7 @@ class TestShellThread(threading.Thread): 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._options.results_directory) self._test_stats.append(stats) return stats.failures diff --git a/webkit/tools/layout_tests/test_types/test_type_base.py b/webkit/tools/layout_tests/test_types/test_type_base.py index 0fe0ec7..f41f5a6 100644 --- a/webkit/tools/layout_tests/test_types/test_type_base.py +++ b/webkit/tools/layout_tests/test_types/test_type_base.py @@ -102,22 +102,6 @@ class TestTypeBase(object): path_utils.RelativeTestFilename(filename)) return os.path.splitext(output_filename)[0] + modifier - def RelativeOutputFilename(self, filename, modifier): - """Returns a relative filename inside the output dir that contains - modifier. - - For example, if filename is fast\dom\foo.html and modifier is - "-expected.txt", the return value is fast\dom\foo-expected.txt - - Args: - filename: relative filename to test file - modifier: a string to replace the extension of filename with - - Return: - The relative windows path to the output filename - """ - return os.path.splitext(filename)[0] + modifier - def CompareOutput(self, filename, proc, output, test_args, target): """Method that compares the output from the test with the expected value. |