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

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

Issue 2429573002: Also archive diff files in layout-test-results.zip. (Closed)
Patch Set: Rebased 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
« no previous file with comments | « no previous file | scripts/slave/chromium/archive_layout_test_results_unittest.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 (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. 6 """A tool to archive layout test results.
7 7
8 To archive files on Google Storage, pass a GS bucket name via --gs-bucket. 8 To archive files on Google Storage, pass a GS bucket name via --gs-bucket.
9 To control access to archives, pass a value for --gs-acl (e.g. 'public-read', 9 To control access to archives, pass a value for --gs-acl (e.g. 'public-read',
10 see https://developers.google.com/storage/docs/accesscontrol#extension 10 see https://developers.google.com/storage/docs/accesscontrol#extension
(...skipping 13 matching lines...) Expand all
24 import re 24 import re
25 import socket 25 import socket
26 import sys 26 import sys
27 27
28 from common import archive_utils 28 from common import archive_utils
29 from common import chromium_utils 29 from common import chromium_utils
30 from slave import build_directory 30 from slave import build_directory
31 from slave import slave_utils 31 from slave import slave_utils
32 32
33 33
34 def _CollectArchiveFiles(output_dir): 34 def _CollectZipArchiveFiles(output_dir):
35 """Returns a list of actual layout test result files to archive.""" 35 """Returns a list of layout test result files to archive in a zip file."""
36 actual_file_list = [] 36 file_list = []
37 37
38 for path, _, files in os.walk(output_dir): 38 for path, _, files in os.walk(output_dir):
39 rel_path = path[len(output_dir + '\\'):] 39 rel_path = path[len(output_dir + '\\'):]
40 for name in files: 40 for name in files:
41 if _IsActualResultFile(name): 41 if _IsIncludedInZipArchive(name):
42 actual_file_list.append(os.path.join(rel_path, name)) 42 file_list.append(os.path.join(rel_path, name))
43 elif name.endswith('.json'):
44 actual_file_list.append(os.path.join(rel_path, name))
45 43
46 if os.path.exists(os.path.join(output_dir, 'results.html')): 44 if os.path.exists(os.path.join(output_dir, 'results.html')):
47 actual_file_list.append('results.html') 45 file_list.append('results.html')
48 46
49 if sys.platform == 'win32': 47 if sys.platform == 'win32':
50 if os.path.exists(os.path.join(output_dir, 'access_log.txt')): 48 if os.path.exists(os.path.join(output_dir, 'access_log.txt')):
51 actual_file_list.append('access_log.txt') 49 file_list.append('access_log.txt')
52 if os.path.exists(os.path.join(output_dir, 'error_log.txt')): 50 if os.path.exists(os.path.join(output_dir, 'error_log.txt')):
53 actual_file_list.append('error_log.txt') 51 file_list.append('error_log.txt')
54 52
55 return actual_file_list 53 return file_list
56 54
57 55
58 def _IsActualResultFile(name): 56 def _IsIncludedInZipArchive(name):
57 """Returns True if a file should be included in the zip, False otherwise."""
59 if '-stack.' in name or '-crash-log.' in name: 58 if '-stack.' in name or '-crash-log.' in name:
60 return True 59 return True
61 extension = os.path.splitext(name)[1] 60 extension = os.path.splitext(name)[1]
62 return ('-actual.' in name and extension in 61 if '-actual.' in name and extension in ('.txt', '.png', '.checksum', '.wav'):
63 ('.txt', '.png', '.checksum', '.wav')) 62 return True
63 if '-expected.' in name:
64 return True
65 if '-wdiff.' in name:
66 return True
67 if name.endswith('-diff.txt') or name.endswith('-diff.png'):
68 return True
69 if name.endswith('.json'):
70 return True
71 return False
64 72
65 73
66 def archive_layout(args): 74 def archive_layout(args):
67 chrome_dir = os.path.abspath(args.build_dir) 75 chrome_dir = os.path.abspath(args.build_dir)
68 results_dir_basename = os.path.basename(args.results_dir) 76 results_dir_basename = os.path.basename(args.results_dir)
69 args.results_dir = os.path.abspath(args.results_dir) 77 args.results_dir = os.path.abspath(args.results_dir)
70 print 'Archiving results from %s' % args.results_dir 78 print 'Archiving results from %s' % args.results_dir
71 staging_dir = args.staging_dir or slave_utils.GetStagingDir(chrome_dir) 79 staging_dir = args.staging_dir or slave_utils.GetStagingDir(chrome_dir)
72 print 'Staging in %s' % staging_dir 80 print 'Staging in %s' % staging_dir
73 if not os.path.exists(staging_dir): 81 if not os.path.exists(staging_dir):
74 os.makedirs(staging_dir) 82 os.makedirs(staging_dir)
75 83
76 actual_file_list = _CollectArchiveFiles(args.results_dir) 84 file_list = _CollectZipArchiveFiles(args.results_dir)
77 zip_file = chromium_utils.MakeZip(staging_dir, 85 zip_file = chromium_utils.MakeZip(staging_dir,
78 results_dir_basename, 86 results_dir_basename,
79 actual_file_list, 87 file_list,
80 args.results_dir)[1] 88 args.results_dir)[1]
81 89
82 wc_dir = os.path.dirname(chrome_dir) 90 wc_dir = os.path.dirname(chrome_dir)
83 last_change = slave_utils.GetHashOrRevision(wc_dir) 91 last_change = slave_utils.GetHashOrRevision(wc_dir)
84 92
85 builder_name = re.sub('[ .()]', '_', args.builder_name) 93 builder_name = re.sub('[ .()]', '_', args.builder_name)
86 build_number = str(args.build_number) 94 build_number = str(args.build_number)
87 95
88 print 'last change: %s' % last_change 96 print 'last change: %s' % last_change
89 print 'build name: %s' % builder_name 97 print 'build name: %s' % builder_name
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 args = _ParseArgs() 163 args = _ParseArgs()
156 logging.basicConfig(level=logging.INFO, 164 logging.basicConfig(level=logging.INFO,
157 format='%(asctime)s %(filename)s:%(lineno)-3d' 165 format='%(asctime)s %(filename)s:%(lineno)-3d'
158 ' %(levelname)s %(message)s', 166 ' %(levelname)s %(message)s',
159 datefmt='%y%m%d %H:%M:%S') 167 datefmt='%y%m%d %H:%M:%S')
160 return archive_layout(args) 168 return archive_layout(args)
161 169
162 170
163 if '__main__' == __name__: 171 if '__main__' == __name__:
164 sys.exit(main()) 172 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/chromium/archive_layout_test_results_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698