Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import re | |
| 6 import unittest | 7 import unittest |
| 7 | 8 |
| 8 from auto_bisect import source_control as source_control_module | 9 from auto_bisect import source_control as source_control_module |
| 9 | 10 |
| 10 # Special import necessary because filename contains dash characters. | 11 # Special import necessary because filename contains dash characters. |
| 11 bisect_perf_module = __import__('bisect-perf-regression') | 12 bisect_perf_module = __import__('bisect-perf-regression') |
| 12 | 13 |
| 13 | 14 |
| 14 class BisectPerfRegressionTest(unittest.TestCase): | 15 class BisectPerfRegressionTest(unittest.TestCase): |
| 15 """Test case for other functions and classes in bisect-perf-regression.py.""" | 16 """Test case for other functions and classes in bisect-perf-regression.py.""" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) | 264 bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) |
| 264 source_control = source_control_module.DetermineAndCreateSourceControl( | 265 source_control = source_control_module.DetermineAndCreateSourceControl( |
| 265 bisect_options) | 266 bisect_options) |
| 266 | 267 |
| 267 cp_git_rev = '7017a81991de983e12ab50dfc071c70e06979531' | 268 cp_git_rev = '7017a81991de983e12ab50dfc071c70e06979531' |
| 268 self.assertEqual(291765, source_control.SVNFindRev(cp_git_rev)) | 269 self.assertEqual(291765, source_control.SVNFindRev(cp_git_rev)) |
| 269 | 270 |
| 270 svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58' | 271 svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58' |
| 271 self.assertEqual(291467, source_control.SVNFindRev(svn_git_rev)) | 272 self.assertEqual(291467, source_control.SVNFindRev(svn_git_rev)) |
| 272 | 273 |
| 274 def testUpdateDepsContent(self): | |
| 275 """Updates DEPS file content.""" | |
|
qyearsley
2014/09/03 23:08:18
If we have a docstring here (which I guess is unnc
prasadv
2014/09/03 23:22:41
Removed doc string:)
On 2014/09/03 23:08:18, qyear
| |
| 276 options_dict = { | |
| 277 'debug_ignore_build': True, | |
| 278 'debug_ignore_sync': True, | |
| 279 'debug_ignore_perf_test': True, | |
| 280 'command': 'fake_command', | |
| 281 'metric': 'fake/metric', | |
| 282 'good_revision': 280000, | |
| 283 'bad_revision': 280005, | |
| 284 } | |
| 285 bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) | |
| 286 source_control = source_control_module.DetermineAndCreateSourceControl( | |
| 287 bisect_options) | |
| 288 bisect_instance = bisect_perf_module.BisectPerformanceMetrics( | |
| 289 source_control, bisect_options) | |
|
qyearsley
2014/09/03 22:18:19
In the unit test above maybe there should be a met
prasadv
2014/09/03 22:47:38
Done.
| |
| 290 bisect_instance.src_cwd = os.path.abspath( | |
| 291 os.path.join(os.path.dirname(__file__), os.path.pardir)) | |
| 292 deps_file = 'DEPS' | |
| 293 deps_contents = bisect_perf_module.ReadStringFromFile(deps_file) | |
|
qyearsley
2014/09/03 22:18:19
Are we reading from the "src/DEPS" file here?
I t
prasadv
2014/09/03 22:47:38
Yes, we are reading from src/DEPS.
I added this in
qyearsley
2014/09/03 23:08:18
That makes sense, although that means this test me
prasadv
2014/09/03 23:22:41
Done.
| |
| 294 deps_key = 'v8_revision' | |
| 295 depot = 'v8' | |
| 296 git_revision = 'abcdefghijklmnopqrstuvwxyz12347890ABCD' | |
|
qyearsley
2014/09/03 22:18:20
This doesn't match the actual pattern of a SHA1 ha
prasadv
2014/09/03 22:47:38
Yes, this is intentional to check if we actually w
qyearsley
2014/09/03 23:08:18
Okay, although it might be a bit confusing that it
prasadv
2014/09/03 23:22:41
Done.
| |
| 297 updated_content = bisect_instance.UpdateDepsContents( | |
| 298 deps_contents, depot, git_revision, deps_key) | |
| 299 self.assertIsNotNone(updated_content) | |
| 300 ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision)) | |
| 301 self.assertIsNotNone(re.search(ss, updated_content)) | |
| 302 | |
| 303 | |
| 304 | |
| 273 if __name__ == '__main__': | 305 if __name__ == '__main__': |
| 274 unittest.main() | 306 unittest.main() |
| OLD | NEW |