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 re |
7 import unittest | 7 import unittest |
8 | 8 |
9 from auto_bisect import source_control as source_control_module | 9 from auto_bisect import source_control as source_control_module |
10 | 10 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 script. | 249 script. |
250 """ | 250 """ |
251 bisect_instance = _GetBisectPerformanceMetricsInstance() | 251 bisect_instance = _GetBisectPerformanceMetricsInstance() |
252 results = bisect_instance.Run(bisect_instance.opts.command, | 252 results = bisect_instance.Run(bisect_instance.opts.command, |
253 bisect_instance.opts.bad_revision, | 253 bisect_instance.opts.bad_revision, |
254 bisect_instance.opts.good_revision, | 254 bisect_instance.opts.good_revision, |
255 bisect_instance.opts.metric) | 255 bisect_instance.opts.metric) |
256 bisect_instance.FormatAndPrintResults(results) | 256 bisect_instance.FormatAndPrintResults(results) |
257 | 257 |
258 def testSVNFindRev(self): | 258 def testSVNFindRev(self): |
259 """Determine numerical SVN revision or Commit Position.""" | 259 """Determine numerical SVN revision or Commit Position.""" |
qyearsley
2014/09/10 01:04:14
Note, this docstring doesn't really describe what
prasadv
2014/09/10 17:16:33
It should run in a directory where that git hash b
qyearsley
2014/09/10 17:49:53
Alright, sounds good.
| |
260 bisect_instance = _GetBisectPerformanceMetricsInstance() | 260 bisect_instance = _GetBisectPerformanceMetricsInstance() |
261 cp_git_rev = '7017a81991de983e12ab50dfc071c70e06979531' | 261 cp_git_rev = '7017a81991de983e12ab50dfc071c70e06979531' |
262 self.assertEqual(291765, | 262 self.assertEqual(291765, |
263 bisect_instance.source_control.SVNFindRev(cp_git_rev)) | 263 bisect_instance.source_control.SVNFindRev(cp_git_rev)) |
264 | 264 |
265 svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58' | 265 svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58' |
266 self.assertEqual(291467, | 266 self.assertEqual(291467, |
267 bisect_instance.source_control.SVNFindRev(svn_git_rev)) | 267 bisect_instance.source_control.SVNFindRev(svn_git_rev)) |
qyearsley
2014/09/10 01:04:14
What about SVN revs from before the Cr-Commit-Posi
prasadv
2014/09/10 17:16:33
git footers will find both svn and commit position
qyearsley
2014/09/10 17:49:53
Nice, I just tested this, it works.
$ git footers
| |
268 | 268 |
269 svn_v8_rev = '21d700eedcdd6570eff22ece724b63a5eefe78cb' | |
270 depot_path = os.path.join(bisect_instance.src_cwd, 'src', 'v8') | |
271 self.assertEqual( | |
272 23634, | |
273 bisect_instance.source_control.SVNFindRev(svn_v8_rev, depot_path)) | |
274 | |
275 svn_wk_rev = 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61' | |
276 depot_path = os.path.join(bisect_instance.src_cwd, 'src', 'third_party', | |
277 'WebKit') | |
278 self.assertEqual( | |
279 181660, | |
280 bisect_instance.source_control.SVNFindRev(svn_wk_rev, depot_path)) | |
qyearsley
2014/09/10 01:04:14
Each of these could be separate test methods --
prasadv
2014/09/10 17:16:33
Done.
| |
281 | |
282 | |
283 | |
qyearsley
2014/09/10 01:04:14
Formatting: One blank line between methods.
prasadv
2014/09/10 17:16:33
Done.
| |
269 def testUpdateDepsContent(self): | 284 def testUpdateDepsContent(self): |
270 bisect_instance = _GetBisectPerformanceMetricsInstance() | 285 bisect_instance = _GetBisectPerformanceMetricsInstance() |
271 deps_file = 'DEPS' | 286 deps_file = 'DEPS' |
272 # We are intentionally reading DEPS file contents instead of string literal | 287 # We are intentionally reading DEPS file contents instead of string literal |
273 # with few lines from DEPS because to check if the format we are expecting | 288 # with few lines from DEPS because to check if the format we are expecting |
274 # to search is not changed in DEPS content. | 289 # to search is not changed in DEPS content. |
275 # TODO (prasadv): Add a separate test to validate the DEPS contents with the | 290 # TODO (prasadv): Add a separate test to validate the DEPS contents with the |
276 # format that bisect script expects. | 291 # format that bisect script expects. |
277 deps_contents = bisect_perf_module.ReadStringFromFile(deps_file) | 292 deps_contents = bisect_perf_module.ReadStringFromFile(deps_file) |
278 deps_key = 'v8_revision' | 293 deps_key = 'v8_revision' |
279 depot = 'v8' | 294 depot = 'v8' |
280 git_revision = 'a12345789a23456789a123456789a123456789' | 295 git_revision = 'a12345789a23456789a123456789a123456789' |
281 updated_content = bisect_instance.UpdateDepsContents( | 296 updated_content = bisect_instance.UpdateDepsContents( |
282 deps_contents, depot, git_revision, deps_key) | 297 deps_contents, depot, git_revision, deps_key) |
283 self.assertIsNotNone(updated_content) | 298 self.assertIsNotNone(updated_content) |
284 ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision)) | 299 ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision)) |
285 self.assertIsNotNone(re.search(ss, updated_content)) | 300 self.assertIsNotNone(re.search(ss, updated_content)) |
286 | 301 |
287 | 302 |
288 if __name__ == '__main__': | 303 if __name__ == '__main__': |
289 unittest.main() | 304 unittest.main() |
OLD | NEW |