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

Side by Side Diff: tools/roll_webgl_conformance.py

Issue 1682593002: Run WebGL 2.0 conformance tests in more cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added OWNERS for WebGL roll script. Created 4 years, 10 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 | « tools/roll_angle.py ('k') | no next file » | 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 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 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 import argparse 6 import argparse
7 import collections 7 import collections
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 import time 13 import time
14 14
15 extra_trybots = [ 15 extra_trybots = [
16 { 16 {
17 "mastername": "tryserver.chromium.win", 17 "mastername": "tryserver.chromium.win",
18 "buildername": "win_clang_dbg", 18 "buildernames": ["win_optional_gpu_tests_rel"]
19 } 19 }
20 ] 20 ]
21 21
22 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) 22 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
23 SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir)) 23 SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir))
24 sys.path.insert(0, os.path.join(SRC_DIR, 'build')) 24 sys.path.insert(0, os.path.join(SRC_DIR, 'build'))
25 import find_depot_tools 25 import find_depot_tools
26 find_depot_tools.add_depot_tools_to_path() 26 find_depot_tools.add_depot_tools_to_path()
27 import roll_dep_svn 27 import roll_dep_svn
28 from gclient import GClientKeywords 28 from gclient import GClientKeywords
29 from third_party import upload 29 from third_party import upload
30 30
31 # Avoid depot_tools/third_party/upload.py print verbose messages. 31 # Avoid depot_tools/third_party/upload.py print verbose messages.
32 upload.verbosity = 0 # Errors only. 32 upload.verbosity = 0 # Errors only.
33 33
34 CHROMIUM_GIT_URL = 'https://chromium.googlesource.com/chromium/src.git' 34 CHROMIUM_GIT_URL = 'https://chromium.googlesource.com/chromium/src.git'
35 CL_ISSUE_RE = re.compile('^Issue number: ([0-9]+) \((.*)\)$') 35 CL_ISSUE_RE = re.compile('^Issue number: ([0-9]+) \((.*)\)$')
36 RIETVELD_URL_RE = re.compile('^https?://(.*)/(.*)') 36 RIETVELD_URL_RE = re.compile('^https?://(.*)/(.*)')
37 ROLL_BRANCH_NAME = 'special_angle_roll_branch' 37 ROLL_BRANCH_NAME = 'special_webgl_roll_branch'
38 TRYJOB_STATUS_SLEEP_SECONDS = 30 38 TRYJOB_STATUS_SLEEP_SECONDS = 30
39 39
40 # Use a shell for subcommands on Windows to get a PATH search. 40 # Use a shell for subcommands on Windows to get a PATH search.
41 IS_WIN = sys.platform.startswith('win') 41 IS_WIN = sys.platform.startswith('win')
42 ANGLE_PATH = os.path.join('third_party', 'angle') 42 WEBGL_PATH = os.path.join('third_party', 'webgl', 'src')
43 43
44 CommitInfo = collections.namedtuple('CommitInfo', ['git_commit', 44 CommitInfo = collections.namedtuple('CommitInfo', ['git_commit',
45 'git_repo_url']) 45 'git_repo_url'])
46 CLInfo = collections.namedtuple('CLInfo', ['issue', 'url', 'rietveld_server']) 46 CLInfo = collections.namedtuple('CLInfo', ['issue', 'url', 'rietveld_server'])
47 47
48 def _PosixPath(path): 48 def _PosixPath(path):
49 """Convert a possibly-Windows path to a posix-style path.""" 49 """Convert a possibly-Windows path to a posix-style path."""
50 (_, path) = os.path.splitdrive(path) 50 (_, path) = os.path.splitdrive(path)
51 return path.replace(os.sep, '/') 51 return path.replace(os.sep, '/')
52 52
(...skipping 18 matching lines...) Expand all
71 global_scope = { 71 global_scope = {
72 'File': GClientKeywords.FileImpl, 72 'File': GClientKeywords.FileImpl,
73 'From': GClientKeywords.FromImpl, 73 'From': GClientKeywords.FromImpl,
74 'Var': var.Lookup, 74 'Var': var.Lookup,
75 'deps_os': {}, 75 'deps_os': {},
76 } 76 }
77 exec(deps_content, global_scope, local_scope) 77 exec(deps_content, global_scope, local_scope)
78 return local_scope 78 return local_scope
79 79
80 80
81 def _GenerateCLDescriptionCommand(angle_current, angle_new, bugs): 81 def _GenerateCLDescriptionCommand(webgl_current, webgl_new, bugs):
82 def GetChangeString(current_hash, new_hash): 82 def GetChangeString(current_hash, new_hash):
83 return '%s..%s' % (current_hash[0:7], new_hash[0:7]); 83 return '%s..%s' % (current_hash[0:7], new_hash[0:7]);
84 84
85 def GetChangeLogURL(git_repo_url, change_string): 85 def GetChangeLogURL(git_repo_url, change_string):
86 return '%s/+log/%s' % (git_repo_url, change_string) 86 return '%s/+log/%s' % (git_repo_url, change_string)
87 87
88 def GetBugString(bugs): 88 def GetBugString(bugs):
89 bug_str = 'BUG=' 89 bug_str = 'BUG='
90 for bug in bugs: 90 for bug in bugs:
91 bug_str += str(bug) + ',' 91 bug_str += str(bug) + ','
92 return bug_str.rstrip(',') 92 return bug_str.rstrip(',')
93 93
94 if angle_current.git_commit != angle_new.git_commit: 94 if webgl_current.git_commit != webgl_new.git_commit:
95 change_str = GetChangeString(angle_current.git_commit, 95 change_str = GetChangeString(webgl_current.git_commit,
96 angle_new.git_commit) 96 webgl_new.git_commit)
97 changelog_url = GetChangeLogURL(angle_current.git_repo_url, 97 changelog_url = GetChangeLogURL(webgl_current.git_repo_url,
98 change_str) 98 change_str)
99 99
100 def GetExtraTrybotString():
101 s = ''
102 for t in extra_trybots:
103 if s:
104 s += ';'
105 s += t['mastername'] + ':' + ','.join(t['buildernames'])
106 return s
107
108 extra_trybot_args = []
109 if extra_trybots:
110 extra_trybot_string = GetExtraTrybotString()
111 extra_trybot_args = ['-m', 'CQ_INCLUDE_TRYBOTS=' + extra_trybot_string]
112
100 return [ 113 return [
101 '-m', 'Roll ANGLE ' + change_str, 114 '-m', 'Roll WebGL ' + change_str,
102 '-m', '%s' % changelog_url, 115 '-m', '%s' % changelog_url,
103 '-m', GetBugString(bugs), 116 '-m', GetBugString(bugs),
104 '-m', 'TEST=bots', 117 '-m', 'TEST=bots',
105 ] 118 ] + extra_trybot_args
106 119
107 120
108 class AutoRoller(object): 121 class AutoRoller(object):
109 def __init__(self, chromium_src): 122 def __init__(self, chromium_src):
110 self._chromium_src = chromium_src 123 self._chromium_src = chromium_src
111 124
112 def _RunCommand(self, command, working_dir=None, ignore_exit_code=False, 125 def _RunCommand(self, command, working_dir=None, ignore_exit_code=False,
113 extra_env=None): 126 extra_env=None):
114 """Runs a command and returns the stdout from that command. 127 """Runs a command and returns the stdout from that command.
115 128
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 186
174 def _IsTreeClean(self): 187 def _IsTreeClean(self):
175 lines = self._RunCommand( 188 lines = self._RunCommand(
176 ['git', 'status', '--porcelain', '-uno']).splitlines() 189 ['git', 'status', '--porcelain', '-uno']).splitlines()
177 if len(lines) == 0: 190 if len(lines) == 0:
178 return True 191 return True
179 192
180 logging.debug('Dirty/unversioned files:\n%s', '\n'.join(lines)) 193 logging.debug('Dirty/unversioned files:\n%s', '\n'.join(lines))
181 return False 194 return False
182 195
183 def _GetBugList(self, path_below_src, angle_current, angle_new): 196 def _GetBugList(self, path_below_src, webgl_current, webgl_new):
197 # TODO(kbr): this isn't useful, at least not yet, when run against
198 # the WebGL Github repository.
184 working_dir = os.path.join(self._chromium_src, path_below_src) 199 working_dir = os.path.join(self._chromium_src, path_below_src)
185 lines = self._RunCommand( 200 lines = self._RunCommand(
186 ['git','log', 201 ['git','log',
187 '%s..%s' % (angle_current.git_commit, angle_new.git_commit)], 202 '%s..%s' % (webgl_current.git_commit, webgl_new.git_commit)],
188 working_dir=working_dir).split('\n') 203 working_dir=working_dir).split('\n')
189 bugs = set() 204 bugs = set()
190 for line in lines: 205 for line in lines:
191 line = line.strip() 206 line = line.strip()
192 bug_prefix = 'BUG=' 207 bug_prefix = 'BUG='
193 if line.startswith(bug_prefix): 208 if line.startswith(bug_prefix):
194 bugs_strings = line[len(bug_prefix):].split(',') 209 bugs_strings = line[len(bug_prefix):].split(',')
195 for bug_string in bugs_strings: 210 for bug_string in bugs_strings:
196 try: 211 try:
197 bugs.add(int(bug_string)) 212 bugs.add(int(bug_string))
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if not ignore_checks: 244 if not ignore_checks:
230 self._RunCommand(['git', 'pull']) 245 self._RunCommand(['git', 'pull'])
231 246
232 self._RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) 247 self._RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME])
233 248
234 # Modify Chromium's DEPS file. 249 # Modify Chromium's DEPS file.
235 250
236 # Parse current hashes. 251 # Parse current hashes.
237 deps_filename = os.path.join(self._chromium_src, 'DEPS') 252 deps_filename = os.path.join(self._chromium_src, 'DEPS')
238 deps = _ParseDepsFile(deps_filename) 253 deps = _ParseDepsFile(deps_filename)
239 angle_current = self._GetDepsCommitInfo(deps, ANGLE_PATH) 254 webgl_current = self._GetDepsCommitInfo(deps, WEBGL_PATH)
240 255
241 # Find ToT revisions. 256 # Find ToT revisions.
242 angle_latest = self._GetCommitInfo(ANGLE_PATH) 257 webgl_latest = self._GetCommitInfo(WEBGL_PATH)
243 258
244 if IS_WIN: 259 if IS_WIN:
245 # Make sure the roll script doesn't use windows line endings 260 # Make sure the roll script doesn't use windows line endings
246 self._RunCommand(['git', 'config', 'core.autocrlf', 'true']) 261 self._RunCommand(['git', 'config', 'core.autocrlf', 'true'])
247 262
248 self._UpdateDep(deps_filename, ANGLE_PATH, angle_latest) 263 self._UpdateDep(deps_filename, WEBGL_PATH, webgl_latest)
249 264
250 if self._IsTreeClean(): 265 if self._IsTreeClean():
251 logging.debug('Tree is clean - no changes detected.') 266 logging.debug('Tree is clean - no changes detected.')
252 self._DeleteRollBranch() 267 self._DeleteRollBranch()
253 else: 268 else:
254 bugs = self._GetBugList(ANGLE_PATH, angle_current, angle_latest) 269 bugs = self._GetBugList(WEBGL_PATH, webgl_current, webgl_latest)
255 description = _GenerateCLDescriptionCommand( 270 description = _GenerateCLDescriptionCommand(
256 angle_current, angle_latest, bugs) 271 webgl_current, webgl_latest, bugs)
257 logging.debug('Committing changes locally.') 272 logging.debug('Committing changes locally.')
258 self._RunCommand(['git', 'add', '--update', '.']) 273 self._RunCommand(['git', 'add', '--update', '.'])
259 self._RunCommand(['git', 'commit'] + description) 274 self._RunCommand(['git', 'commit'] + description)
260 logging.debug('Uploading changes...') 275 logging.debug('Uploading changes...')
261 self._RunCommand(['git', 'cl', 'upload'], 276 self._RunCommand(['git', 'cl', 'upload'],
262 extra_env={'EDITOR': 'true'}) 277 extra_env={'EDITOR': 'true'})
263 278
264 # Run the default trybots 279 # Kick off tryjobs.
265 base_try_cmd = ['git', 'cl', 'try'] 280 base_try_cmd = ['git', 'cl', 'try']
266 self._RunCommand(base_try_cmd) 281 self._RunCommand(base_try_cmd)
267 282
268 if extra_trybots: 283 if extra_trybots:
269 # Run additional tryjobs 284 # Run additional tryjobs.
270 extra_try_args = [] 285 # TODO(kbr): this should not be necessary -- the
271 for extra_trybot in extra_trybots: 286 # CQ_INCLUDE_TRYBOTS directive above should handle it.
272 extra_try_args += ['-m', extra_trybot["mastername"], 287 # http://crbug.com/585237
273 '-b', extra_trybot["buildername"]] 288 for trybot in extra_trybots:
274 self._RunCommand(base_try_cmd + extra_try_args) 289 for builder in trybot['buildernames']:
290 self._RunCommand(base_try_cmd + [
291 '-m', trybot['mastername'],
292 '-b', builder])
275 293
276 cl_info = self._GetCLInfo() 294 cl_info = self._GetCLInfo()
277 print 'Issue: %d URL: %s' % (cl_info.issue, cl_info.url) 295 print 'Issue: %d URL: %s' % (cl_info.issue, cl_info.url)
278 296
279 # Checkout master again. 297 # Checkout master again.
280 self._RunCommand(['git', 'checkout', 'master']) 298 self._RunCommand(['git', 'checkout', 'master'])
281 print 'Roll branch left as ' + ROLL_BRANCH_NAME 299 print 'Roll branch left as ' + ROLL_BRANCH_NAME
282 return 0 300 return 0
283 301
284 def _UpdateDep(self, deps_filename, dep_relative_to_src, commit_info): 302 def _UpdateDep(self, deps_filename, dep_relative_to_src, commit_info):
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 self._RunCommand(['git', 'checkout', ROLL_BRANCH_NAME]) 345 self._RunCommand(['git', 'checkout', ROLL_BRANCH_NAME])
328 # Ignore an error here in case an issue wasn't created for some reason. 346 # Ignore an error here in case an issue wasn't created for some reason.
329 self._RunCommand(['git', 'cl', 'set_close'], ignore_exit_code=True) 347 self._RunCommand(['git', 'cl', 'set_close'], ignore_exit_code=True)
330 self._RunCommand(['git', 'checkout', active_branch]) 348 self._RunCommand(['git', 'checkout', active_branch])
331 self._RunCommand(['git', 'branch', '-D', ROLL_BRANCH_NAME]) 349 self._RunCommand(['git', 'branch', '-D', ROLL_BRANCH_NAME])
332 return 0 350 return 0
333 351
334 352
335 def main(): 353 def main():
336 parser = argparse.ArgumentParser( 354 parser = argparse.ArgumentParser(
337 description='Auto-generates a CL containing an ANGLE roll.') 355 description='Auto-generates a CL containing a WebGL conformance roll.')
338 parser.add_argument('--abort', 356 parser.add_argument('--abort',
339 help=('Aborts a previously prepared roll. ' 357 help=('Aborts a previously prepared roll. '
340 'Closes any associated issues and deletes the roll branches'), 358 'Closes any associated issues and deletes the roll branches'),
341 action='store_true') 359 action='store_true')
342 parser.add_argument('--ignore-checks', action='store_true', default=False, 360 parser.add_argument('--ignore-checks', action='store_true', default=False,
343 help=('Skips checks for being on the master branch, dirty workspaces and ' 361 help=('Skips checks for being on the master branch, dirty workspaces and '
344 'the updating of the checkout. Will still delete and create local ' 362 'the updating of the checkout. Will still delete and create local '
345 'Git branches.')) 363 'Git branches.'))
346 parser.add_argument('-v', '--verbose', action='store_true', default=False, 364 parser.add_argument('-v', '--verbose', action='store_true', default=False,
347 help='Be extra verbose in printing of log messages.') 365 help='Be extra verbose in printing of log messages.')
348 args = parser.parse_args() 366 args = parser.parse_args()
349 367
350 if args.verbose: 368 if args.verbose:
351 logging.basicConfig(level=logging.DEBUG) 369 logging.basicConfig(level=logging.DEBUG)
352 else: 370 else:
353 logging.basicConfig(level=logging.ERROR) 371 logging.basicConfig(level=logging.ERROR)
354 372
355 autoroller = AutoRoller(SRC_DIR) 373 autoroller = AutoRoller(SRC_DIR)
356 if args.abort: 374 if args.abort:
357 return autoroller.Abort() 375 return autoroller.Abort()
358 else: 376 else:
359 return autoroller.PrepareRoll(args.ignore_checks) 377 return autoroller.PrepareRoll(args.ignore_checks)
360 378
361 if __name__ == '__main__': 379 if __name__ == '__main__':
362 sys.exit(main()) 380 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/roll_angle.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698