Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: tools/bisect-perf-regression_test.py

Issue 536553003: Parse Git hash for dependency repositories from DEPS file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tools/bisect-perf-regression.py ('K') | « tools/bisect-perf-regression.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bisect-perf-regression_test.py
diff --git a/tools/bisect-perf-regression_test.py b/tools/bisect-perf-regression_test.py
index 51cf7a41af60c6a42764351873680b952e52850a..48a2cf5da4ebac91c0b99e1cdd7b5072ecaab308 100644
--- a/tools/bisect-perf-regression_test.py
+++ b/tools/bisect-perf-regression_test.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import os
+import re
import unittest
from auto_bisect import source_control as source_control_module
@@ -10,6 +11,25 @@ from auto_bisect import source_control as source_control_module
# Special import necessary because filename contains dash characters.
bisect_perf_module = __import__('bisect-perf-regression')
+def GetBisectPerformanceMetricsInstance():
+ """Returns an instance of BisectPerformanceMetrics class."""
qyearsley 2014/09/04 18:42:36 Formatting nit: extra space. (And maybe it should
prasadv 2014/09/04 18:58:42 Done.
+ options_dict = {
+ 'debug_ignore_build': True,
+ 'debug_ignore_sync': True,
+ 'debug_ignore_perf_test': True,
+ 'command': 'fake_command',
+ 'metric': 'fake/metric',
+ 'good_revision': 280000,
+ 'bad_revision': 280005,
+ }
+ bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict)
+ source_control = source_control_module.DetermineAndCreateSourceControl(
+ bisect_options)
+ bisect_instance = bisect_perf_module.BisectPerformanceMetrics(
+ source_control, bisect_options)
+ bisect_instance.src_cwd = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), os.path.pardir))
+ return bisect_instance
qyearsley 2014/09/04 18:42:36 Formatting nit: Two blank spaces between top-level
prasadv 2014/09/04 18:58:42 Done.
class BisectPerfRegressionTest(unittest.TestCase):
"""Test case for other functions and classes in bisect-perf-regression.py."""
@@ -227,48 +247,43 @@ class BisectPerfRegressionTest(unittest.TestCase):
This serves as a smoke test to catch errors in the basic execution of the
script.
"""
- options_dict = {
- 'debug_ignore_build': True,
- 'debug_ignore_sync': True,
- 'debug_ignore_perf_test': True,
- 'command': 'fake_command',
- 'metric': 'fake/metric',
- 'good_revision': 280000,
- 'bad_revision': 280005,
- }
- bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict)
- source_control = source_control_module.DetermineAndCreateSourceControl(
- bisect_options)
- bisect_instance = bisect_perf_module.BisectPerformanceMetrics(
- source_control, bisect_options)
- bisect_instance.src_cwd = os.path.abspath(
- os.path.join(os.path.dirname(__file__), '..'))
- results = bisect_instance.Run(bisect_options.command,
- bisect_options.bad_revision,
- bisect_options.good_revision,
- bisect_options.metric)
+ bisect_instance = GetBisectPerformanceMetricsInstance()
+ results = bisect_instance.Run(bisect_instance.opts.command,
+ bisect_instance.opts.bad_revision,
+ bisect_instance.opts.good_revision,
+ bisect_instance.opts.metric)
bisect_instance.FormatAndPrintResults(results)
def testSVNFindRev(self):
"""Determine numerical SVN revision or Commit Position."""
- options_dict = {
- 'debug_ignore_build': True,
- 'debug_ignore_sync': True,
- 'debug_ignore_perf_test': True,
- 'command': 'fake_command',
- 'metric': 'fake/metric',
- 'good_revision': 280000,
- 'bad_revision': 280005,
- }
- bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict)
- source_control = source_control_module.DetermineAndCreateSourceControl(
- bisect_options)
-
+ bisect_instance = GetBisectPerformanceMetricsInstance()
cp_git_rev = '7017a81991de983e12ab50dfc071c70e06979531'
- self.assertEqual(291765, source_control.SVNFindRev(cp_git_rev))
+ self.assertEqual(291765,
+ bisect_instance.source_control.SVNFindRev(cp_git_rev))
svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58'
- self.assertEqual(291467, source_control.SVNFindRev(svn_git_rev))
+ self.assertEqual(291467,
+ bisect_instance.source_control.SVNFindRev(svn_git_rev))
+
+ def testUpdateDepsContent(self):
+ bisect_instance = GetBisectPerformanceMetricsInstance()
+ deps_file = 'DEPS'
+ # We are intentionally reading DEPS file contents instead of string literal
+ # with few lines from DEPS because to check if the format we are expecting
+ # to search is not changed in DEPS content.
+ # TODO (prasadv): Add a separate test to validate the DEPS contents with the
+ # format that bisect script expects.
+ deps_contents = bisect_perf_module.ReadStringFromFile(deps_file)
+ deps_key = 'v8_revision'
+ depot = 'v8'
+ git_revision = 'a12345789a23456789a123456789a123456789'
+ updated_content = bisect_instance.UpdateDepsContents(
+ deps_contents, depot, git_revision, deps_key)
+ self.assertIsNotNone(updated_content)
+ ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision))
+ self.assertIsNotNone(re.search(ss, updated_content))
+
+
qyearsley 2014/09/04 18:42:36 Formatting nit: should be 2 blank lines rather tha
prasadv 2014/09/04 18:58:42 Done.
if __name__ == '__main__':
unittest.main()
« tools/bisect-perf-regression.py ('K') | « tools/bisect-perf-regression.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698