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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 | 474 |
475 @mock.patch('bisect_utils.RunGit') | 475 @mock.patch('bisect_utils.RunGit') |
476 def testSyncToRevisionForWebKit(self, mock_RunGit): | 476 def testSyncToRevisionForWebKit(self, mock_RunGit): |
477 bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS) | 477 bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS) |
478 mock_RunGit.return_value = None, None | 478 mock_RunGit.return_value = None, None |
479 bisect_instance._SyncRevision( | 479 bisect_instance._SyncRevision( |
480 'webkit', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61' , None) | 480 'webkit', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61' , None) |
481 expected_params = ['checkout', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61'] | 481 expected_params = ['checkout', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61'] |
482 mock_RunGit.assert_called_with(expected_params) | 482 mock_RunGit.assert_called_with(expected_params) |
483 | 483 |
484 def test_TryJobSvnRepo_Perf(self): | |
485 self.assertEqual(bisect_perf_regression.PERF_SVN_REPO_URL, | |
486 bisect_perf_regression._TryJobSvnRepo(fetch_build.PERF_BUILDER)) | |
487 | |
488 def test_TryJobSvnRepo_Full(self): | |
489 self.assertEqual(bisect_perf_regression.FULL_SVN_REPO_URL, | |
490 bisect_perf_regression._TryJobSvnRepo(fetch_build.FULL_BUILDER)) | |
qyearsley
2015/03/10 23:52:32
Optional:
def testTryJobSvnRepoWithUnknownBuilder
prasadv
2015/03/11 18:50:39
Done.
| |
491 | |
492 def test_IsDownloadable_Chromium(self): | |
493 opts = dict(DEFAULT_OPTIONS) | |
494 opts.update({'builder_type': 'perf'}) | |
495 bisect_instance = _GetBisectPerformanceMetricsInstance(opts) | |
496 self.assertTrue(bisect_instance.IsDownloadable('chromium')) | |
497 | |
498 def test_IsDownloadable_No_BuilderType(self): | |
qyearsley
2015/03/10 23:52:32
Although I like underscores in test method names,
prasadv
2015/03/11 18:50:39
Done.
| |
499 opts = dict(DEFAULT_OPTIONS) | |
500 opts.update({'builder_type': ''}) | |
501 bisect_instance = _GetBisectPerformanceMetricsInstance(opts) | |
502 self.assertFalse(bisect_instance.IsDownloadable('chromium')) | |
503 | |
504 def test_IsDownloadable_DEPS(self): | |
505 opts = dict(DEFAULT_OPTIONS) | |
506 opts.update({'builder_type': 'perf'}) | |
507 bisect_instance = _GetBisectPerformanceMetricsInstance(opts) | |
508 self.assertTrue(bisect_instance.IsDownloadable('v8')) | |
509 | |
510 def test_IsDownloadable_android_chrome(self): | |
511 opts = dict(DEFAULT_OPTIONS) | |
512 opts.update({'target_platform': 'android-chrome', 'builder_type': 'perf'}) | |
513 bisect_instance = _GetBisectPerformanceMetricsInstance(opts) | |
514 self.assertTrue(bisect_instance.IsDownloadable('android-chrome')) | |
515 | |
516 def test_IsDownloadable_android_chrome_DEPS_Chromium(self): | |
517 opts = dict(DEFAULT_OPTIONS) | |
518 opts.update({'target_platform': 'android-chrome', 'builder_type': 'perf'}) | |
519 bisect_instance = _GetBisectPerformanceMetricsInstance(opts) | |
520 self.assertFalse(bisect_instance.IsDownloadable('Chromium')) | |
521 | |
522 def test_IsDownloadable_android_chrome_DEPS_V8(self): | |
523 opts = dict(DEFAULT_OPTIONS) | |
524 opts.update({'target_platform': 'android-chrome', 'builder_type': 'perf'}) | |
525 bisect_instance = _GetBisectPerformanceMetricsInstance(opts) | |
526 self.assertFalse(bisect_instance.IsDownloadable('v8')) | |
qyearsley
2015/03/10 23:52:32
I like the fact that these test methods are quite
prasadv
2015/03/11 18:50:38
Done.
| |
527 | |
484 | 528 |
485 class DepotDirectoryRegistryTest(unittest.TestCase): | 529 class DepotDirectoryRegistryTest(unittest.TestCase): |
486 | 530 |
487 def setUp(self): | 531 def setUp(self): |
488 self.old_chdir = os.chdir | 532 self.old_chdir = os.chdir |
489 os.chdir = self.mockChdir | 533 os.chdir = self.mockChdir |
490 self.old_depot_names = bisect_utils.DEPOT_NAMES | 534 self.old_depot_names = bisect_utils.DEPOT_NAMES |
491 bisect_utils.DEPOT_NAMES = ['mock_depot'] | 535 bisect_utils.DEPOT_NAMES = ['mock_depot'] |
492 self.old_depot_deps_name = bisect_utils.DEPOT_DEPS_NAME | 536 self.old_depot_deps_name = bisect_utils.DEPOT_DEPS_NAME |
493 bisect_utils.DEPOT_DEPS_NAME = {'mock_depot': {'src': 'src/foo'}} | 537 bisect_utils.DEPOT_DEPS_NAME = {'mock_depot': {'src': 'src/foo'}} |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
664 ], (None, 0)), | 708 ], (None, 0)), |
665 ] | 709 ] |
666 self._SetupRunGitMock(try_cmd) | 710 self._SetupRunGitMock(try_cmd) |
667 bisect_perf_regression._StartBuilderTryJob( | 711 bisect_perf_regression._StartBuilderTryJob( |
668 fetch_build.PERF_BUILDER, git_revision, bot_name, bisect_job_name, | 712 fetch_build.PERF_BUILDER, git_revision, bot_name, bisect_job_name, |
669 patch) | 713 patch) |
670 | 714 |
671 | 715 |
672 if __name__ == '__main__': | 716 if __name__ == '__main__': |
673 unittest.main() | 717 unittest.main() |
OLD | NEW |