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 |
11 SRC = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir) | 11 SRC = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir) |
12 sys.path.append(os.path.join(SRC, 'third_party', 'pymock')) | 12 sys.path.append(os.path.join(SRC, 'third_party', 'pymock')) |
13 | 13 |
14 import bisect_perf_regression | 14 import bisect_perf_regression |
15 import bisect_utils | 15 import bisect_utils |
| 16 import fetch_build |
16 import mock | 17 import mock |
17 import source_control | 18 import source_control |
18 | 19 |
19 | 20 |
20 # Regression confidence: 0% | 21 # Regression confidence: 0% |
21 CLEAR_NON_REGRESSION = [ | 22 CLEAR_NON_REGRESSION = [ |
22 # Mean: 30.223 Std. Dev.: 11.383 | 23 # Mean: 30.223 Std. Dev.: 11.383 |
23 [[16.886], [16.909], [16.99], [17.723], [17.952], [18.118], [19.028], | 24 [[16.886], [16.909], [16.99], [17.723], [17.952], [18.118], [19.028], |
24 [19.552], [21.954], [38.573], [38.839], [38.965], [40.007], [40.572], | 25 [19.552], [21.954], [38.573], [38.839], [38.965], [40.007], [40.572], |
25 [41.491], [42.002], [42.33], [43.109], [43.238]], | 26 [41.491], [42.002], [42.33], [43.109], [43.238]], |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 (['update-index', '--refresh', '-q'], (None, 0)), | 578 (['update-index', '--refresh', '-q'], (None, 0)), |
578 (['diff-index', 'HEAD'], (None, 0)), | 579 (['diff-index', 'HEAD'], (None, 0)), |
579 (['checkout', '-b', new_branch], ('None', 0)), | 580 (['checkout', '-b', new_branch], ('None', 0)), |
580 (['branch', '--set-upstream-to', parent_branch], | 581 (['branch', '--set-upstream-to', parent_branch], |
581 ('Setuptream fails', 1)), | 582 ('Setuptream fails', 1)), |
582 ] | 583 ] |
583 self._AssertRunGitExceptions(cmds, | 584 self._AssertRunGitExceptions(cmds, |
584 bisect_perf_regression._PrepareBisectBranch, | 585 bisect_perf_regression._PrepareBisectBranch, |
585 parent_branch, new_branch) | 586 parent_branch, new_branch) |
586 | 587 |
587 def testBuilderTryJobForException(self): | 588 def testStartBuilderTryJobForException(self): |
588 git_revision = 'ac4a9f31fe2610bd146857bbd55d7a260003a888' | 589 git_revision = 'ac4a9f31fe2610bd146857bbd55d7a260003a888' |
589 bot_name = 'linux_perf_bisect_builder' | 590 bot_name = 'linux_perf_bisect_builder' |
590 bisect_job_name = 'testBisectJobname' | 591 bisect_job_name = 'testBisectJobname' |
591 patch = None | 592 patch = None |
592 patch_content = '/dev/null' | 593 patch_content = '/dev/null' |
593 new_branch = bisect_perf_regression.BISECT_TRYJOB_BRANCH | 594 new_branch = bisect_perf_regression.BISECT_TRYJOB_BRANCH |
594 parent_branch = bisect_perf_regression.BISECT_MASTER_BRANCH | 595 parent_branch = bisect_perf_regression.BISECT_MASTER_BRANCH |
595 try_cmd = [ | 596 try_cmd = [ |
596 (['rev-parse', '--abbrev-ref', 'HEAD'], (parent_branch, 0)), | 597 (['rev-parse', '--abbrev-ref', 'HEAD'], (parent_branch, 0)), |
597 (['branch', '--list'], ('bisect-tryjob\n*master\nsomebranch', 0)), | 598 (['branch', '--list'], ('bisect-tryjob\n*master\nsomebranch', 0)), |
598 (['branch', '-D', new_branch], ('None', 0)), | 599 (['branch', '-D', new_branch], ('None', 0)), |
599 (['update-index', '--refresh', '-q'], (None, 0)), | 600 (['update-index', '--refresh', '-q'], (None, 0)), |
600 (['diff-index', 'HEAD'], (None, 0)), | 601 (['diff-index', 'HEAD'], (None, 0)), |
601 (['checkout', '-b', new_branch], ('None', 0)), | 602 (['checkout', '-b', new_branch], ('None', 0)), |
602 (['branch', '--set-upstream-to', parent_branch], | 603 (['branch', '--set-upstream-to', parent_branch], |
603 ('Setuptream fails', 0)), | 604 ('Setuptream fails', 0)), |
604 (['try', | 605 (['try', |
605 '-b', bot_name, | 606 '--bot=%s' % bot_name, |
606 '-r', git_revision, | 607 '--revision=%s' % git_revision, |
607 '-n', bisect_job_name, | 608 '--name=%s' % bisect_job_name, |
608 '--svn_repo=%s' % bisect_perf_regression.SVN_REPO_URL, | 609 '--svn_repo=%s' % bisect_perf_regression.PERF_SVN_REPO_URL, |
609 '--diff=%s' % patch_content | 610 '--diff=%s' % patch_content |
610 ], (None, 1)), | 611 ], (None, 1)), |
611 ] | 612 ] |
612 self._AssertRunGitExceptions(try_cmd, | 613 self._AssertRunGitExceptions( |
613 bisect_perf_regression._BuilderTryjob, | 614 try_cmd, bisect_perf_regression._StartBuilderTryJob, |
614 git_revision, bot_name, bisect_job_name, patch) | 615 fetch_build.PERF_BUILDER, git_revision, bot_name, bisect_job_name, |
| 616 patch) |
615 | 617 |
616 def testBuilderTryJob(self): | 618 def testBuilderTryJob(self): |
617 git_revision = 'ac4a9f31fe2610bd146857bbd55d7a260003a888' | 619 git_revision = 'ac4a9f31fe2610bd146857bbd55d7a260003a888' |
618 bot_name = 'linux_perf_bisect_builder' | 620 bot_name = 'linux_perf_bisect_builder' |
619 bisect_job_name = 'testBisectJobname' | 621 bisect_job_name = 'testBisectJobname' |
620 patch = None | 622 patch = None |
621 patch_content = '/dev/null' | 623 patch_content = '/dev/null' |
622 new_branch = bisect_perf_regression.BISECT_TRYJOB_BRANCH | 624 new_branch = bisect_perf_regression.BISECT_TRYJOB_BRANCH |
623 parent_branch = bisect_perf_regression.BISECT_MASTER_BRANCH | 625 parent_branch = bisect_perf_regression.BISECT_MASTER_BRANCH |
624 try_cmd = [ | 626 try_cmd = [ |
625 (['rev-parse', '--abbrev-ref', 'HEAD'], (parent_branch, 0)), | 627 (['rev-parse', '--abbrev-ref', 'HEAD'], (parent_branch, 0)), |
626 (['branch', '--list'], ('bisect-tryjob\n*master\nsomebranch', 0)), | 628 (['branch', '--list'], ('bisect-tryjob\n*master\nsomebranch', 0)), |
627 (['branch', '-D', new_branch], ('None', 0)), | 629 (['branch', '-D', new_branch], ('None', 0)), |
628 (['update-index', '--refresh', '-q'], (None, 0)), | 630 (['update-index', '--refresh', '-q'], (None, 0)), |
629 (['diff-index', 'HEAD'], (None, 0)), | 631 (['diff-index', 'HEAD'], (None, 0)), |
630 (['checkout', '-b', new_branch], ('None', 0)), | 632 (['checkout', '-b', new_branch], ('None', 0)), |
631 (['branch', '--set-upstream-to', parent_branch], | 633 (['branch', '--set-upstream-to', parent_branch], |
632 ('Setuptream fails', 0)), | 634 ('Setuptream fails', 0)), |
633 (['try', | 635 (['try', |
634 '-b', bot_name, | 636 '--bot=%s' % bot_name, |
635 '-r', git_revision, | 637 '--revision=%s' % git_revision, |
636 '-n', bisect_job_name, | 638 '--name=%s' % bisect_job_name, |
637 '--svn_repo=%s' % bisect_perf_regression.SVN_REPO_URL, | 639 '--svn_repo=%s' % bisect_perf_regression.PERF_SVN_REPO_URL, |
638 '--diff=%s' % patch_content | 640 '--diff=%s' % patch_content |
639 ], (None, 0)), | 641 ], (None, 0)), |
640 ] | 642 ] |
641 self._SetupRunGitMock(try_cmd) | 643 self._SetupRunGitMock(try_cmd) |
642 bisect_perf_regression._BuilderTryjob( | 644 bisect_perf_regression._StartBuilderTryJob( |
643 git_revision, bot_name, bisect_job_name, patch) | 645 fetch_build.PERF_BUILDER, git_revision, bot_name, bisect_job_name, |
| 646 patch) |
644 | 647 |
645 | 648 |
646 if __name__ == '__main__': | 649 if __name__ == '__main__': |
647 unittest.main() | 650 unittest.main() |
648 | 651 |
OLD | NEW |