def test_status_parsing(self): buildbot = BuildBot() soup = BeautifulSoup(self._example_one_box_status) status_table = soup.find("table") input_rows = status_table.findAll("tr") for x in range(len(input_rows)): status_row = input_rows[x] expected_parsing = self._expected_example_one_box_parsings[x] builder = buildbot._parse_builder_status_from_row(status_row) # Make sure we aren't parsing more or less than we expect self.assertEquals(builder.keys(), expected_parsing.keys()) for key, expected_value in expected_parsing.items(): self.assertEquals( builder[key], expected_value, ( "Builder %d parse failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expected_value) ), )
def test_builder_with_name(self): buildbot = BuildBot() builder = buildbot.builder_with_name("Test Builder") self.assertEqual(builder.name(), "Test Builder") self.assertEqual(builder.url(), "http://build.webkit.org/builders/Test%20Builder") self.assertEqual(builder.url_encoded_name(), "Test%20Builder") self.assertEqual(builder.results_url(), "http://build.webkit.org/results/Test%20Builder") # Override _fetch_build_dictionary function to not touch the network. def mock_fetch_build_dictionary(self, build_number): build_dictionary = { "sourceStamp": {"revision": 2 * build_number}, "number": int(build_number), "results": build_number % 2, # 0 means pass } return build_dictionary buildbot._fetch_build_dictionary = mock_fetch_build_dictionary build = builder.build(10) self.assertEqual(build.builder(), builder) self.assertEqual(build.url(), "http://build.webkit.org/builders/Test%20Builder/builds/10") self.assertEqual(build.results_url(), "http://build.webkit.org/results/Test%20Builder/r20%20%2810%29") self.assertEqual(build.revision(), 20) self.assertEqual(build.is_green(), True) build = build.previous_build() self.assertEqual(build.builder(), builder) self.assertEqual(build.url(), "http://build.webkit.org/builders/Test%20Builder/builds/9") self.assertEqual(build.results_url(), "http://build.webkit.org/results/Test%20Builder/r18%20%289%29") self.assertEqual(build.revision(), 18) self.assertEqual(build.is_green(), False) self.assertEqual(builder.build(None), None)
def test_last_green_revision(self): buildbot = BuildBot() def mock_builds_from_builders(only_core_builders): return self._fake_builds_at_index(0) buildbot._latest_builds_from_builders = mock_builds_from_builders self.assertEqual(buildbot.last_green_revision(), 1)
def test_revisions_for_builder(self): buildbot = BuildBot() buildbot._fetch_builder_page = lambda builder: builder.page builder_with_success = Builder('Some builder', None) builder_with_success.page = self._fake_builder_page self.assertEqual(buildbot._revisions_for_builder(builder_with_success), [(104643, False), (104636, False), (104635, True), (104633, False)]) builder_without_success = Builder('Some builder', None) builder_without_success.page = self._fake_builder_page_without_success self.assertEqual(buildbot._revisions_for_builder(builder_without_success), [(104643, False), (104636, False), (104635, False), (104633, False)])
def test_fetch_build(self): buildbot = BuildBot() builder = Builder(u"Test Builder \u2661", buildbot) def mock_fetch_build_dictionary(self, build_number): build_dictionary = { "sourceStamp": { "revision": None, # revision=None means a trunk build started from the force-build button on the builder page. }, "number": int(build_number), # Intentionally missing the 'results' key, meaning it's a "pass" build. } return build_dictionary buildbot._fetch_build_dictionary = mock_fetch_build_dictionary self.assertIsNotNone(builder._fetch_build(1))
def test_revisions_for_builder(self): buildbot = BuildBot() buildbot._fetch_builder_page = lambda builder: builder.page builder_with_success = Builder('Some builder', None) builder_with_success.page = self._fake_builder_page self.assertEqual(buildbot._revisions_for_builder(builder_with_success), [(104643, False), (104636, False), (104635, True), (104633, False)]) builder_without_success = Builder('Some builder', None) builder_without_success.page = self._fake_builder_page_without_success self.assertEqual( buildbot._revisions_for_builder(builder_without_success), [(104643, False), (104636, False), (104635, False), (104633, False)])
def test_layout_test_results(self): buildbot = BuildBot() builder = Builder(u"Foo Builder (test)", buildbot) builder._fetch_file_from_results = lambda results_url, file_name: None build = Build(builder, None, None, None) # Test that layout_test_results() returns None if the fetch fails. self.assertEqual(build.layout_test_results(), None)
def test_builder_with_name(self): buildbot = BuildBot() builder = buildbot.builder_with_name("Test Builder") self.assertEqual(builder.name(), "Test Builder") self.assertEqual(builder.url(), "http://build.webkit.org/builders/Test%20Builder") self.assertEqual(builder.url_encoded_name(), "Test%20Builder") self.assertEqual(builder.results_url(), "http://build.webkit.org/results/Test%20Builder") # Override _fetch_build_dictionary function to not touch the network. def mock_fetch_build_dictionary(self, build_number): build_dictionary = { "sourceStamp": { "revision": 2 * build_number, }, "number": int(build_number), "results": build_number % 2, # 0 means pass } return build_dictionary buildbot._fetch_build_dictionary = mock_fetch_build_dictionary build = builder.build(10) self.assertEqual(build.builder(), builder) self.assertEqual( build.url(), "http://build.webkit.org/builders/Test%20Builder/builds/10") self.assertEqual( build.results_url(), "http://build.webkit.org/results/Test%20Builder/r20%20%2810%29") self.assertEqual(build.revision(), 20) self.assertEqual(build.is_green(), True) build = build.previous_build() self.assertEqual(build.builder(), builder) self.assertEqual( build.url(), "http://build.webkit.org/builders/Test%20Builder/builds/9") self.assertEqual( build.results_url(), "http://build.webkit.org/results/Test%20Builder/r18%20%289%29") self.assertEqual(build.revision(), 18) self.assertEqual(build.is_green(), False) self.assertEqual(builder.build(None), None)
def test_builder_name_regexps(self): buildbot = BuildBot() # For complete testing, this list should match the list of builders at build.webkit.org: example_builders = [ {'name': u'Tiger Intel Release', }, {'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 Leaks', }, {'name': u'Windows Release (Build)', }, {'name': u'Windows Release (Tests)', }, {'name': u'Windows Debug (Build)', }, {'name': u'Windows Debug (Tests)', }, {'name': u'Qt Linux Release', }, {'name': u'Gtk Linux Release', }, {'name': u'Gtk Linux 32-bit Debug', }, {'name': u'Gtk Linux 64-bit Debug', }, {'name': u'Chromium Linux Release', }, {'name': u'Chromium Mac Release', }, {'name': u'Chromium Win Release', }, ] name_regexps = ['SnowLeopard.*Build', 'SnowLeopard.*Test', 'Leopard', 'Tiger', 'Windows.*Build', 'Chromium'] expected_builders = [ {'name': u'Tiger Intel Release', }, {'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'Windows Release (Build)', }, {'name': u'Windows Debug (Build)', }, {'name': u'Chromium Linux Release', }, {'name': u'Chromium Mac Release', }, {'name': u'Chromium Win Release', }, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps(example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_last_green_revision(self): buildbot = BuildBot() def mock_builds_from_builders(): return self._fake_builds_at_index(0) # Revision, is_green # Ordered from newest (highest number) to oldest. fake_builder1 = Builder("Fake Builder 1", None) fake_builder1.revisions = [(1, True), (3, False), (5, True), (10, True), (12, False)] fake_builder2 = Builder("Fake Builder 2", None) fake_builder2.revisions = [(1, True), (3, False), (7, True), (9, True), (12, False)] some_builder = Builder("Some Builder", None) some_builder.revisions = [(1, True), (3, True), (7, True), (11, False), (12, True)] buildbot.builders = lambda: [ fake_builder1, fake_builder2, some_builder ] buildbot._revisions_for_builder = lambda builder: builder.revisions buildbot._latest_builds_from_builders = mock_builds_from_builders self.assertEqual( buildbot.last_green_revision(''), "The last known green revision is 7\nFake Builder 1: 10\nFake Builder 2: 9\nSome Builder: 12\n" ) some_builder.revisions = [(1, False), (3, False)] self.assertEqual( buildbot.last_green_revision(''), "Fake Builder 1: 10\nFake Builder 2: 9\nSome Builder has had no green revision in the last 2 runs\n" )
def test_status_parsing(self): buildbot = BuildBot() soup = BeautifulSoup(self._example_one_box_status) status_table = soup.find("table") input_rows = status_table.findAll('tr') for x in range(len(input_rows)): status_row = input_rows[x] expected_parsing = self._expected_example_one_box_parsings[x] builder = buildbot._parse_builder_status_from_row(status_row) # Make sure we aren't parsing more or less than we expect self.assertEquals(builder.keys(), expected_parsing.keys()) for key, expected_value in expected_parsing.items(): self.assertEquals(builder[key], expected_value, ("Builder %d parse failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expected_value)))
def test_core_builder_methods(self): buildbot = BuildBot() # Override builder_statuses function to not touch the network. def example_builder_statuses(): # We could use instancemethod() to bind 'self' but we don't need to. return BuildBotTest._expected_example_one_box_parsings buildbot.builder_statuses = example_builder_statuses buildbot.core_builder_names_regexps = [ 'Leopard', "Windows.*Build" ] self.assertEquals(buildbot.red_core_builders_names(), []) self.assertTrue(buildbot.core_builders_are_green()) buildbot.core_builder_names_regexps = [ 'SnowLeopard', 'Qt' ] self.assertEquals(buildbot.red_core_builders_names(), [ u'SnowLeopard Intel Release', u'Qt Linux Release' ]) self.assertFalse(buildbot.core_builders_are_green())
def setUp(self): self.buildbot = BuildBot() self.builder = Builder(u"Test Builder \u2661", self.buildbot) def _mock_fetch_build(build_number): build = Build(builder=self.builder, build_number=build_number, revision=build_number + 1000, is_green=build_number < 4) return build self.builder._fetch_build = _mock_fetch_build
def __init__(self, path): MultiCommandTool.__init__(self) self._path = path self.wakeup_event = threading.Event() self.bugs = Bugzilla() self.buildbot = BuildBot() self.executive = Executive() self._irc = None self.user = User() self._scm = None self._checkout = None self.status_server = StatusServer() self.codereview = Rietveld(self.executive)
def test_builder_with_name(self): buildbot = BuildBot() builder = buildbot.builder_with_name("Test Builder") self.assertEqual(builder.name(), "Test Builder") self.assertEqual(builder.url(), "http://build.chromium.org/p/chromium.webkit/builders/Test%20Builder") self.assertEqual(builder.url_encoded_name(), "Test%20Builder") self.assertEqual(builder.results_url(), "https://storage.googleapis.com/chromium-layout-test-archives/Test_Builder") # Override _fetch_build_dictionary function to not touch the network. def mock_fetch_build_dictionary(self, build_number): build_dictionary = { "sourceStamp": { "revision" : 2 * build_number, }, "number" : int(build_number), "results" : build_number % 2, # 0 means pass } return build_dictionary buildbot._fetch_build_dictionary = mock_fetch_build_dictionary build = builder.build(10) self.assertEqual(build.builder(), builder) self.assertEqual(build.url(), "http://build.chromium.org/p/chromium.webkit/builders/Test%20Builder/builds/10") self.assertEqual(build.results_url(), "https://storage.googleapis.com/chromium-layout-test-archives/Test_Builder/r20%20%2810%29") self.assertEqual(build.revision(), 20) self.assertTrue(build.is_green()) build = build.previous_build() self.assertEqual(build.builder(), builder) self.assertEqual(build.url(), "http://build.chromium.org/p/chromium.webkit/builders/Test%20Builder/builds/9") self.assertEqual(build.results_url(), "https://storage.googleapis.com/chromium-layout-test-archives/Test_Builder/r18%20%289%29") self.assertEqual(build.revision(), 18) self.assertFalse(build.is_green()) self.assertIsNone(builder.build(None))
def __init__(self): SystemHost.__init__(self) self.web = web.Web() self._git = None # Everything below this line is WebKit-specific and belongs on a higher-level object. self.buildbot = BuildBot() # FIXME: Unfortunately Port objects are currently the central-dispatch objects of the NRWT world. # In order to instantiate a port correctly, we have to pass it at least an executive, user, git, and filesystem # so for now we just pass along the whole Host object. # FIXME: PortFactory doesn't belong on this Host object if Port is going to have a Host (circular dependency). self.port_factory = PortFactory(self) self.builders = BuilderList.load_default_builder_list(self.filesystem)
def test_last_green_revision(self): buildbot = BuildBot() def mock_builds_from_builders(): return self._fake_builds_at_index(0) # Revision, is_green # Ordered from newest (highest number) to oldest. fake_builder1 = Builder("Fake Builder 1", None) fake_builder1.revisions = [(1, True), (3, False), (5, True), (10, True), (12, False)] fake_builder2 = Builder("Fake Builder 2", None) fake_builder2.revisions = [(1, True), (3, False), (7, True), (9, True), (12, False)] some_builder = Builder("Some Builder", None) some_builder.revisions = [(1, True), (3, True), (7, True), (11, False), (12, True)] buildbot.builders = lambda: [fake_builder1, fake_builder2, some_builder] buildbot._revisions_for_builder = lambda builder: builder.revisions buildbot._latest_builds_from_builders = mock_builds_from_builders self.assertEqual(buildbot.last_green_revision(''), "The last known green revision is 7\nFake Builder 1: 10\nFake Builder 2: 9\nSome Builder: 12\n") some_builder.revisions = [(1, False), (3, False)] self.assertEqual(buildbot.last_green_revision(''), "Fake Builder 1: 10\nFake Builder 2: 9\nSome Builder has had no green revision in the last 2 runs\n")
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.assertEqual("correct build", b.latest_cached_build())
def test_accumulated_results_url(self): self.assertEqual( BuildBot().accumulated_results_url_base('WebKit Mac10.8 (dbg)'), 'https://test-results.appspot.com/data/layout_results/WebKit_Mac10_8__dbg_/results/layout-test-results' )
def test_parse_build_to_revision_map(self): buildbot = BuildBot() files = buildbot._parse_twisted_directory_listing(self._example_directory_listing) self.assertEqual(self._expected_files, files)
def fetch_layout_test_results_with_no_responses(self): buildbot = BuildBot() buildbot._fetch_file = lambda: None # pylint: disable=protected-access self.assertIsNone(buildbot.fetch_layout_test_results(buildbot.results_url('Builder')))
def test_builder_name_regexps(self): buildbot = BuildBot() # For complete testing, this list should match the list of builders at build.webkit.org: example_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'SnowLeopard Intel Leaks', }, {'name': u'Windows Release (Build)', }, {'name': u'Windows 7 Release (Tests)', }, {'name': u'Windows Debug (Build)', }, {'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'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 Android Release', }, {'name': u'Chromium Win Release', }, {'name': u'Chromium Win Release (Tests)', }, {'name': u'Chromium Mac Release', }, {'name': u'Chromium Mac Release (Tests)', }, {'name': u'Chromium Linux Release', }, {'name': u'Chromium Linux Release (Tests)', }, {'name': u'Leopard Intel Release (NRWT)', }, {'name': u'SnowLeopard Intel Release (NRWT)', }, {'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.*\((?:Build|Test)", "Windows.*Build", "Windows.*\(Test", "WinCE", "EFL", "GTK.*32", "GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken. "Qt", "Chromium.*(Mac|Linux|Win).*Release$", "Chromium.*(Mac|Linux|Win).*Release.*\(Tests", ] 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', }, {'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 Win Release', }, {'name': u'Chromium Win Release (Tests)', }, {'name': u'Chromium Mac Release', }, {'name': u'Chromium Mac Release (Tests)', }, {'name': u'Chromium Linux Release', }, {'name': u'Chromium Linux Release (Tests)', }, {'name': u'WinCE Release (Build)', }, {'name': u'EFL Linux Release (Build)', }, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps(example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_builder_name_regexps(self): buildbot = BuildBot() # For complete testing, this list should match the list of builders at build.webkit.org: example_builders = [ {'name': u'Tiger Intel Release', }, {'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 Leaks', }, {'name': u'Windows Release (Build)', }, {'name': u'Windows Release (Tests)', }, {'name': u'Windows Debug (Build)', }, {'name': u'Windows Debug (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 ARMv5 Release', }, {'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'New run-webkit-tests', }, ] name_regexps = [ "SnowLeopard.*Build", "SnowLeopard.*Test", "Leopard", "Tiger", "Windows.*Build", "GTK", "Qt", "Chromium", ] expected_builders = [ {'name': u'Tiger Intel Release', }, {'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'Windows Release (Build)', }, {'name': u'Windows Debug (Build)', }, {'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 ARMv5 Release', }, {'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', }, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps(example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_builder_name_regexps(self): buildbot = BuildBot() # For complete testing, this list should match the list of builders at build.webkit.org: example_builders = [ {"name": u"Tiger Intel Release"}, {"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"SnowLeopard Intel Leaks"}, {"name": u"Windows Release (Build)"}, {"name": u"Windows Release (Tests)"}, {"name": u"Windows Debug (Build)"}, {"name": u"Windows Debug (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 ARMv5 Release"}, {"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 Win Release (Tests)"}, {"name": u"New run-webkit-tests"}, ] name_regexps = [ "SnowLeopard.*Build", "SnowLeopard.*\(Test", "Leopard", "Tiger", "Windows.*Build", "GTK.*32", "GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken. "Qt", "Chromium.*Release$", ] expected_builders = [ {"name": u"Tiger Intel Release"}, {"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"Windows Release (Build)"}, {"name": u"Windows Debug (Build)"}, {"name": u"GTK Linux 32-bit Release"}, {"name": u"GTK Linux 32-bit Debug"}, {"name": u"GTK Linux 64-bit Debug"}, {"name": u"Qt Linux Release"}, {"name": u"Qt Linux Release minimal"}, {"name": u"Qt Linux ARMv5 Release"}, {"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"}, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps(example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_builder_results_url_base(self): self.assertEqual( BuildBot().builder_results_url_base('WebKit Mac10.8 (dbg)'), 'https://test-results.appspot.com/data/layout_results/WebKit_Mac10_8__dbg_' )
def test_results(self): builder = Builder('builder', BuildBot()) b = Build(builder, 123, 123, True) self.assertTrue(b.results())
def test_results_url(self): builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') self.assertEqual(builder.results_url(), 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Mac10_8__dbg_')
def test_find_green_revision(self): buildbot = BuildBot() self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, True), (3, False)], 'Builder 3': [(1, True), (3, True)], }), 1) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, False), (3, True)], 'Builder 2': [(1, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), 3) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (2, True)], 'Builder 2': [(1, False), (2, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), None) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (2, True)], 'Builder 2': [(1, True), (2, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), 2) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, False), (2, True)], 'Builder 2': [(1, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), None) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, False), (2, True), (3, True), (4, True)], 'Builder 3': [(2, True), (4, True)], }), 3) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, False), (2, True), (3, True), (4, False)], 'Builder 3': [(2, True), (4, True)], }), None) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, False), (2, True), (3, True), (4, False)], 'Builder 3': [(2, True), (3, True), (4, True)], }), 3) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (2, True)], 'Builder 2': [], 'Builder 3': [(1, True), (2, True)], }), None) self.assertEqual(buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, False), (5, True), (10, True), (12, False)], 'Builder 2': [(1, True), (3, False), (7, True), (9, True), (12, False)], 'Builder 3': [(1, True), (3, True), (7, True), (11, False), (12, True)], }), 7)
def test_parse_build_to_revision_map(self): buildbot = BuildBot() files = buildbot._parse_twisted_directory_listing( self._example_directory_listing) self.assertEqual(self._expected_files, files)
def test_results_url_with_build_number(self): self.assertEqual( BuildBot().results_url('Test Builder', 10), 'https://test-results.appspot.com/data/layout_results/Test_Builder/10/layout-test-results' )
def test_builder_name_regexps(self): buildbot = BuildBot() # For complete testing, this list should match the list of builders at build.webkit.org: example_builders = [ { 'name': u'Tiger Intel Release', }, { '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 Leaks', }, { 'name': u'Windows Release (Build)', }, { 'name': u'Windows Release (Tests)', }, { 'name': u'Windows Debug (Build)', }, { 'name': u'Windows Debug (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 ARMv5 Release', }, { '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'New run-webkit-tests', }, ] name_regexps = [ "SnowLeopard.*Build", "SnowLeopard.*Test", "Leopard", "Tiger", "Windows.*Build", "GTK", "Qt", "Chromium", ] expected_builders = [ { 'name': u'Tiger Intel Release', }, { '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'Windows Release (Build)', }, { 'name': u'Windows Debug (Build)', }, { '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 ARMv5 Release', }, { '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', }, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps( example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def fetch_layout_test_results_with_no_responses(self): buildbot = BuildBot() buildbot._fetch_file_from_results = lambda: None self.assertIsNone(buildbot.fetch_layout_test_results(buildbot.results_url('Builder')))
def test_builder_name_regexps(self): buildbot = BuildBot() # For complete testing, this list should match the list of builders at build.webkit.org: example_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'SnowLeopard Intel Leaks', }, { 'name': u'Windows Release (Build)', }, { 'name': u'Windows 7 Release (Tests)', }, { 'name': u'Windows Debug (Build)', }, { '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'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 Win Release', }, { '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.*", "Windows.*Build", "Windows.*\(Test", "WinCairo", "WinCE", "EFL", "GTK.*32", "GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken. "Qt", "Chromium.*Release$", ] 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', }, { '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 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 self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps( example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_accumulated_results_url(self): self.assertEqual( BuildBot().accumulated_results_url_base('WebKit Mac10.8 (dbg)'), 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Mac10_8__dbg_/results/layout-test-results' )
def fetch_layout_test_results_with_no_responses(self): buildbot = BuildBot() buildbot._fetch_file_from_results = lambda: None self.assertIsNone( buildbot.fetch_layout_test_results( buildbot.results_url('Builder')))
def fetch_layout_test_results_with_no_responses(self): buildbot = BuildBot() buildbot._fetch_file = lambda: None # pylint: disable=protected-access self.assertIsNone( buildbot.fetch_layout_test_results( buildbot.results_url('Builder')))
def test_accumulated_results_url(self): builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') self.assertEqual( builder.accumulated_results_url(), 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Mac10_8__dbg_/results/layout-test-results' )
def test_results_url_with_non_numeric_build_number(self): with self.assertRaisesRegexp(AssertionError, 'expected numeric build number'): BuildBot().results_url('Test Builder', 'ba5eba11')
def test_find_green_revision(self): buildbot = BuildBot() self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, True), (3, False)], 'Builder 3': [(1, True), (3, True)], }), 1) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, False), (3, True)], 'Builder 2': [(1, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), 3) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (2, True)], 'Builder 2': [(1, False), (2, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), None) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (2, True)], 'Builder 2': [(1, True), (2, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), 2) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, False), (2, True)], 'Builder 2': [(1, True), (3, True)], 'Builder 3': [(1, True), (3, True)], }), None) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, False), (2, True), (3, True), (4, True)], 'Builder 3': [(2, True), (4, True)], }), 3) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, False), (2, True), (3, True), (4, False)], 'Builder 3': [(2, True), (4, True)], }), None) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, True)], 'Builder 2': [(1, False), (2, True), (3, True), (4, False)], 'Builder 3': [(2, True), (3, True), (4, True)], }), 3) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (2, True)], 'Builder 2': [], 'Builder 3': [(1, True), (2, True)], }), None) self.assertEqual( buildbot._find_green_revision({ 'Builder 1': [(1, True), (3, False), (5, True), (10, True), (12, False)], 'Builder 2': [(1, True), (3, False), (7, True), (9, True), (12, False)], 'Builder 3': [(1, True), (3, True), (7, True), (11, False), (12, True)], }), 7)
def test_results_url_with_build_number(self): self.assertEqual( BuildBot().results_url('Test Builder', 10), 'https://storage.googleapis.com/chromium-layout-test-archives/Test_Builder/10/layout-test-results' )
def setUp(self): self.buildbot = BuildBot() self.builder = Builder(u"Test Builder \u2661", self.buildbot) self._install_fetch_build(lambda build_number: ["test1", "test2"])
def test_builder_results_url_base(self): self.assertEqual( BuildBot().builder_results_url_base('WebKit Mac10.8 (dbg)'), 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Mac10_8__dbg_' )