Commit 6dbc6e29 authored by Juan A. Navarro Perez's avatar Juan A. Navarro Perez Committed by Commit Bot

[tools/perf] Use correct browser for try jobs on webview bots

Use --browser=android-webview on trybot command when selected bots
include webview.

NOTRY=True

Bug: 740845
Change-Id: Ib1d7f436a6d290a9cb63a3f7aaebfb92581e07d8
Reviewed-on: https://chromium-review.googlesource.com/567933
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Reviewed-by: default avatarSimon Hatch <simonhatch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486734}
parent ea5a4492
......@@ -4,6 +4,7 @@
import argparse
import base64
import collections
import gzip
import io
import json
......@@ -25,27 +26,7 @@ from telemetry.util import command_line
from telemetry.util import matching
# Unsupported Perf bisect bots.
EXCLUDED_BOTS = {
'win_xp_perf_bisect', # Goma issues: crbug.com/330900
'win_perf_bisect_builder',
'win64_nv_tester',
'winx64_bisect_builder',
'linux_perf_bisect_builder',
'mac_perf_bisect_builder',
'android_perf_bisect_builder',
'android_arm64_perf_bisect_builder',
# Bisect FYI bots are not meant for testing actual perf regressions.
# Hardware configuration on these bots is different from actual bisect bot
# and these bots runs E2E integration tests for auto-bisect
# using dummy benchmarks.
'linux_fyi_perf_bisect',
'mac_fyi_perf_bisect',
'win_fyi_perf_bisect',
'winx64_fyi_perf_bisect',
}
INCLUDE_BOTS = [
ALL_CONFIG_BOTS = [
'all',
'all-win',
'all-mac',
......@@ -96,8 +77,20 @@ _MILO_MASTER_ENDPOINT = ('https://luci-milo.appspot.com/prpc/milo.Buildbot/'
_MILO_RESPONSE_PREFIX = ')]}\'\n'
assert not set(DEFAULT_TRYBOTS) & set(EXCLUDED_BOTS), (
'A trybot cannot present in both Default as well as Excluded bots lists.')
def _IsPerfBisectBot(builder):
return (
builder.endswith('_perf_bisect') and
# Bisect FYI bots are not meant for testing actual perf regressions.
# Hardware configuration on these bots is different from actual bisect bot
# and these bots runs E2E integration tests for auto-bisect
# using dummy benchmarks.
not builder.endswith('fyi_perf_bisect')
# Individual bisect bots may be blacklisted here.
)
assert all(_IsPerfBisectBot(builder) for builder in DEFAULT_TRYBOTS), (
'A default trybot is being exluded by the perf bisect bot filter.')
class TrybotError(Exception):
......@@ -134,7 +127,7 @@ def _ProcessMiloData(data):
def _GetTrybotList(builders):
builders = ['%s' % bot.replace('_perf_bisect', '').replace('_', '-')
for bot in builders]
builders.extend(INCLUDE_BOTS)
builders.extend(ALL_CONFIG_BOTS)
return sorted(builders)
......@@ -146,41 +139,31 @@ def _GetBotPlatformFromTrybotName(trybot_name):
raise TrybotError('Trybot "%s" unsupported for tryjobs.' % trybot_name)
def _GetPlatformVariantFromBuilderName(builder):
bot_platform = _GetBotPlatformFromTrybotName(builder)
# Special case for platform variants that need special configs.
if bot_platform == 'win' and 'x64' in builder:
return 'win-x64'
elif bot_platform == 'android' and 'webview' in builder:
return 'android-webview'
else:
return bot_platform
def _GetBuilderNames(trybot_name, builders):
"""Return platform and its available bot name as dictionary."""
os_names = ['linux', 'android', 'mac', 'win']
if 'all' not in trybot_name:
bot = ['%s_perf_bisect' % trybot_name.replace('-', '_')]
bot_platform = _GetBotPlatformFromTrybotName(trybot_name)
if 'x64' in trybot_name:
bot_platform += '-x64'
return {bot_platform: bot}
platform_and_bots = {}
for os_name in os_names:
platform_and_bots[os_name] = [bot for bot in builders if os_name in bot]
# Special case for Windows x64, consider it as separate platform
# config config should contain target_arch=x64 and --browser=release_x64.
win_x64_bots = [
win_bot for win_bot in platform_and_bots['win']
if 'x64' in win_bot]
# Separate out non x64 bits win bots
platform_and_bots['win'] = list(
set(platform_and_bots['win']) - set(win_x64_bots))
platform_and_bots['win-x64'] = win_x64_bots
if 'all-win' in trybot_name:
return {'win': platform_and_bots['win'],
'win-x64': platform_and_bots['win-x64']}
if 'all-mac' in trybot_name:
return {'mac': platform_and_bots['mac']}
if 'all-android' in trybot_name:
return {'android': platform_and_bots['android']}
if 'all-linux' in trybot_name:
return {'linux': platform_and_bots['linux']}
return platform_and_bots
if trybot_name in ALL_CONFIG_BOTS:
platform_prefix = trybot_name[4:]
platform_and_bots = collections.defaultdict(list)
for builder in builders:
bot_platform = _GetPlatformVariantFromBuilderName(builder)
if bot_platform.startswith(platform_prefix):
platform_and_bots[bot_platform].append(builder)
return platform_and_bots
else:
builder = '%s_perf_bisect' % trybot_name.replace('-', '_')
bot_platform = _GetPlatformVariantFromBuilderName(builder)
return {bot_platform: [builder]}
_GIT_CMD = 'git'
......@@ -250,7 +233,7 @@ class Trybot(command_line.ArgParseCommand):
data = _ProcessMiloData(f.read())
builders = data.get('builders', {}).keys()
# Exclude unsupported bots like win xp and some dummy bots.
cls._builders = [bot for bot in builders if bot not in EXCLUDED_BOTS]
cls._builders = [bot for bot in builders if _IsPerfBisectBot(bot)]
return cls._builders
......@@ -425,11 +408,12 @@ E.g.,
arguments.insert(0, 'src/tools/perf/run_benchmark')
if bot_platform == 'android':
arguments.insert(1, '--browser=android-chromium')
elif any('x64' in bot for bot in self._builder_names[bot_platform]):
elif bot_platform == 'android-webview':
arguments.insert(1, '--browser=android-webview')
elif bot_platform == 'win-x64':
arguments.insert(1, '--browser=release_x64')
target_arch = 'x64'
else:
arguments.insert(1, '--browser=release')
command = ' '.join(arguments)
......
......@@ -166,6 +166,7 @@ class TrybotCommandTest(unittest.TestCase):
'android_nexus4_perf_bisect': 'stuff',
'mac_10_9_perf_bisect': 'otherstuff',
'win_perf_bisect_builder': 'not a trybot',
'android_fyi_perf_bisect': 'not meant for actual perf testing'
})
expected_trybots_list = [
'all',
......@@ -207,6 +208,7 @@ class TrybotCommandTest(unittest.TestCase):
self._MockTryserverJson({
'android_nexus4_perf_bisect': 'stuff',
'android_nexus5_perf_bisect': 'stuff2',
'android_webview_nexus6_aosp_perf_bisect': 'stuff3',
'mac_10_9_perf_bisect': 'otherstuff',
'mac_perf_bisect': 'otherstuff1',
'win_perf_bisect': 'otherstuff2',
......@@ -217,11 +219,14 @@ class TrybotCommandTest(unittest.TestCase):
command = trybot_command.Trybot()
command._InitializeBuilderNames('all')
self.assertEquals(
['android', 'linux', 'mac', 'win', 'win-x64'],
['android', 'android-webview', 'linux', 'mac', 'win', 'win-x64'],
sorted(command._builder_names))
self.assertEquals(
['android_nexus4_perf_bisect', 'android_nexus5_perf_bisect'],
sorted(command._builder_names.get('android')))
self.assertEquals(
['android_webview_nexus6_aosp_perf_bisect'],
sorted(command._builder_names.get('android-webview')))
self.assertEquals(
['mac_10_9_perf_bisect', 'mac_perf_bisect'],
sorted(command._builder_names.get('mac')))
......@@ -265,6 +270,7 @@ class TrybotCommandTest(unittest.TestCase):
self._MockTryserverJson({
'android_nexus4_perf_bisect': 'stuff',
'android_nexus5_perf_bisect': 'stuff2',
'android_webview_nexus6_aosp_perf_bisect': 'stuff3',
'win_8_perf_bisect': 'otherstuff',
'win_perf_bisect': 'otherstuff2',
'linux_perf_bisect': 'otherstuff3',
......@@ -276,6 +282,9 @@ class TrybotCommandTest(unittest.TestCase):
self.assertEquals(
['android_nexus4_perf_bisect', 'android_nexus5_perf_bisect'],
sorted(command._builder_names.get('android')))
self.assertEquals(
['android_webview_nexus6_aosp_perf_bisect'],
sorted(command._builder_names.get('android-webview')))
def testConstructorTrybotAllMac(self):
self._MockTryserverJson({
......@@ -396,6 +405,18 @@ class TrybotCommandTest(unittest.TestCase):
'truncate_percent': '0'
}, config)
def testConfigAndroidWebview(self):
config, _ = self._GetConfigForTrybot(
'android-webview-nexus6-aosp', 'android-webview')
self.assertEquals(
{'command': ('src/tools/perf/run_benchmark '
'--browser=android-webview sunspider --verbose'),
'max_time_minutes': '120',
'repeat_count': '1',
'target_arch': 'ia32',
'truncate_percent': '0'
}, config)
def testConfigMac(self):
config, _ = self._GetConfigForTrybot('mac-10-9', 'mac')
self.assertEquals(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment