Commit c9acbbf9 authored by Leonard Ge's avatar Leonard Ge Committed by Commit Bot

Avoiding Add Field Trials Configuration If in Compatibility Mode

In this CL, we use the flag that is added in CL:1150026 to test whether telemetry
is in compatibility mode, if so, we will not add the field trials configuration
to bypass earlier Chromes' configuration file size limit in order to run benchmark on them.

Corresponding test case is added as well.

Some style change is also included to keep gpylint happy.

Bug: chromium:866881
Cq-Include-Trybots: master.tryserver.chromium.perf:obbs_fyi
Change-Id: I97bd81ce14b45afb5995f0c3d925aa3ef4d0810b
Reviewed-on: https://chromium-review.googlesource.com/1150032
Commit-Queue: Leonard Ge <wangge@google.com>
Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Reviewed-by: default avatarJuan Antonio Navarro Pérez <perezju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579390}
parent e3e28104
# Copyright 2015 The Chromium Authors. All rights reserved. # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import json import json
import os import os
import sys import sys
...@@ -15,6 +14,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', ...@@ -15,6 +14,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..',
'..', 'variations')) '..', 'variations'))
import fieldtrial_util # pylint: disable=import-error import fieldtrial_util # pylint: disable=import-error
# This function returns a list of two-tuples designed to extend # This function returns a list of two-tuples designed to extend
# browser_options.profile_files_to_copy. On success, it will return two entries: # browser_options.profile_files_to_copy. On success, it will return two entries:
# 1. The actual indexed ruleset file, which will be placed in a destination # 1. The actual indexed ruleset file, which will be placed in a destination
...@@ -22,7 +22,7 @@ import fieldtrial_util # pylint: disable=import-error ...@@ -22,7 +22,7 @@ import fieldtrial_util # pylint: disable=import-error
# 2. A default prefs 'Local State' file, which contains information about the ad # 2. A default prefs 'Local State' file, which contains information about the ad
# tagging ruleset's version. # tagging ruleset's version.
def GetAdTaggingProfileFiles(chrome_output_directory): def GetAdTaggingProfileFiles(chrome_output_directory):
"""Gets ad tagging tuples for browser_options.profile_files_to_copy """Gets ad tagging tuples for browser_options.profile_files_to_copy.
This function looks for input files related to ad tagging, and returns tuples This function looks for input files related to ad tagging, and returns tuples
indicating where those files should be copied to in the resulting perf indicating where those files should be copied to in the resulting perf
...@@ -41,7 +41,7 @@ def GetAdTaggingProfileFiles(chrome_output_directory): ...@@ -41,7 +41,7 @@ def GetAdTaggingProfileFiles(chrome_output_directory):
return [] return []
ruleset_path = os.path.join(chrome_output_directory, 'gen', 'components', ruleset_path = os.path.join(chrome_output_directory, 'gen', 'components',
'subresource_filter', 'tools','GeneratedRulesetData') 'subresource_filter', 'tools', 'GeneratedRulesetData')
if not os.path.exists(ruleset_path): if not os.path.exists(ruleset_path):
return [] return []
...@@ -72,7 +72,7 @@ class PerfBenchmark(benchmark.Benchmark): ...@@ -72,7 +72,7 @@ class PerfBenchmark(benchmark.Benchmark):
""" """
def SetExtraBrowserOptions(self, options): def SetExtraBrowserOptions(self, options):
""" To be overridden by perf benchmarks. """ """To be overridden by perf benchmarks."""
pass pass
def CustomizeBrowserOptions(self, options): def CustomizeBrowserOptions(self, options):
...@@ -90,7 +90,7 @@ class PerfBenchmark(benchmark.Benchmark): ...@@ -90,7 +90,7 @@ class PerfBenchmark(benchmark.Benchmark):
# #
# The same logic applies to the ad filtering ruleset, which could be in a # The same logic applies to the ad filtering ruleset, which could be in a
# binary format that an older build does not expect. # binary format that an older build does not expect.
if options.browser_type != 'reference': if options.browser_type != 'reference' and not options.compatibility_mode:
variations = self._GetVariationsBrowserArgs(options.finder_options) variations = self._GetVariationsBrowserArgs(options.finder_options)
options.AppendExtraBrowserArgs(variations) options.AppendExtraBrowserArgs(variations)
...@@ -134,7 +134,7 @@ class PerfBenchmark(benchmark.Benchmark): ...@@ -134,7 +134,7 @@ class PerfBenchmark(benchmark.Benchmark):
possible_directories = path_module.GetBuildDirectories(chrome_src_dir) possible_directories = path_module.GetBuildDirectories(chrome_src_dir)
# Special case "android-chromium" and "any" and check all # Special case "android-chromium" and "any" and check all
# possible out directories. # possible out directories.
if browser_type in ("android-chromium", "any"): if browser_type in ('android-chromium', 'any'):
return possible_directories return possible_directories
# For all other browser types, just consider directories which match. # For all other browser types, just consider directories which match.
...@@ -142,11 +142,13 @@ class PerfBenchmark(benchmark.Benchmark): ...@@ -142,11 +142,13 @@ class PerfBenchmark(benchmark.Benchmark):
if os.path.basename(p).lower() == browser_type) if os.path.basename(p).lower() == browser_type)
def _GetOutDirectoryEstimate(self, options): def _GetOutDirectoryEstimate(self, options):
"""Gets an estimate of the output directory for this build """Gets an estimate of the output directory for this build.
Note that as an estimate, this may be incorrect. Callers should be aware of Note that as an estimate, this may be incorrect. Callers should be aware of
this and ensure that in the case that this returns an existing but this and ensure that in the case that this returns an existing but
incorrect directory, nothing should critically break.""" incorrect directory, nothing should critically break.
"""
finder_options = options.finder_options finder_options = options.finder_options
if finder_options.chromium_output_dir is not None: if finder_options.chromium_output_dir is not None:
return finder_options.chromium_output_dir return finder_options.chromium_output_dir
......
...@@ -90,6 +90,16 @@ class PerfBenchmarkTest(unittest.TestCase): ...@@ -90,6 +90,16 @@ class PerfBenchmarkTest(unittest.TestCase):
for arg in expected_args: for arg in expected_args:
self.assertNotIn(arg, options.browser_options.extra_browser_args) self.assertNotIn(arg, options.browser_options.extra_browser_args)
def testVariationArgsCompatibilityMode(self):
benchmark = perf_benchmark.PerfBenchmark()
options = options_for_unittests.GetCopy()
options.browser_options.compatibility_mode = True
benchmark.CustomizeBrowserOptions(options.browser_options)
extra_args = options.browser_options.extra_browser_args
feature_args = [a for a in extra_args if a.startswith('--enable-features')]
self.assertEqual(0, len(feature_args))
def testNoAdTaggingRuleset(self): def testNoAdTaggingRuleset(self):
benchmark = perf_benchmark.PerfBenchmark() benchmark = perf_benchmark.PerfBenchmark()
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
......
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