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

Side by Side Diff: tools/test-wrapper-gypbuild.py

Issue 10383128: Prepare for using GYP build on buildbots (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/presubmit.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 # 2 #
3 # Copyright 2011 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following 11 # copyright notice, this list of conditions and the following
12 # disclaimer in the documentation and/or other materials provided 12 # disclaimer in the documentation and/or other materials provided
13 # with the distribution. 13 # with the distribution.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 # Flags specific to this wrapper script: 49 # Flags specific to this wrapper script:
50 result.add_option("--arch-and-mode", 50 result.add_option("--arch-and-mode",
51 help='Architecture and mode in the format "arch.mode"', 51 help='Architecture and mode in the format "arch.mode"',
52 default=None) 52 default=None)
53 result.add_option("--outdir", 53 result.add_option("--outdir",
54 help='Base output directory', 54 help='Base output directory',
55 default='out') 55 default='out')
56 result.add_option("--no-presubmit", 56 result.add_option("--no-presubmit",
57 help='Skip presubmit checks', 57 help='Skip presubmit checks',
58 default=False, action="store_true") 58 default=False, action="store_true")
59 result.add_option("--buildbot",
60 help='Adapt to path structure used on buildbots',
61 default=False, action="store_true")
59 62
60 # Flags this wrapper script handles itself: 63 # Flags this wrapper script handles itself:
61 result.add_option("-m", "--mode", 64 result.add_option("-m", "--mode",
62 help="The test modes in which to run (comma-separated)", 65 help="The test modes in which to run (comma-separated)",
63 default='release,debug') 66 default='release,debug')
64 result.add_option("--arch", 67 result.add_option("--arch",
65 help='The architectures to run tests for (comma-separated)', 68 help='The architectures to run tests for (comma-separated)',
66 default='ia32,x64,arm') 69 default='ia32,x64,arm')
67 70
68 # Flags that are passed on to the wrapped test.py script: 71 # Flags that are passed on to the wrapped test.py script:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 options.arch = [] 140 options.arch = []
138 options.mode = [] 141 options.mode = []
139 else: 142 else:
140 if options.arch_and_mode != None and options.arch_and_mode != "": 143 if options.arch_and_mode != None and options.arch_and_mode != "":
141 tokens = options.arch_and_mode.split(".") 144 tokens = options.arch_and_mode.split(".")
142 options.arch = tokens[0] 145 options.arch = tokens[0]
143 options.mode = tokens[1] 146 options.mode = tokens[1]
144 options.mode = options.mode.split(',') 147 options.mode = options.mode.split(',')
145 options.arch = options.arch.split(',') 148 options.arch = options.arch.split(',')
146 for mode in options.mode: 149 for mode in options.mode:
147 if not mode in ['debug', 'release']: 150 if not mode.lower() in ['debug', 'release']:
148 print "Unknown mode %s" % mode 151 print "Unknown mode %s" % mode
149 return False 152 return False
150 for arch in options.arch: 153 for arch in options.arch:
151 if not arch in ['ia32', 'x64', 'arm', 'mips']: 154 if not arch in ['ia32', 'x64', 'arm', 'mips']:
152 print "Unknown architecture %s" % arch 155 print "Unknown architecture %s" % arch
153 return False 156 return False
154 157 if options.buildbot:
158 # Buildbots run presubmit tests as a separate step.
159 options.no_presubmit = True
155 return True 160 return True
156 161
157 162
158 def PassOnOptions(options): 163 def PassOnOptions(options):
159 result = [] 164 result = []
160 if options.verbose: 165 if options.verbose:
161 result += ['--verbose'] 166 result += ['--verbose']
162 if options.progress != 'mono': 167 if options.progress != 'mono':
163 result += ['--progress=' + options.progress] 168 result += ['--progress=' + options.progress]
164 if options.report: 169 if options.report:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 211
207 212
208 def Main(): 213 def Main():
209 parser = BuildOptions() 214 parser = BuildOptions()
210 (options, args) = parser.parse_args() 215 (options, args) = parser.parse_args()
211 if not ProcessOptions(options): 216 if not ProcessOptions(options):
212 parser.print_help() 217 parser.print_help()
213 return 1 218 return 1
214 219
215 workspace = abspath(join(dirname(sys.argv[0]), '..')) 220 workspace = abspath(join(dirname(sys.argv[0]), '..'))
221 returncodes = 0
216 222
217 if not options.no_presubmit: 223 if not options.no_presubmit:
218 print ">>> running presubmit tests" 224 print ">>> running presubmit tests"
219 subprocess.call([workspace + '/tools/presubmit.py']) 225 returncodes += subprocess.call([workspace + '/tools/presubmit.py'])
220 226
221 args_for_children = [workspace + '/tools/test.py'] + PassOnOptions(options) 227 args_for_children = [workspace + '/tools/test.py'] + PassOnOptions(options)
222 args_for_children += ['--no-build', '--build-system=gyp'] 228 args_for_children += ['--no-build', '--build-system=gyp']
223 for arg in args: 229 for arg in args:
224 args_for_children += [arg] 230 args_for_children += [arg]
225 returncodes = 0
226 env = os.environ 231 env = os.environ
227 232
228 for mode in options.mode: 233 for mode in options.mode:
229 for arch in options.arch: 234 for arch in options.arch:
230 print ">>> running tests for %s.%s" % (arch, mode) 235 print ">>> running tests for %s.%s" % (arch, mode)
231 shellpath = workspace + '/' + options.outdir + '/' + arch + '.' + mode 236 if options.buildbot:
237 shellpath = workspace + '/' + options.outdir + '/' + mode
238 mode = mode.lower()
239 else:
240 shellpath = workspace + '/' + options.outdir + '/' + arch + '.' + mode
232 env['LD_LIBRARY_PATH'] = shellpath + '/lib.target' 241 env['LD_LIBRARY_PATH'] = shellpath + '/lib.target'
233 shell = shellpath + "/d8" 242 shell = shellpath + "/d8"
234 child = subprocess.Popen(' '.join(args_for_children + 243 child = subprocess.Popen(' '.join(args_for_children +
235 ['--arch=' + arch] + 244 ['--arch=' + arch] +
236 ['--mode=' + mode] + 245 ['--mode=' + mode] +
237 ['--shell=' + shell]), 246 ['--shell=' + shell]),
238 shell=True, 247 shell=True,
239 cwd=workspace, 248 cwd=workspace,
240 env=env) 249 env=env)
241 returncodes += child.wait() 250 returncodes += child.wait()
242 251
243 if len(options.mode) == 0 and len(options.arch) == 0: 252 if len(options.mode) == 0 and len(options.arch) == 0:
244 print ">>> running tests" 253 print ">>> running tests"
245 shellpath = workspace + '/' + options.outdir 254 shellpath = workspace + '/' + options.outdir
246 env['LD_LIBRARY_PATH'] = shellpath + '/lib.target' 255 env['LD_LIBRARY_PATH'] = shellpath + '/lib.target'
247 shell = shellpath + '/d8' 256 shell = shellpath + '/d8'
248 child = subprocess.Popen(' '.join(args_for_children + 257 child = subprocess.Popen(' '.join(args_for_children +
249 ['--shell=' + shell]), 258 ['--shell=' + shell]),
250 shell=True, 259 shell=True,
251 cwd=workspace, 260 cwd=workspace,
252 env=env) 261 env=env)
253 returncodes = child.wait() 262 returncodes = child.wait()
254 263
255 return returncodes 264 return returncodes
256 265
257 266
258 if __name__ == '__main__': 267 if __name__ == '__main__':
259 sys.exit(Main()) 268 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/presubmit.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698