def test_parser_finds_all_bots_and_revisions_except_forced_builds(self):
    result = tgrid_parser.parse_tgrid_page(SAMPLE_FILE)

    # 5*16 = 80 bots in sample. There's also five empty results because some
    # bots did not run for some revisions, so 80 - 5 = 75 results. There are
    # two additional statuses under an explicit 'latest' revision, which should
    # be ignored since that means the build was forced.
    self.assertEqual(75, len(result))

    # Make some samples
    self.assertTrue(result.has_key('2006--ChromeOS'))
    self.assertEquals('933--OK', result['2006--ChromeOS'])

    self.assertTrue(result.has_key('2006--Chrome'))
    self.assertEquals('243--warnings', result['2006--Chrome'])

    self.assertTrue(result.has_key('2006--LinuxClang'))
    self.assertEquals('610--OK', result['2006--LinuxClang'])

    # This one happened to not get reported in revision 2006, but it should be
    # there in the next revision:
    self.assertFalse(result.has_key('2006--Win32Release'))
    self.assertTrue(result.has_key('2007--Win32Release'))
    self.assertEquals('809--OK', result['2007--Win32Release'])

    self.assertTrue(result.has_key('2007--ChromeOS'))
    self.assertEquals('934--OK', result['2007--ChromeOS'])

    self.assertTrue(result.has_key('2007--LinuxVideoTest'))
    self.assertEquals('731--failed', result['2007--LinuxVideoTest'])

    self.assertTrue(result.has_key('2011--Win32Release'))
    self.assertEquals('813--building', result['2011--Win32Release'])
    def test_parser_finds_all_bots_and_revisions_except_forced_builds(self):
        result = tgrid_parser.parse_tgrid_page(SAMPLE_FILE)

        # 5*16 = 80 bots in sample. There's also five empty results because some
        # bots did not run for some revisions, so 80 - 5 = 75 results. There are
        # two additional statuses under an explicit 'latest' revision, which should
        # be ignored since that means the build was forced.
        self.assertEqual(75, len(result))

        # Make some samples
        self.assertTrue(result.has_key('2006--ChromeOS'))
        self.assertEquals('933--OK', result['2006--ChromeOS'])

        self.assertTrue(result.has_key('2006--Chrome'))
        self.assertEquals('243--warnings', result['2006--Chrome'])

        self.assertTrue(result.has_key('2006--LinuxClang'))
        self.assertEquals('610--OK', result['2006--LinuxClang'])

        # This one happened to not get reported in revision 2006, but it should be
        # there in the next revision:
        self.assertFalse(result.has_key('2006--Win32Release'))
        self.assertTrue(result.has_key('2007--Win32Release'))
        self.assertEquals('809--OK', result['2007--Win32Release'])

        self.assertTrue(result.has_key('2007--ChromeOS'))
        self.assertEquals('934--OK', result['2007--ChromeOS'])

        self.assertTrue(result.has_key('2007--LinuxVideoTest'))
        self.assertEquals('731--failed', result['2007--LinuxVideoTest'])

        self.assertTrue(result.has_key('2011--Win32Release'))
        self.assertEquals('813--building', result['2011--Win32Release'])
  def test_parser_finds_exception_and_maps_to_failed(self):
    result = tgrid_parser.parse_tgrid_page(MINIMAL_EXCEPTION)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1576--Chrome', first_mapping[0])
    self.assertEqual('109--failed', first_mapping[1])
  def test_parser_finds_warnings(self):
    result = tgrid_parser.parse_tgrid_page(MINIMAL_WARNED)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1576--Chrome', first_mapping[0])
    self.assertEqual('109--warnings', first_mapping[1])
  def test_parser_finds_building_bot(self):
    result = tgrid_parser.parse_tgrid_page(MINIMAL_BUILDING)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1576--Win32Debug', first_mapping[0])
    self.assertEqual('434--building', first_mapping[1])
  def test_parser_finds_failed_bot(self):
    result = tgrid_parser.parse_tgrid_page(MINIMAL_FAIL)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1573--Linux Large Tests', first_mapping[0])
    self.assertEqual('731--failed', first_mapping[1])
  def test_parser_finds_successful_bot(self):
    result = tgrid_parser.parse_tgrid_page(MINIMAL_OK)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1570--Android', first_mapping[0])
    self.assertEqual('121--OK', first_mapping[1])
    def test_parser_finds_failed_bot(self):
        result = tgrid_parser.parse_tgrid_page(MINIMAL_FAIL)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1573--LinuxVideoTest', first_mapping[0])
        self.assertEqual('731--failed', first_mapping[1])
    def test_parser_finds_building_bot(self):
        result = tgrid_parser.parse_tgrid_page(MINIMAL_BUILDING)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1576--Win32Debug', first_mapping[0])
        self.assertEqual('434--building', first_mapping[1])
    def test_parser_finds_warnings(self):
        result = tgrid_parser.parse_tgrid_page(MINIMAL_WARNED)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1576--Chrome', first_mapping[0])
        self.assertEqual('109--warnings', first_mapping[1])
  def test_parser_finds_successful_bot(self):
    result = tgrid_parser.parse_tgrid_page(MINIMAL_OK)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    # Note: the parser should unescape % quotations, like %20 for space.
    self.assertEqual('1570--Linux Clang [stable]', first_mapping[0])
    self.assertEqual('121--OK', first_mapping[1])
    def test_parser_finds_exception_and_maps_to_failed(self):
        result = tgrid_parser.parse_tgrid_page(MINIMAL_EXCEPTION)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1576--Chrome', first_mapping[0])
        self.assertEqual('109--failed', first_mapping[1])
    def test_parser_finds_successful_bot(self):
        result = tgrid_parser.parse_tgrid_page(MINIMAL_OK)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1570--Android', first_mapping[0])
        self.assertEqual('121--OK', first_mapping[1])
Example #14
0
  def test_parser_finds_exception_slave_lost_and_maps_to_failed(self):
    # Sometimes the transposed grid says "in trunk" in the source stamp, so
    # make sure we deal with that.
    result = tgrid_parser.parse_tgrid_page(MINIMAL_IN_TRUNK_SOURCESTAMP)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1576--LinuxValgrind', first_mapping[0])
    self.assertEqual('324--failed', first_mapping[1])
Example #15
0
    def test_parser_finds_successful_bot(self):
        result = tgrid_parser.parse_tgrid_page(MINIMAL_OK)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        # Note: the parser should unescape % quotations, like %20 for space.
        self.assertEqual('1570--Linux Clang [stable]', first_mapping[0])
        self.assertEqual('121--OK', first_mapping[1])
  def test_parser_finds_exception_slave_lost_and_maps_to_failed(self):
    # This is to work around a bug in build bot 0.8.4p1 where it may say that
    # the build was successful AND the slave was lost. In this case the build
    # is not actually successful, so treat it as such.
    result = tgrid_parser.parse_tgrid_page(MINIMAL_EXCEPTION_SLAVE_LOST)

    self.assertEqual(1, len(result), 'There is only one bot in the sample.')
    first_mapping = result.items()[0]

    self.assertEqual('1576--LinuxValgrind', first_mapping[0])
    self.assertEqual('324--failed', first_mapping[1])
Example #17
0
    def test_parser_finds_exception_slave_lost_and_maps_to_failed(self):
        # Sometimes the transposed grid says "in trunk" in the source stamp, so
        # make sure we deal with that.
        result = tgrid_parser.parse_tgrid_page(MINIMAL_IN_TRUNK_SOURCESTAMP)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1576--LinuxValgrind', first_mapping[0])
        self.assertEqual('324--failed', first_mapping[1])
    def test_parser_finds_exception_slave_lost_and_maps_to_failed(self):
        # This is to work around a bug in build bot 0.8.4p1 where it may say that
        # the build was successful AND the slave was lost. In this case the build
        # is not actually successful, so treat it as such.
        result = tgrid_parser.parse_tgrid_page(MINIMAL_EXCEPTION_SLAVE_LOST)

        self.assertEqual(1, len(result),
                         'There is only one bot in the sample.')
        first_mapping = result.items()[0]

        self.assertEqual('1576--LinuxValgrind', first_mapping[0])
        self.assertEqual('324--failed', first_mapping[1])
def _download_and_parse_build_status():
  connection = httplib.HTTPConnection(constants.BUILD_MASTER_SERVER)
  connection.request('GET', constants.BUILD_MASTER_TRANSPOSED_GRID_URL)
  response = connection.getresponse()

  if response.status != 200:
    raise FailedToGetStatusFromMaster(('Failed to get build status from master:'
                                       ' got status %d, reason %s.' %
                                       (response.status, response.reason)))

  full_response = response.read()
  connection.close()

  return tgrid_parser.parse_tgrid_page(full_response)
Example #20
0
def _download_and_parse_build_status():
  connection = httplib.HTTPConnection(constants.BUILD_MASTER_SERVER)
  connection.request('GET', constants.BUILD_MASTER_TRANSPOSED_GRID_URL)
  response = connection.getresponse()

  if response.status != 200:
    raise FailedToGetStatusFromMaster(('Failed to get build status from master:'
                                       ' got status %d, reason %s.' %
                                       (response.status, response.reason)))

  full_response = response.read()
  connection.close()

  return tgrid_parser.parse_tgrid_page(full_response)
Example #21
0
  def test_parser_finds_all_bots_and_revisions(self):
    result = tgrid_parser.parse_tgrid_page(SAMPLE_FILE)

    # 2 * 12 = 24 bots in sample
    self.assertEqual(24, len(result))

    # Make some samples
    self.assertTrue(result.has_key('1570--ChromeOS'))
    self.assertEquals('578--OK', result['1570--ChromeOS'])

    self.assertTrue(result.has_key('1570--LinuxCLANG'))
    self.assertEquals('259--OK', result['1570--LinuxCLANG'])

    self.assertTrue(result.has_key('1570--Win32Release'))
    self.assertEquals('440--OK', result['1570--Win32Release'])

    self.assertTrue(result.has_key('1571--ChromeOS'))
    self.assertEquals('579--OK', result['1571--ChromeOS'])

    self.assertTrue(result.has_key('1571--LinuxVideoTest'))
    self.assertEquals('346--failed', result['1571--LinuxVideoTest'])

    self.assertTrue(result.has_key('1571--Win32Debug'))
    self.assertEquals('441--building', result['1571--Win32Debug'])