Ejemplo n.º 1
0
    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)
                    ),
                )
Ejemplo n.º 2
0
    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_xmlrpc_build_dictionary function to not touch the network.
        def mock_fetch_xmlrpc_build_dictionary(self, build_number):
            build_dictionary = {
                "revision" : 2 * build_number,
                "number" : int(build_number),
                "results" : build_number % 2, # 0 means pass
            }
            return build_dictionary
        buildbot._fetch_xmlrpc_build_dictionary = mock_fetch_xmlrpc_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)
Ejemplo n.º 3
0
    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)))
Ejemplo n.º 4
0
    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())
Ejemplo n.º 5
0
    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 = ["Leopard", "Windows.*Build", "Chromium"]
        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"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)
Ejemplo n.º 6
0
    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 = [ "Leopard", "Windows.*Build", "Chromium" ]
        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'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)
Ejemplo n.º 7
0
    def __init__(self, path):
        MultiCommandTool.__init__(self)

        self._path = path
        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()
Ejemplo n.º 8
0
    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())
Ejemplo n.º 9
0
 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)