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

Side by Side Diff: scripts/slave/chromium/archive_layout_test_results.py

Issue 2420543002: Use passed-in --build-dir instead of GetBuildOutputDirectory in archive_layout_test_results.py. (Closed)
Patch Set: Use the passed-in build-dir Created 4 years, 2 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """A tool to archive layout test results generated by buildbots. 6 """A tool to archive layout test results generated by buildbots.
7 7
8 Actual result files (*-actual.txt), but not results from simplified diff 8 Actual result files (*-actual.txt), but not results from simplified diff
9 tests (*-simp-actual.txt) or JS-filtered diff tests (*-jsfilt.txt), will 9 tests (*-simp-actual.txt) or JS-filtered diff tests (*-jsfilt.txt), will
10 be included in the archive. 10 be included in the archive.
(...skipping 13 matching lines...) Expand all
24 24
25 import logging 25 import logging
26 import optparse 26 import optparse
27 import os 27 import os
28 import re 28 import re
29 import socket 29 import socket
30 import sys 30 import sys
31 31
32 from common import archive_utils 32 from common import archive_utils
33 from common import chromium_utils 33 from common import chromium_utils
34 from slave import build_directory
35 from slave import slave_utils 34 from slave import slave_utils
36 35
37 # Directory name, above the build directory, in which test results can be 36 # Directory name, above the build directory, in which test results can be
38 # found if no --results-dir option is given. 37 # found if no --results-dir option is given.
39 RESULT_DIR = 'layout-test-results' 38 RESULT_DIR = 'layout-test-results'
40 39
41 40
42 def _CollectArchiveFiles(output_dir): 41 def _CollectArchiveFiles(output_dir):
43 """Returns a pair of lists of file paths to archive. 42 """Returns a pair of lists of file paths to archive.
44 43
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 print 'saving results to %s' % dest_dir 152 print 'saving results to %s' % dest_dir
154 elif chromium_utils.IsLinux() or chromium_utils.IsMac(): 153 elif chromium_utils.IsLinux() or chromium_utils.IsMac():
155 chromium_utils.SshMakeDirectory(host, dest_dir) 154 chromium_utils.SshMakeDirectory(host, dest_dir)
156 print 'saving results to "%s" on "%s"' % (dest_dir, host) 155 print 'saving results to "%s" on "%s"' % (dest_dir, host)
157 else: 156 else:
158 raise NotImplementedError( 157 raise NotImplementedError(
159 'Platform "%s" is not currently supported.' % sys.platform) 158 'Platform "%s" is not currently supported.' % sys.platform)
160 159
161 160
162 def archive_layout(options): 161 def archive_layout(options):
163 chrome_dir = os.path.abspath(options.build_dir) 162 chrome_dir = os.path.abspath(build_dir)
Dirk Pranke 2016/10/13 23:34:43 Doesn't this still need to be options.build_dir?
qyearsley 2016/10/13 23:48:05 Yep! Now fixed.
164 results_dir_basename = os.path.basename(options.results_dir) 163 results_dir_basename = os.path.basename(options.results_dir)
165 if options.results_dir is not None: 164 if options.results_dir is not None:
166 options.results_dir = os.path.abspath(os.path.join(options.build_dir, 165 options.results_dir = os.path.abspath(os.path.join(build_dir,
Dirk Pranke 2016/10/13 23:34:43 Same.
167 options.results_dir)) 166 options.results_dir))
168 else: 167 else:
169 options.results_dir = chromium_utils.FindUpward(chrome_dir, RESULT_DIR) 168 options.results_dir = chromium_utils.FindUpward(chrome_dir, RESULT_DIR)
170 print 'Archiving results from %s' % options.results_dir 169 print 'Archiving results from %s' % options.results_dir
171 staging_dir = options.staging_dir or slave_utils.GetStagingDir(chrome_dir) 170 staging_dir = options.staging_dir or slave_utils.GetStagingDir(chrome_dir)
172 print 'Staging in %s' % staging_dir 171 print 'Staging in %s' % staging_dir
173 if not os.path.exists(staging_dir): 172 if not os.path.exists(staging_dir):
174 os.makedirs(staging_dir) 173 os.makedirs(staging_dir)
175 174
176 (actual_file_list, diff_file_list) = _CollectArchiveFiles(options.results_dir) 175 (actual_file_list, diff_file_list) = _CollectArchiveFiles(options.results_dir)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 _CopyFileToArchiveHost(full_results_json, dest_dir) 253 _CopyFileToArchiveHost(full_results_json, dest_dir)
255 _CopyFileToArchiveHost(failing_results_json, dest_dir) 254 _CopyFileToArchiveHost(failing_results_json, dest_dir)
256 # Not supported on Google Storage yet. 255 # Not supported on Google Storage yet.
257 _ArchiveFullLayoutTestResults(staging_dir, dest_parent_dir, diff_file_list, 256 _ArchiveFullLayoutTestResults(staging_dir, dest_parent_dir, diff_file_list,
258 options) 257 options)
259 return 0 258 return 0
260 259
261 260
262 def _ParseOptions(): 261 def _ParseOptions():
263 option_parser = optparse.OptionParser() 262 option_parser = optparse.OptionParser()
264 option_parser.add_option('', '--build-dir', help='ignored') 263 option_parser.add_option('', '--build-dir',
264 help='Build dir path, relative to checkout root.')
265 option_parser.add_option('', '--results-dir', 265 option_parser.add_option('', '--results-dir',
266 help='path to layout test results, relative to ' 266 help='path to layout test results, relative to '
267 'the build_dir') 267 'the build_dir')
268 option_parser.add_option('', '--builder-name', 268 option_parser.add_option('', '--builder-name',
269 default=None, 269 default=None,
270 help='The name of the builder running this script.') 270 help='The name of the builder running this script.')
271 option_parser.add_option('', '--build-number', 271 option_parser.add_option('', '--build-number',
272 default=None, 272 default=None,
273 help=('The build number of the builder running' 273 help=('The build number of the builder running'
274 'this script.')) 274 'this script.'))
275 option_parser.add_option('', '--gs-bucket', 275 option_parser.add_option('', '--gs-bucket',
276 default=None, 276 default=None,
277 help=('The google storage bucket to upload to. ' 277 help=('The google storage bucket to upload to. '
278 'If provided, this script will upload to gs ' 278 'If provided, this script will upload to gs '
279 'instead of the master.')) 279 'instead of the master.'))
280 option_parser.add_option('', '--gs-acl', 280 option_parser.add_option('', '--gs-acl',
281 default=None, 281 default=None,
282 help=('The ACL of the google storage files.')) 282 help=('The ACL of the google storage files.'))
283 option_parser.add_option('--staging-dir', 283 option_parser.add_option('--staging-dir',
284 help='Directory to use for staging the archives. ' 284 help='Directory to use for staging the archives. '
285 'Default behavior is to automatically detect ' 285 'Default behavior is to automatically detect '
286 'slave\'s build directory.') 286 'slave\'s build directory.')
287 chromium_utils.AddPropertiesOptions(option_parser) 287 chromium_utils.AddPropertiesOptions(option_parser)
288 options, _ = option_parser.parse_args() 288 options, _ = option_parser.parse_args()
289 options.build_dir = build_directory.GetBuildOutputDirectory()
290 return options 289 return options
291 290
292 291
293 def main(): 292 def main():
294 options = _ParseOptions() 293 options = _ParseOptions()
295 logging.basicConfig(level=logging.INFO, 294 logging.basicConfig(level=logging.INFO,
296 format='%(asctime)s %(filename)s:%(lineno)-3d' 295 format='%(asctime)s %(filename)s:%(lineno)-3d'
297 ' %(levelname)s %(message)s', 296 ' %(levelname)s %(message)s',
298 datefmt='%y%m%d %H:%M:%S') 297 datefmt='%y%m%d %H:%M:%S')
299 return archive_layout(options) 298 return archive_layout(options)
300 299
301 300
302 if '__main__' == __name__: 301 if '__main__' == __name__:
303 sys.exit(main()) 302 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698