OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Performance Test Bisect Tool | 6 """Performance Test Bisect Tool |
7 | 7 |
8 This script bisects a series of changelists using binary search. It starts at | 8 This script bisects a series of changelists using binary search. It starts at |
9 a bad revision where a performance metric has regressed, and asks for a last | 9 a bad revision where a performance metric has regressed, and asks for a last |
10 known-good revision. It will then binary search across this revision range by | 10 known-good revision. It will then binary search across this revision range by |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 | 914 |
915 self.opts = opts | 915 self.opts = opts |
916 self.source_control = source_control | 916 self.source_control = source_control |
917 self.src_cwd = os.getcwd() | 917 self.src_cwd = os.getcwd() |
918 self.cros_cwd = os.path.join(os.getcwd(), '..', 'cros') | 918 self.cros_cwd = os.path.join(os.getcwd(), '..', 'cros') |
919 self.depot_cwd = {} | 919 self.depot_cwd = {} |
920 self.cleanup_commands = [] | 920 self.cleanup_commands = [] |
921 self.warnings = [] | 921 self.warnings = [] |
922 self.builder = builder.Builder.FromOpts(opts) | 922 self.builder = builder.Builder.FromOpts(opts) |
923 | 923 |
924 # This always starts true since the script grabs latest first. | |
925 self.was_blink = True | |
926 | |
927 for d in DEPOT_NAMES: | 924 for d in DEPOT_NAMES: |
928 # The working directory of each depot is just the path to the depot, but | 925 # The working directory of each depot is just the path to the depot, but |
929 # since we're already in 'src', we can skip that part. | 926 # since we're already in 'src', we can skip that part. |
930 | 927 |
931 self.depot_cwd[d] = os.path.join( | 928 self.depot_cwd[d] = os.path.join( |
932 self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:]) | 929 self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:]) |
933 | 930 |
934 def PerformCleanup(self): | 931 def PerformCleanup(self): |
935 """Performs cleanup when script is finished.""" | 932 """Performs cleanup when script is finished.""" |
936 os.chdir(self.src_cwd) | 933 os.chdir(self.src_cwd) |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 print 'Cleaning up between runs.' | 1766 print 'Cleaning up between runs.' |
1770 print | 1767 print |
1771 | 1768 |
1772 # Leaving these .pyc files around between runs may disrupt some perf tests. | 1769 # Leaving these .pyc files around between runs may disrupt some perf tests. |
1773 for (path, _, files) in os.walk(self.src_cwd): | 1770 for (path, _, files) in os.walk(self.src_cwd): |
1774 for cur_file in files: | 1771 for cur_file in files: |
1775 if cur_file.endswith('.pyc'): | 1772 if cur_file.endswith('.pyc'): |
1776 path_to_file = os.path.join(path, cur_file) | 1773 path_to_file = os.path.join(path, cur_file) |
1777 os.remove(path_to_file) | 1774 os.remove(path_to_file) |
1778 | 1775 |
1779 def PerformWebkitDirectoryCleanup(self, revision): | |
1780 """Cleans up the Webkit directory before syncing another revision. | |
1781 | |
1782 If the script is switching between Blink and WebKit during bisect, | |
1783 its faster to just delete the directory rather than leave it up to git | |
1784 to sync. | |
1785 | |
1786 Returns: | |
1787 True if successful. | |
1788 """ | |
1789 cwd = os.getcwd() | |
1790 os.chdir(self.src_cwd) | |
1791 | |
1792 is_blink = bisect_utils.IsDepsFileBlink(revision) | |
1793 | |
1794 os.chdir(cwd) | |
1795 | |
1796 if self.was_blink != is_blink: | |
1797 self.was_blink = is_blink | |
1798 # Removes third_party/Webkit directory. | |
1799 return bisect_utils.RemoveThirdPartyDirectory('Webkit') | |
1800 return True | |
1801 | |
1802 def PerformCrosChrootCleanup(self): | 1776 def PerformCrosChrootCleanup(self): |
1803 """Deletes the chroot. | 1777 """Deletes the chroot. |
1804 | 1778 |
1805 Returns: | 1779 Returns: |
1806 True if successful. | 1780 True if successful. |
1807 """ | 1781 """ |
1808 cwd = os.getcwd() | 1782 cwd = os.getcwd() |
1809 self.ChangeToDepotWorkingDirectory('cros') | 1783 self.ChangeToDepotWorkingDirectory('cros') |
1810 cmd = [bisect_utils.CROS_SDK_PATH, '--delete'] | 1784 cmd = [bisect_utils.CROS_SDK_PATH, '--delete'] |
1811 return_code = bisect_utils.RunProcess(cmd) | 1785 return_code = bisect_utils.RunProcess(cmd) |
(...skipping 22 matching lines...) Expand all Loading... |
1834 if depot == 'chromium' or depot == 'android-chrome': | 1808 if depot == 'chromium' or depot == 'android-chrome': |
1835 # Removes third_party/libjingle. At some point, libjingle was causing | 1809 # Removes third_party/libjingle. At some point, libjingle was causing |
1836 # issues syncing when using the git workflow (crbug.com/266324). | 1810 # issues syncing when using the git workflow (crbug.com/266324). |
1837 os.chdir(self.src_cwd) | 1811 os.chdir(self.src_cwd) |
1838 if not bisect_utils.RemoveThirdPartyDirectory('libjingle'): | 1812 if not bisect_utils.RemoveThirdPartyDirectory('libjingle'): |
1839 return False | 1813 return False |
1840 # Removes third_party/skia. At some point, skia was causing | 1814 # Removes third_party/skia. At some point, skia was causing |
1841 # issues syncing when using the git workflow (crbug.com/377951). | 1815 # issues syncing when using the git workflow (crbug.com/377951). |
1842 if not bisect_utils.RemoveThirdPartyDirectory('skia'): | 1816 if not bisect_utils.RemoveThirdPartyDirectory('skia'): |
1843 return False | 1817 return False |
1844 if depot == 'chromium': | |
1845 # The fast webkit cleanup doesn't work for android_chrome | |
1846 # The switch from Webkit to Blink that this deals with now happened | |
1847 # quite a long time ago so this is unlikely to be a problem. | |
1848 return self.PerformWebkitDirectoryCleanup(revision) | |
1849 elif depot == 'cros': | 1818 elif depot == 'cros': |
1850 return self.PerformCrosChrootCleanup() | 1819 return self.PerformCrosChrootCleanup() |
1851 return True | 1820 return True |
1852 | 1821 |
1853 def RunPostSync(self, depot): | 1822 def RunPostSync(self, depot): |
1854 """Performs any work after syncing. | 1823 """Performs any work after syncing. |
1855 | 1824 |
1856 Returns: | 1825 Returns: |
1857 True if successful. | 1826 True if successful. |
1858 """ | 1827 """ |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3373 # bugs. If you change this, please update the perf dashboard as well. | 3342 # bugs. If you change this, please update the perf dashboard as well. |
3374 bisect_utils.OutputAnnotationStepStart('Results') | 3343 bisect_utils.OutputAnnotationStepStart('Results') |
3375 print 'Error: %s' % e.message | 3344 print 'Error: %s' % e.message |
3376 if opts.output_buildbot_annotations: | 3345 if opts.output_buildbot_annotations: |
3377 bisect_utils.OutputAnnotationStepClosed() | 3346 bisect_utils.OutputAnnotationStepClosed() |
3378 return 1 | 3347 return 1 |
3379 | 3348 |
3380 | 3349 |
3381 if __name__ == '__main__': | 3350 if __name__ == '__main__': |
3382 sys.exit(main()) | 3351 sys.exit(main()) |
OLD | NEW |