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

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

Issue 14348002: Remove SCons related files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed os.path.join occurrences that depended on old imports Created 7 years, 8 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/test.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
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following
12 # disclaimer in the documentation and/or other materials provided
13 # with the distribution.
14 # * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30
31 # This is a convenience script to run the existing tools/test.py script
32 # when using the gyp/make based build.
33 # It is intended as a stop-gap rather than a long-term solution.
34
35
36 import optparse
37 import os
38 from os.path import join, dirname, abspath
39 import subprocess
40 import sys
41
42
43 PROGRESS_INDICATORS = ['verbose', 'dots', 'color', 'mono']
44
45
46 def BuildOptions():
47 result = optparse.OptionParser()
48
49 # Flags specific to this wrapper script:
50 result.add_option("--arch-and-mode",
51 help='Architecture and mode in the format "arch.mode"',
52 default=None)
53 result.add_option("--outdir",
54 help='Base output directory',
55 default='out')
56 result.add_option("--no-presubmit",
57 help='Skip presubmit checks',
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")
62
63 # Flags this wrapper script handles itself:
64 result.add_option("-m", "--mode",
65 help="The test modes in which to run (comma-separated)",
66 default='release,debug')
67 result.add_option("--arch",
68 help='The architectures to run tests for (comma-separated)',
69 default='ia32,x64,arm')
70
71 # Flags that are passed on to the wrapped test.py script:
72 result.add_option("-v", "--verbose", help="Verbose output",
73 default=False, action="store_true")
74 result.add_option("-p", "--progress",
75 help="The style of progress indicator (verbose, dots, color, mono)",
76 choices=PROGRESS_INDICATORS, default="mono")
77 result.add_option("--report", help="Print a summary of the tests to be run",
78 default=False, action="store_true")
79 result.add_option("--download-data", help="Download missing test suite data",
80 default=False, action="store_true")
81 result.add_option("-s", "--suite", help="A test suite",
82 default=[], action="append")
83 result.add_option("-t", "--timeout", help="Timeout in seconds",
84 default=60, type="int")
85 result.add_option("--snapshot", help="Run the tests with snapshot turned on",
86 default=False, action="store_true")
87 result.add_option("--special-command", default=None)
88 result.add_option("--valgrind", help="Run tests through valgrind",
89 default=False, action="store_true")
90 result.add_option("--cat", help="Print the source of the tests",
91 default=False, action="store_true")
92 result.add_option("--warn-unused", help="Report unused rules",
93 default=False, action="store_true")
94 result.add_option("-j", help="The number of parallel tasks to run",
95 default=1, type="int")
96 result.add_option("--time", help="Print timing information after running",
97 default=False, action="store_true")
98 result.add_option("--suppress-dialogs",
99 help="Suppress Windows dialogs for crashing tests",
100 dest="suppress_dialogs", default=True, action="store_true")
101 result.add_option("--no-suppress-dialogs",
102 help="Display Windows dialogs for crashing tests",
103 dest="suppress_dialogs", action="store_false")
104 result.add_option("--isolates", help="Whether to test isolates",
105 default=False, action="store_true")
106 result.add_option("--store-unexpected-output",
107 help="Store the temporary JS files from tests that fails",
108 dest="store_unexpected_output", default=True, action="store_true")
109 result.add_option("--no-store-unexpected-output",
110 help="Deletes the temporary JS files from tests that fails",
111 dest="store_unexpected_output", action="store_false")
112 result.add_option("--stress-only",
113 help="Only run tests with --always-opt --stress-opt",
114 default=False, action="store_true")
115 result.add_option("--nostress",
116 help="Don't run crankshaft --always-opt --stress-op test",
117 default=False, action="store_true")
118 result.add_option("--shard-count",
119 help="Split testsuites into this number of shards",
120 default=1, type="int")
121 result.add_option("--shard-run",
122 help="Run this shard from the split up tests.",
123 default=1, type="int")
124 result.add_option("--noprof", help="Disable profiling support",
125 default=False)
126
127 # Flags present in the original test.py that are unsupported in this wrapper:
128 # -S [-> scons_flags] (we build with gyp/make, not scons)
129 # --no-build (always true)
130 # --build-only (always false)
131 # --build-system (always 'gyp')
132 # --simulator (always true if arch==arm, always false otherwise)
133 # --shell (automatically chosen depending on arch and mode)
134
135 return result
136
137
138 def ProcessOptions(options):
139 if options.arch_and_mode == ".":
140 options.arch = []
141 options.mode = []
142 else:
143 if options.arch_and_mode != None and options.arch_and_mode != "":
144 tokens = options.arch_and_mode.split(".")
145 options.arch = tokens[0]
146 options.mode = tokens[1]
147 options.mode = options.mode.split(',')
148 options.arch = options.arch.split(',')
149 for mode in options.mode:
150 if not mode.lower() in ['debug', 'release']:
151 print "Unknown mode %s" % mode
152 return False
153 for arch in options.arch:
154 if not arch in ['ia32', 'x64', 'arm', 'mipsel', 'android_arm',
155 'android_ia32']:
156 print "Unknown architecture %s" % arch
157 return False
158 if options.buildbot:
159 # Buildbots run presubmit tests as a separate step.
160 options.no_presubmit = True
161 return True
162
163
164 def PassOnOptions(options):
165 result = []
166 if options.verbose:
167 result += ['--verbose']
168 if options.progress != 'mono':
169 result += ['--progress=' + options.progress]
170 if options.report:
171 result += ['--report']
172 if options.download_data:
173 result += ['--download-data']
174 if options.suite != []:
175 for suite in options.suite:
176 result += ['--suite=../../test/' + suite]
177 if options.timeout != 60:
178 result += ['--timeout=%s' % options.timeout]
179 if options.snapshot:
180 result += ['--snapshot']
181 if options.special_command:
182 result += ['--special-command="%s"' % options.special_command]
183 if options.valgrind:
184 result += ['--valgrind']
185 if options.cat:
186 result += ['--cat']
187 if options.warn_unused:
188 result += ['--warn-unused']
189 if options.j != 1:
190 result += ['-j%s' % options.j]
191 if options.time:
192 result += ['--time']
193 if not options.suppress_dialogs:
194 result += ['--no-suppress-dialogs']
195 if options.isolates:
196 result += ['--isolates']
197 if not options.store_unexpected_output:
198 result += ['--no-store-unexpected_output']
199 if options.stress_only:
200 result += ['--stress-only']
201 if options.nostress:
202 result += ['--nostress']
203 if options.shard_count != 1:
204 result += ['--shard-count=%s' % options.shard_count]
205 if options.shard_run != 1:
206 result += ['--shard-run=%s' % options.shard_run]
207 if options.noprof:
208 result += ['--noprof']
209 return result
210
211
212 def Main():
213 parser = BuildOptions()
214 (options, args) = parser.parse_args()
215 if not ProcessOptions(options):
216 parser.print_help()
217 return 1
218
219 workspace = abspath(join(dirname(sys.argv[0]), '..'))
220 returncodes = 0
221
222 if not options.no_presubmit:
223 print ">>> running presubmit tests"
224 returncodes += subprocess.call([sys.executable,
225 workspace + '/tools/presubmit.py'])
226
227 args_for_children = [sys.executable]
228 args_for_children += [workspace + '/tools/test.py'] + PassOnOptions(options)
229 args_for_children += ['--no-build', '--build-system=gyp']
230 for arg in args:
231 args_for_children += [arg]
232 env = os.environ
233
234 for mode in options.mode:
235 for arch in options.arch:
236 print ">>> running tests for %s.%s" % (arch, mode)
237 if options.buildbot:
238 shellpath = workspace + '/' + options.outdir + '/' + mode
239 mode = mode.lower()
240 else:
241 shellpath = workspace + '/' + options.outdir + '/' + arch + '.' + mode
242 env['LD_LIBRARY_PATH'] = shellpath + '/lib.target'
243 shell = shellpath + "/d8"
244 cmdline = ' '.join(args_for_children +
245 ['--arch=' + arch] +
246 ['--mode=' + mode] +
247 ['--shell=' + shell])
248 child = subprocess.Popen(cmdline,
249 shell=True,
250 cwd=workspace,
251 env=env)
252 returncodes += child.wait()
253
254 if len(options.mode) == 0 and len(options.arch) == 0:
255 print ">>> running tests"
256 shellpath = workspace + '/' + options.outdir
257 env['LD_LIBRARY_PATH'] = shellpath + '/lib.target'
258 shell = shellpath + '/d8'
259 child = subprocess.Popen(' '.join(args_for_children +
260 ['--shell=' + shell]),
261 shell=True,
262 cwd=workspace,
263 env=env)
264 returncodes = child.wait()
265
266 return returncodes
267
268
269 if __name__ == '__main__':
270 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698