diff options
Diffstat (limited to 'Tools/Scripts/webkitpy/common/net')
5 files changed, 115 insertions, 19 deletions
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/__init__.py b/Tools/Scripts/webkitpy/common/net/bugzilla/__init__.py index cfaf3b1..bde67c6 100644 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/__init__.py +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/__init__.py @@ -2,7 +2,7 @@ # We only export public API here. # FIXME: parse_bug_id should not be a free function. -from .bugzilla import Bugzilla, parse_bug_id +from .bugzilla import Bugzilla, parse_bug_id, parse_bug_id_from_changelog # Unclear if Bug and Attachment need to be public classes. from .bug import Bug from .attachment import Attachment diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py index 17a8515..8daf92e 100644 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py @@ -53,22 +53,34 @@ from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup, SoupStrainer def parse_bug_id(message): if not message: return None - match = re.search("http\://webkit\.org/b/(?P<bug_id>\d+)", message) + match = re.search(Bugzilla.bug_url_short, message) if match: return int(match.group('bug_id')) - match = re.search( - Bugzilla.bug_server_regex + "show_bug\.cgi\?id=(?P<bug_id>\d+)", - message) + match = re.search(Bugzilla.bug_url_long, message) if match: return int(match.group('bug_id')) return None +# FIXME: parse_bug_id_from_changelog should not be a free function. +# Parse the bug ID out of a Changelog message based on the format that is +# used by prepare-ChangeLog +def parse_bug_id_from_changelog(message): + if not message: + return None + match = re.search("^\s*" + Bugzilla.bug_url_short + "$", message, re.MULTILINE) + if match: + return int(match.group('bug_id')) + match = re.search("^\s*" + Bugzilla.bug_url_long + "$", message, re.MULTILINE) + if match: + return int(match.group('bug_id')) + return None + def timestamp(): return datetime.now().strftime("%Y%m%d%H%M%S") -# A container for all of the logic for making and parsing buzilla queries. +# A container for all of the logic for making and parsing bugzilla queries. class BugzillaQueries(object): def __init__(self, bugzilla): @@ -210,6 +222,8 @@ class Bugzilla(object): bug_server_host = "bugs.webkit.org" bug_server_regex = "https?://%s/" % re.sub('\.', '\\.', bug_server_host) bug_server_url = "https://%s/" % bug_server_host + bug_url_long = bug_server_regex + r"show_bug\.cgi\?id=(?P<bug_id>\d+)(&ctype=xml)?" + bug_url_short = r"http\://webkit\.org/b/(?P<bug_id>\d+)" def quips(self): # We only fetch and parse the list of quips once per instantiation diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py index 1d08ca5..2e75ca9 100644 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py @@ -30,7 +30,7 @@ import unittest import datetime import StringIO -from .bugzilla import Bugzilla, BugzillaQueries, parse_bug_id +from .bugzilla import Bugzilla, BugzillaQueries, parse_bug_id, parse_bug_id_from_changelog from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.tool.mocktool import MockBrowser @@ -192,6 +192,33 @@ ZEZpbmlzaExvYWRXaXRoUmVhc29uOnJlYXNvbl07Cit9CisKIEBlbmQKIAogI2VuZGlmCg== }], } + def test_parse_bug_id_from_changelog(self): + commit_text = ''' +2011-03-23 Ojan Vafai <ojan@chromium.org> + + Add failing result for WebKit2. All tests that require + focus fail on WebKit2. See https://bugs.webkit.org/show_bug.cgi?id=56988. + + * platform/mac-wk2/fast/css/pseudo-any-expected.txt: Added. + + ''' + + self.assertEquals(None, parse_bug_id_from_changelog(commit_text)) + + commit_text = ''' +2011-03-23 Ojan Vafai <ojan@chromium.org> + + Add failing result for WebKit2. All tests that require + focus fail on WebKit2. See https://bugs.webkit.org/show_bug.cgi?id=56988. + https://bugs.webkit.org/show_bug.cgi?id=12345 + + * platform/mac-wk2/fast/css/pseudo-any-expected.txt: Added. + + ''' + + self.assertEquals(12345, parse_bug_id_from_changelog(commit_text)) + + # FIXME: This should move to a central location and be shared by more unit tests. def _assert_dictionaries_equal(self, actual, expected): # Make sure we aren't parsing more or less than we expect diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py index 9dd165c..d23a6cc 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py @@ -42,9 +42,11 @@ import urllib2 from webkitpy.common.net.failuremap import FailureMap from webkitpy.common.net.layouttestresults import LayoutTestResults from webkitpy.common.net.regressionwindow import RegressionWindow +from webkitpy.common.net.testoutputset import TestOutputSet from webkitpy.common.system.logutils import get_logger -from webkitpy.thirdparty.autoinstalled.mechanize import Browser +from webkitpy.common.system.zipfileset import ZipFileSet from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup +from webkitpy.thirdparty.autoinstalled.mechanize import Browser _log = get_logger(__file__) @@ -92,6 +94,12 @@ class Builder(object): self._builds_cache[build_number] = build return build + def latest_cached_build(self): + revision_build_pairs = self.revision_build_pairs_with_results() + revision_build_pairs.sort(key=lambda i: i[1]) + latest_build_number = revision_build_pairs[-1][1] + return self.build(latest_build_number) + def force_build(self, username="webkit-patch", comments=None): def predicate(form): try: @@ -221,6 +229,12 @@ class Build(object): results_directory = "r%s (%s)" % (self.revision(), self._number) return "%s/%s" % (self._builder.results_url(), urllib.quote(results_directory)) + def results_zip_url(self): + return "%s.zip" % self.results_url() + + def results(self): + return TestOutputSet(self._builder.name(), None, ZipFileSet(self.results_zip_url()), include_expected=False) + def _fetch_results_html(self): results_html = "%s/results.html" % (self.results_url()) # FIXME: This should use NetworkTransaction's 404 handling instead. @@ -268,8 +282,10 @@ class BuildBot(object): "SnowLeopard.*Build", "SnowLeopard.*\(Test", "SnowLeopard.*\(WebKit2 Test", - "Leopard.*Release", + "Leopard.*", "Windows.*Build", + "Windows.*\(Test", + "WinCairo", "WinCE", "EFL", "GTK.*32", diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py index 6addb56..300bc88 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py @@ -231,32 +231,37 @@ class BuildBotTest(unittest.TestCase): {'name': u'SnowLeopard Intel Release (WebKit2 Tests)', }, {'name': u'SnowLeopard Intel Leaks', }, {'name': u'Windows Release (Build)', }, - {'name': u'Windows Release (Tests)', }, + {'name': u'Windows 7 Release (Tests)', }, {'name': u'Windows Debug (Build)', }, - {'name': u'Windows Debug (Tests)', }, + {'name': u'Windows XP Debug (Tests)', }, + {'name': u'Windows 7 Release (WebKit2 Tests)', }, {'name': u'GTK Linux 32-bit Release', }, {'name': u'GTK Linux 32-bit Debug', }, {'name': u'GTK Linux 64-bit Debug', }, - {'name': u'GTK Linux 64-bit Release', }, {'name': u'Qt Linux Release', }, {'name': u'Qt Linux Release minimal', }, {'name': u'Qt Linux ARMv7 Release', }, {'name': u'Qt Windows 32-bit Release', }, {'name': u'Qt Windows 32-bit Debug', }, - {'name': u'Chromium Linux Release', }, - {'name': u'Chromium Mac Release', }, {'name': u'Chromium Win Release', }, - {'name': u'Chromium Linux Release (Tests)', }, - {'name': u'Chromium Mac Release (Tests)', }, + {'name': u'Chromium Mac Release', }, + {'name': u'Chromium Linux Release', }, {'name': u'Chromium Win Release (Tests)', }, + {'name': u'Chromium Mac Release (Tests)', }, + {'name': u'Chromium Linux Release (Tests)', }, {'name': u'New run-webkit-tests', }, + {'name': u'WinCairo Debug (Build)', }, + {'name': u'WinCE Release (Build)', }, + {'name': u'EFL Linux Release (Build)', }, ] name_regexps = [ "SnowLeopard.*Build", "SnowLeopard.*\(Test", "SnowLeopard.*\(WebKit2 Test", - "Leopard.*Release", + "Leopard.*", "Windows.*Build", + "Windows.*\(Test", + "WinCairo", "WinCE", "EFL", "GTK.*32", @@ -267,11 +272,15 @@ class BuildBotTest(unittest.TestCase): expected_builders = [ {'name': u'Leopard Intel Release (Build)', }, {'name': u'Leopard Intel Release (Tests)', }, + {'name': u'Leopard Intel Debug (Build)', }, + {'name': u'Leopard Intel Debug (Tests)', }, {'name': u'SnowLeopard Intel Release (Build)', }, {'name': u'SnowLeopard Intel Release (Tests)', }, {'name': u'SnowLeopard Intel Release (WebKit2 Tests)', }, {'name': u'Windows Release (Build)', }, + {'name': u'Windows 7 Release (Tests)', }, {'name': u'Windows Debug (Build)', }, + {'name': u'Windows XP Debug (Tests)', }, {'name': u'GTK Linux 32-bit Release', }, {'name': u'GTK Linux 32-bit Debug', }, {'name': u'GTK Linux 64-bit Debug', }, @@ -280,9 +289,12 @@ class BuildBotTest(unittest.TestCase): {'name': u'Qt Linux ARMv7 Release', }, {'name': u'Qt Windows 32-bit Release', }, {'name': u'Qt Windows 32-bit Debug', }, - {'name': u'Chromium Linux Release', }, - {'name': u'Chromium Mac Release', }, {'name': u'Chromium Win Release', }, + {'name': u'Chromium Mac Release', }, + {'name': u'Chromium Linux Release', }, + {'name': u'WinCairo Debug (Build)', }, + {'name': u'WinCE Release (Build)', }, + {'name': u'EFL Linux Release (Build)', }, ] # This test should probably be updated if the default regexp list changes @@ -410,6 +422,33 @@ class BuildBotTest(unittest.TestCase): buildbot._latest_builds_from_builders = mock_builds_from_builders self.assertEqual(buildbot.last_green_revision(), 1) + def _fetch_build(self, build_number): + if build_number == 5: + return "correct build" + return "wrong build" + + def _fetch_revision_to_build_map(self): + return {'r5': 5, 'r2': 2, 'r3': 3} + + def test_latest_cached_build(self): + b = Builder('builder', BuildBot()) + b._fetch_build = self._fetch_build + b._fetch_revision_to_build_map = self._fetch_revision_to_build_map + self.assertEquals("correct build", b.latest_cached_build()) + + def results_url(self): + return "some-url" + + def test_results_zip_url(self): + b = Build(None, 123, 123, False) + b.results_url = self.results_url + self.assertEquals("some-url.zip", b.results_zip_url()) + + def test_results(self): + builder = Builder('builder', BuildBot()) + b = Build(builder, 123, 123, True) + self.assertTrue(b.results()) + if __name__ == '__main__': unittest.main() |