Will now filter chrome-triggered builds.
BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/492009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2040 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c440d56e92
commit
c3eb178a0d
@ -14,7 +14,6 @@
|
||||
|
||||
__author__ = 'phoglund@webrtc.org (Patrik Höglund)'
|
||||
|
||||
|
||||
import httplib
|
||||
|
||||
import constants
|
||||
@ -42,12 +41,31 @@ def _download_and_parse_build_status():
|
||||
return tgrid_parser.parse_tgrid_page(full_response)
|
||||
|
||||
|
||||
def _is_chrome_only_build(revision_to_bot_name):
|
||||
"""Figures out if a revision-to-bot-name mapping represents a Chrome build.
|
||||
|
||||
We assume here that Chrome revisions are always > 100000, whereas WebRTC
|
||||
revisions will not reach that number in the foreseeable future."""
|
||||
revision = int(revision_to_bot_name.split('--')[0])
|
||||
bot_name = revision_to_bot_name.split('--')[1]
|
||||
return bot_name == 'Chrome' and revision > 100000
|
||||
|
||||
|
||||
def _filter_chrome_only_builds(bot_to_status_mapping):
|
||||
"""Filters chrome-only builds from the system so LKGR doesn't get confused."""
|
||||
return dict((revision_to_bot_name, status)
|
||||
for revision_to_bot_name, status
|
||||
in bot_to_status_mapping.iteritems()
|
||||
if not _is_chrome_only_build(revision_to_bot_name))
|
||||
|
||||
|
||||
def _main():
|
||||
dashboard = dashboard_connection.DashboardConnection(constants.CONSUMER_KEY)
|
||||
dashboard.read_required_files(constants.CONSUMER_SECRET_FILE,
|
||||
constants.ACCESS_TOKEN_FILE)
|
||||
|
||||
bot_to_status_mapping = _download_and_parse_build_status()
|
||||
bot_to_status_mapping = _filter_chrome_only_builds(bot_to_status_mapping)
|
||||
|
||||
dashboard.send_post_request(constants.ADD_BUILD_STATUS_DATA_URL,
|
||||
bot_to_status_mapping)
|
||||
|
46
tools/quality_tracking/track_build_status_test.py
Executable file
46
tools/quality_tracking/track_build_status_test.py
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
"""Unit test for the build status tracker script."""
|
||||
|
||||
__author__ = 'phoglund@webrtc.org (Patrik Höglund)'
|
||||
|
||||
|
||||
import copy
|
||||
import unittest
|
||||
|
||||
import track_build_status
|
||||
|
||||
|
||||
NORMAL_BOT_TO_STATUS_MAPPING = { '1455--ChromeOS': '455--OK',
|
||||
'1455--Chrome': '900--failed',
|
||||
'1455--Linux32DBG': '344--OK',
|
||||
'1456--ChromeOS': '456--OK' }
|
||||
|
||||
|
||||
class TrackBuildStatusTest(unittest.TestCase):
|
||||
def test_that_filter_chrome_only_builds_filter_properly(self):
|
||||
bot_to_status_mapping = copy.deepcopy(NORMAL_BOT_TO_STATUS_MAPPING)
|
||||
bot_to_status_mapping['133445--Chrome'] = '901--OK'
|
||||
|
||||
result = track_build_status._filter_chrome_only_builds(
|
||||
bot_to_status_mapping)
|
||||
|
||||
self.assertEquals(NORMAL_BOT_TO_STATUS_MAPPING, result)
|
||||
|
||||
def test_ensure_filter_chrome_only_builds_doesnt_filter_too_much(self):
|
||||
result = track_build_status._filter_chrome_only_builds(
|
||||
NORMAL_BOT_TO_STATUS_MAPPING)
|
||||
|
||||
self.assertEquals(NORMAL_BOT_TO_STATUS_MAPPING, result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user