| 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 shutil | 7 import shutil |
| 8 import sys | 8 import sys |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 deps_contents = bisect_perf_regression.ReadStringFromFile(deps_file) | 423 deps_contents = bisect_perf_regression.ReadStringFromFile(deps_file) |
| 424 deps_key = 'v8_revision' | 424 deps_key = 'v8_revision' |
| 425 depot = 'v8' | 425 depot = 'v8' |
| 426 git_revision = 'a12345789a23456789a123456789a123456789' | 426 git_revision = 'a12345789a23456789a123456789a123456789' |
| 427 updated_content = bisect_instance.UpdateDepsContents( | 427 updated_content = bisect_instance.UpdateDepsContents( |
| 428 deps_contents, depot, git_revision, deps_key) | 428 deps_contents, depot, git_revision, deps_key) |
| 429 self.assertIsNotNone(updated_content) | 429 self.assertIsNotNone(updated_content) |
| 430 ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision)) | 430 ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision)) |
| 431 self.assertIsNotNone(re.search(ss, updated_content)) | 431 self.assertIsNotNone(re.search(ss, updated_content)) |
| 432 | 432 |
| 433 @mock.patch('bisect_utils.RunGClient') |
| 434 def testSyncToRevisionForChromium(self, mock_RunGClient): |
| 435 bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS) |
| 436 bisect_instance._SyncRevision( |
| 437 'chromium', 'e6db23a037cad47299a94b155b95eebd1ee61a58', 'gclient') |
| 438 expected_params = [ |
| 439 'sync', |
| 440 '--verbose', |
| 441 '--nohooks', |
| 442 '--force', |
| 443 '--delete_unversioned_trees', |
| 444 '--revision', |
| 445 'src@e6db23a037cad47299a94b155b95eebd1ee61a58' |
| 446 ] |
| 447 |
| 448 mock_RunGClient.assert_called_with(expected_params, cwd=None) |
| 449 |
| 450 @mock.patch('bisect_utils.RunGit') |
| 451 def testSyncToRevisionForWebKit(self, mock_RunGit): |
| 452 bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS) |
| 453 mock_RunGit.return_value = None, None |
| 454 bisect_instance._SyncRevision( |
| 455 'webkit', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61' , None) |
| 456 expected_params = ['checkout', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61'] |
| 457 mock_RunGit.assert_called_with(expected_params) |
| 458 |
| 433 | 459 |
| 434 class DepotDirectoryRegistryTest(unittest.TestCase): | 460 class DepotDirectoryRegistryTest(unittest.TestCase): |
| 435 | 461 |
| 436 def setUp(self): | 462 def setUp(self): |
| 437 self.old_chdir = os.chdir | 463 self.old_chdir = os.chdir |
| 438 os.chdir = self.mockChdir | 464 os.chdir = self.mockChdir |
| 439 self.old_depot_names = bisect_utils.DEPOT_NAMES | 465 self.old_depot_names = bisect_utils.DEPOT_NAMES |
| 440 bisect_utils.DEPOT_NAMES = ['mock_depot'] | 466 bisect_utils.DEPOT_NAMES = ['mock_depot'] |
| 441 self.old_depot_deps_name = bisect_utils.DEPOT_DEPS_NAME | 467 self.old_depot_deps_name = bisect_utils.DEPOT_DEPS_NAME |
| 442 bisect_utils.DEPOT_DEPS_NAME = {'mock_depot': {'src': 'src/foo'}} | 468 bisect_utils.DEPOT_DEPS_NAME = {'mock_depot': {'src': 'src/foo'}} |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 ], (None, 0)), | 638 ], (None, 0)), |
| 613 ] | 639 ] |
| 614 self._SetupRunGitMock(try_cmd) | 640 self._SetupRunGitMock(try_cmd) |
| 615 bisect_perf_regression._BuilderTryjob( | 641 bisect_perf_regression._BuilderTryjob( |
| 616 git_revision, bot_name, bisect_job_name, patch) | 642 git_revision, bot_name, bisect_job_name, patch) |
| 617 | 643 |
| 618 | 644 |
| 619 if __name__ == '__main__': | 645 if __name__ == '__main__': |
| 620 unittest.main() | 646 unittest.main() |
| 621 | 647 |
| OLD | NEW |