Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: tools/auto_bisect/bisect_perf_regression.py

Issue 1779943002: Fix path error in getting depot dir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/auto_bisect/bisect_perf_regression_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 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 """Chromium auto-bisect tool 6 """Chromium auto-bisect tool
7 7
8 This script bisects a range of commits using binary search. It starts by getting 8 This script bisects a range of commits using binary search. It starts by getting
9 reference values for the specified "good" and "bad" commits. Then, for revisions 9 reference values for the specified "good" and "bad" commits. Then, for revisions
10 in between, it will get builds, run tests and classify intermediate revisions as 10 in between, it will get builds, run tests and classify intermediate revisions as
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 if run_results_reverted[1]: 2138 if run_results_reverted[1]:
2139 return (None, None) 2139 return (None, None)
2140 2140
2141 run_results_tot = self._RunTestWithAnnotations( 2141 run_results_tot = self._RunTestWithAnnotations(
2142 'Re-Testing ToT', 2142 'Re-Testing ToT',
2143 'Failed to run ToT.', 2143 'Failed to run ToT.',
2144 head_revision, target_depot, command_to_run, metric, force_build) 2144 head_revision, target_depot, command_to_run, metric, force_build)
2145 2145
2146 return (run_results_tot, run_results_reverted) 2146 return (run_results_tot, run_results_reverted)
2147 2147
2148 def PostBisectResults(self, bisect_results):
2149 """Posts bisect results to Perf Dashboard."""
2150 bisect_utils.OutputAnnotationStepStart('Post Results')
2151
2152 results = bisect_results_json.Get(
2153 bisect_results, self.opts, self.depot_registry)
2154 data = {'data': results}
2155 request = urllib2.Request(PERF_DASH_RESULTS_URL)
2156 request.add_header('Content-Type', 'application/json')
2157 try:
2158 urllib2.urlopen(request, json.dumps(data))
2159 except urllib2.URLError as e:
2160 print 'Failed to post bisect results. Error: %s.' % e
2161 bisect_utils.OutputAnnotationStepWarning()
2162
2163 bisect_utils.OutputAnnotationStepClosed()
2164
2148 def _RunTestWithAnnotations( 2165 def _RunTestWithAnnotations(
2149 self, step_text, error_text, head_revision, 2166 self, step_text, error_text, head_revision,
2150 target_depot, command_to_run, metric, force_build): 2167 target_depot, command_to_run, metric, force_build):
2151 """Runs the performance test and outputs start/stop annotations. 2168 """Runs the performance test and outputs start/stop annotations.
2152 2169
2153 Args: 2170 Args:
2154 results: BisectResults from the bisect. 2171 results: BisectResults from the bisect.
2155 target_depot: The target depot we're bisecting. 2172 target_depot: The target depot we're bisecting.
2156 command_to_run: Specify the command to execute the performance test. 2173 command_to_run: Specify the command to execute the performance test.
2157 metric: The performance metric to monitor. 2174 metric: The performance metric to monitor.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 opts: The options parsed from the command line. 2519 opts: The options parsed from the command line.
2503 2520
2504 Returns: 2521 Returns:
2505 True if the platform and build system are supported. 2522 True if the platform and build system are supported.
2506 """ 2523 """
2507 # Haven't tested the script out on any other platforms yet. 2524 # Haven't tested the script out on any other platforms yet.
2508 supported = ['posix', 'nt'] 2525 supported = ['posix', 'nt']
2509 return os.name in supported 2526 return os.name in supported
2510 2527
2511 2528
2512 def _PostBisectResults(bisect_results, opts, src_cwd):
2513 """Posts bisect results to Perf Dashboard."""
2514 bisect_utils.OutputAnnotationStepStart('Post Results')
2515
2516 results = bisect_results_json.Get(
2517 bisect_results, opts, DepotDirectoryRegistry(src_cwd))
2518 data = {'data': results}
2519 request = urllib2.Request(PERF_DASH_RESULTS_URL)
2520 request.add_header('Content-Type', 'application/json')
2521 try:
2522 urllib2.urlopen(request, json.dumps(data))
2523 except urllib2.URLError as e:
2524 print 'Failed to post bisect results. Error: %s.' % e
2525 bisect_utils.OutputAnnotationStepWarning()
2526
2527 bisect_utils.OutputAnnotationStepClosed()
2528
2529
2530 def RemoveBuildFiles(build_type): 2529 def RemoveBuildFiles(build_type):
2531 """Removes build files from previous runs.""" 2530 """Removes build files from previous runs."""
2532 out_dir = os.path.join('out', build_type) 2531 out_dir = os.path.join('out', build_type)
2533 build_dir = os.path.join('build', build_type) 2532 build_dir = os.path.join('build', build_type)
2534 logging.info('Removing build files in "%s" and "%s".', 2533 logging.info('Removing build files in "%s" and "%s".',
2535 os.path.abspath(out_dir), os.path.abspath(build_dir)) 2534 os.path.abspath(out_dir), os.path.abspath(build_dir))
2536 try: 2535 try:
2537 RemakeDirectoryTree(out_dir) 2536 RemakeDirectoryTree(out_dir)
2538 RemakeDirectoryTree(build_dir) 2537 RemakeDirectoryTree(build_dir)
2539 except Exception as e: 2538 except Exception as e:
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 not opts.debug_ignore_sync and 2873 not opts.debug_ignore_sync and
2875 not opts.working_directory): 2874 not opts.working_directory):
2876 raise RuntimeError('You must switch to master branch to run bisection.') 2875 raise RuntimeError('You must switch to master branch to run bisection.')
2877 bisect_test = BisectPerformanceMetrics(opts, os.getcwd()) 2876 bisect_test = BisectPerformanceMetrics(opts, os.getcwd())
2878 try: 2877 try:
2879 results = bisect_test.Run(opts.command, opts.bad_revision, 2878 results = bisect_test.Run(opts.command, opts.bad_revision,
2880 opts.good_revision, opts.metric) 2879 opts.good_revision, opts.metric)
2881 if results.error: 2880 if results.error:
2882 raise RuntimeError(results.error) 2881 raise RuntimeError(results.error)
2883 bisect_test.printer.FormatAndPrintResults(results) 2882 bisect_test.printer.FormatAndPrintResults(results)
2884 _PostBisectResults(results, opts, os.getcwd()) 2883 bisect_test.PostBisectResults(results)
2885 return 0 2884 return 0
2886 finally: 2885 finally:
2887 bisect_test.PerformCleanup() 2886 bisect_test.PerformCleanup()
2888 except RuntimeError as e: 2887 except RuntimeError as e:
2889 if opts.output_buildbot_annotations: 2888 if opts.output_buildbot_annotations:
2890 # The perf dashboard scrapes the "results" step in order to comment on 2889 # The perf dashboard scrapes the "results" step in order to comment on
2891 # bugs. If you change this, please update the perf dashboard as well. 2890 # bugs. If you change this, please update the perf dashboard as well.
2892 bisect_utils.OutputAnnotationStepStart('Results') 2891 bisect_utils.OutputAnnotationStepStart('Results')
2893 print 'Runtime Error: %s' % e 2892 print 'Runtime Error: %s' % e
2894 if opts.output_buildbot_annotations: 2893 if opts.output_buildbot_annotations:
2895 bisect_utils.OutputAnnotationStepClosed() 2894 bisect_utils.OutputAnnotationStepClosed()
2896 return 1 2895 return 1
2897 2896
2898 2897
2899 if __name__ == '__main__': 2898 if __name__ == '__main__':
2900 sys.exit(main()) 2899 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/auto_bisect/bisect_perf_regression_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698