| 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 unittest | 6 import unittest |
| 6 | 7 |
| 7 from auto_bisect import source_control as source_control_module | 8 from auto_bisect import source_control as source_control_module |
| 8 | 9 |
| 9 # Special import necessary because filename contains dash characters. | 10 # Special import necessary because filename contains dash characters. |
| 10 bisect_perf_module = __import__('bisect-perf-regression') | 11 bisect_perf_module = __import__('bisect-perf-regression') |
| 11 | 12 |
| 12 | 13 |
| 13 class BisectPerfRegressionTest(unittest.TestCase): | 14 class BisectPerfRegressionTest(unittest.TestCase): |
| 14 """Test case for other functions and classes in bisect-perf-regression.py.""" | 15 """Test case for other functions and classes in bisect-perf-regression.py.""" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 'command': 'fake_command', | 234 'command': 'fake_command', |
| 234 'metric': 'fake/metric', | 235 'metric': 'fake/metric', |
| 235 'good_revision': 280000, | 236 'good_revision': 280000, |
| 236 'bad_revision': 280005, | 237 'bad_revision': 280005, |
| 237 } | 238 } |
| 238 bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) | 239 bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) |
| 239 source_control = source_control_module.DetermineAndCreateSourceControl( | 240 source_control = source_control_module.DetermineAndCreateSourceControl( |
| 240 bisect_options) | 241 bisect_options) |
| 241 bisect_instance = bisect_perf_module.BisectPerformanceMetrics( | 242 bisect_instance = bisect_perf_module.BisectPerformanceMetrics( |
| 242 source_control, bisect_options) | 243 source_control, bisect_options) |
| 244 bisect_instance.src_cwd = os.path.abspath( |
| 245 os.path.join(os.path.dirname(__file__), '..')) |
| 243 results = bisect_instance.Run(bisect_options.command, | 246 results = bisect_instance.Run(bisect_options.command, |
| 244 bisect_options.bad_revision, | 247 bisect_options.bad_revision, |
| 245 bisect_options.good_revision, | 248 bisect_options.good_revision, |
| 246 bisect_options.metric) | 249 bisect_options.metric) |
| 247 bisect_instance.FormatAndPrintResults(results) | 250 bisect_instance.FormatAndPrintResults(results) |
| 248 | 251 |
| 252 def testSVNFindRev(self): |
| 253 """Determine numerical SVN revision or Commit Position.""" |
| 254 options_dict = { |
| 255 'debug_ignore_build': True, |
| 256 'debug_ignore_sync': True, |
| 257 'debug_ignore_perf_test': True, |
| 258 'command': 'fake_command', |
| 259 'metric': 'fake/metric', |
| 260 'good_revision': 280000, |
| 261 'bad_revision': 280005, |
| 262 } |
| 263 bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) |
| 264 source_control = source_control_module.DetermineAndCreateSourceControl( |
| 265 bisect_options) |
| 266 |
| 267 cp_git_rev = '7017a81991de983e12ab50dfc071c70e06979531' |
| 268 self.assertEqual(291915, source_control.SVNFindRev(cp_git_rev)) |
| 269 |
| 270 svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58' |
| 271 self.assertEqual(291467, source_control.SVNFindRev(svn_git_rev)) |
| 249 | 272 |
| 250 if __name__ == '__main__': | 273 if __name__ == '__main__': |
| 251 unittest.main() | 274 unittest.main() |
| OLD | NEW |