Changeset 69740 in webkit


Ignore:
Timestamp:
Oct 13, 2010 10:54:06 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-10-13 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Break LayoutTestResults out into its own file
https://bugs.webkit.org/show_bug.cgi?id=47637

  • Scripts/webkitpy/common/net/buildbot.py:
  • Scripts/webkitpy/common/net/buildbot_unittest.py:
  • Scripts/webkitpy/common/net/layouttestresults.py: Added.
  • Scripts/webkitpy/common/net/layouttestresults_unittest.py: Added.
Location:
trunk/WebKitTools
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r69738 r69740  
     12010-10-13  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Break LayoutTestResults out into its own file
     6        https://bugs.webkit.org/show_bug.cgi?id=47637
     7
     8        * Scripts/webkitpy/common/net/buildbot.py:
     9        * Scripts/webkitpy/common/net/buildbot_unittest.py:
     10        * Scripts/webkitpy/common/net/layouttestresults.py: Added.
     11        * Scripts/webkitpy/common/net/layouttestresults_unittest.py: Added.
     12
    1132010-10-13  Adam Barth  <abarth@webkit.org>
    214
  • trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot.py

    r68823 r69740  
    3636
    3737from webkitpy.common.net.failuremap import FailureMap
     38from webkitpy.common.net.layouttestresults import LayoutTestResults
    3839from webkitpy.common.net.regressionwindow import RegressionWindow
    3940from webkitpy.common.system.logutils import get_logger
    4041from webkitpy.thirdparty.autoinstalled.mechanize import Browser
    4142from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
    42 
    4343
    4444_log = get_logger(__file__)
     
    197197
    198198
    199 # FIXME: This should be unified with all the layout test results code in the layout_tests package
    200 class LayoutTestResults(object):
    201     stderr_key = u'Tests that had stderr output:'
    202     fail_key = u'Tests where results did not match expected results:'
    203     timeout_key = u'Tests that timed out:'
    204     crash_key = u'Tests that caused the DumpRenderTree tool to crash:'
    205     missing_key = u'Tests that had no expected results (probably new):'
    206 
    207     expected_keys = [
    208         stderr_key,
    209         fail_key,
    210         crash_key,
    211         timeout_key,
    212         missing_key,
    213     ]
    214 
    215     @classmethod
    216     def _parse_results_html(cls, page):
    217         parsed_results = {}
    218         tables = BeautifulSoup(page).findAll("table")
    219         for table in tables:
    220             table_title = unicode(table.findPreviousSibling("p").string)
    221             if table_title not in cls.expected_keys:
    222                 # This Exception should only ever be hit if run-webkit-tests changes its results.html format.
    223                 raise Exception("Unhandled title: %s" % table_title)
    224             # We might want to translate table titles into identifiers before storing.
    225             parsed_results[table_title] = [unicode(row.find("a").string) for row in table.findAll("tr")]
    226 
    227         return parsed_results
    228 
    229     @classmethod
    230     def _fetch_results_html(cls, base_url):
    231         results_html = "%s/results.html" % base_url
    232         # FIXME: We need to move this sort of 404 logic into NetworkTransaction or similar.
    233         try:
    234             page = urllib2.urlopen(results_html)
    235             return cls._parse_results_html(page)
    236         except urllib2.HTTPError, error:
    237             if error.code != 404:
    238                 raise
    239 
    240     @classmethod
    241     def results_from_url(cls, base_url):
    242         parsed_results = cls._fetch_results_html(base_url)
    243         if not parsed_results:
    244             return None
    245         return cls(base_url, parsed_results)
    246 
    247     def __init__(self, base_url, parsed_results):
    248         self._base_url = base_url
    249         self._parsed_results = parsed_results
    250 
    251     def parsed_results(self):
    252         return self._parsed_results
    253 
    254     def failing_tests(self):
    255         failing_keys = [self.fail_key, self.crash_key, self.timeout_key]
    256         return sorted(sum([tests for key, tests in self._parsed_results.items() if key in failing_keys], []))
    257 
    258 
    259199class Build(object):
    260200    def __init__(self, builder, build_number, revision, is_green):
  • trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py

    r68495 r69740  
    3030
    3131from webkitpy.common.net.buildbot import BuildBot, Builder, Build, LayoutTestResults
    32 
    3332from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
    3433
     
    113112        for filename, revision_and_build in expectations.items():
    114113            self.assertEqual(self.builder._revision_and_build_for_filename(filename), revision_and_build)
    115 
    116 
    117 class LayoutTestResultsTest(unittest.TestCase):
    118     _example_results_html = """
    119 <html>
    120 <head>
    121 <title>Layout Test Results</title>
    122 </head>
    123 <body>
    124 <p>Tests that had stderr output:</p>
    125 <table>
    126 <tr>
    127 <td><a href="/var/lib/buildbot/build/gtk-linux-64-release/build/LayoutTests/accessibility/aria-activedescendant-crash.html">accessibility/aria-activedescendant-crash.html</a></td>
    128 <td><a href="accessibility/aria-activedescendant-crash-stderr.txt">stderr</a></td>
    129 </tr>
    130 <td><a href="/var/lib/buildbot/build/gtk-linux-64-release/build/LayoutTests/http/tests/security/canvas-remote-read-svg-image.html">http/tests/security/canvas-remote-read-svg-image.html</a></td>
    131 <td><a href="http/tests/security/canvas-remote-read-svg-image-stderr.txt">stderr</a></td>
    132 </tr>
    133 </table><p>Tests that had no expected results (probably new):</p>
    134 <table>
    135 <tr>
    136 <td><a href="/var/lib/buildbot/build/gtk-linux-64-release/build/LayoutTests/fast/repaint/no-caret-repaint-in-non-content-editable-element.html">fast/repaint/no-caret-repaint-in-non-content-editable-element.html</a></td>
    137 <td><a href="fast/repaint/no-caret-repaint-in-non-content-editable-element-actual.txt">result</a></td>
    138 </tr>
    139 </table></body>
    140 </html>
    141 """
    142 
    143     _expected_layout_test_results = {
    144         'Tests that had stderr output:' : [
    145             'accessibility/aria-activedescendant-crash.html'
    146         ],
    147         'Tests that had no expected results (probably new):' : [
    148             'fast/repaint/no-caret-repaint-in-non-content-editable-element.html'
    149         ]
    150     }
    151     def test_parse_layout_test_results(self):
    152         results = LayoutTestResults._parse_results_html(self._example_results_html)
    153         self.assertEqual(self._expected_layout_test_results, results)
    154114
    155115
Note: See TracChangeset for help on using the changeset viewer.