OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 | 30 |
| 31 import itertools |
31 import multiprocessing | 32 import multiprocessing |
32 import optparse | 33 import optparse |
33 import os | 34 import os |
34 from os.path import join | 35 from os.path import join |
35 import shlex | 36 import shlex |
36 import subprocess | 37 import subprocess |
37 import sys | 38 import sys |
38 import time | 39 import time |
39 | 40 |
40 from testrunner.local import execution | 41 from testrunner.local import execution |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 default="v8tests") | 177 default="v8tests") |
177 return result | 178 return result |
178 | 179 |
179 | 180 |
180 def ProcessOptions(options): | 181 def ProcessOptions(options): |
181 global VARIANT_FLAGS | 182 global VARIANT_FLAGS |
182 global VARIANTS | 183 global VARIANTS |
183 | 184 |
184 # Architecture and mode related stuff. | 185 # Architecture and mode related stuff. |
185 if options.arch_and_mode: | 186 if options.arch_and_mode: |
186 tokens = options.arch_and_mode.split(".") | 187 options.arch_and_mode = [arch_and_mode.split(".") |
187 options.arch = tokens[0] | 188 for arch_and_mode in options.arch_and_mode.split(",")] |
188 options.mode = tokens[1] | 189 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) |
| 190 options.mode = ",".join([tokens[1] for tokens in options.arch_and_mode]) |
189 options.mode = options.mode.split(",") | 191 options.mode = options.mode.split(",") |
190 for mode in options.mode: | 192 for mode in options.mode: |
191 if not mode.lower() in ["debug", "release"]: | 193 if not mode.lower() in ["debug", "release"]: |
192 print "Unknown mode %s" % mode | 194 print "Unknown mode %s" % mode |
193 return False | 195 return False |
194 if options.arch in ["auto", "native"]: | 196 if options.arch in ["auto", "native"]: |
195 options.arch = ARCH_GUESS | 197 options.arch = ARCH_GUESS |
196 options.arch = options.arch.split(",") | 198 options.arch = options.arch.split(",") |
197 for arch in options.arch: | 199 for arch in options.arch: |
198 if not arch in SUPPORTED_ARCHS: | 200 if not arch in SUPPORTED_ARCHS: |
199 print "Unknown architecture %s" % arch | 201 print "Unknown architecture %s" % arch |
200 return False | 202 return False |
201 | 203 |
| 204 # Store the final configuration in arch_and_mode list. Don't overwrite |
| 205 # predefined arch_and_mode since it is more expressive than arch and mode. |
| 206 if not options.arch_and_mode: |
| 207 options.arch_and_mode = itertools.product(options.arch, options.mode) |
| 208 |
202 # Special processing of other options, sorted alphabetically. | 209 # Special processing of other options, sorted alphabetically. |
203 | 210 |
204 if options.buildbot: | 211 if options.buildbot: |
205 # Buildbots run presubmit tests as a separate step. | 212 # Buildbots run presubmit tests as a separate step. |
206 options.no_presubmit = True | 213 options.no_presubmit = True |
207 options.no_network = True | 214 options.no_network = True |
208 if options.command_prefix: | 215 if options.command_prefix: |
209 print("Specifying --command-prefix disables network distribution, " | 216 print("Specifying --command-prefix disables network distribution, " |
210 "running tests locally.") | 217 "running tests locally.") |
211 options.no_network = True | 218 options.no_network = True |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 for root in suite_paths: | 313 for root in suite_paths: |
307 suite = testsuite.TestSuite.LoadTestSuite( | 314 suite = testsuite.TestSuite.LoadTestSuite( |
308 os.path.join(workspace, "test", root)) | 315 os.path.join(workspace, "test", root)) |
309 if suite: | 316 if suite: |
310 suites.append(suite) | 317 suites.append(suite) |
311 | 318 |
312 if options.download_data: | 319 if options.download_data: |
313 for s in suites: | 320 for s in suites: |
314 s.DownloadData() | 321 s.DownloadData() |
315 | 322 |
316 for mode in options.mode: | 323 for (arch, mode) in options.arch_and_mode: |
317 for arch in options.arch: | 324 code = Execute(arch, mode, args, options, suites, workspace) |
318 code = Execute(arch, mode, args, options, suites, workspace) | 325 exit_code = exit_code or code |
319 exit_code = exit_code or code | |
320 return exit_code | 326 return exit_code |
321 | 327 |
322 | 328 |
323 def Execute(arch, mode, args, options, suites, workspace): | 329 def Execute(arch, mode, args, options, suites, workspace): |
324 print(">>> Running tests for %s.%s" % (arch, mode)) | 330 print(">>> Running tests for %s.%s" % (arch, mode)) |
325 | 331 |
326 shell_dir = options.shell_dir | 332 shell_dir = options.shell_dir |
327 if not shell_dir: | 333 if not shell_dir: |
328 if options.buildbot: | 334 if options.buildbot: |
329 shell_dir = os.path.join(workspace, options.outdir, mode) | 335 shell_dir = os.path.join(workspace, options.outdir, mode) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 except KeyboardInterrupt: | 440 except KeyboardInterrupt: |
435 return 1 | 441 return 1 |
436 | 442 |
437 if options.time: | 443 if options.time: |
438 verbose.PrintTestDurations(suites, overall_duration) | 444 verbose.PrintTestDurations(suites, overall_duration) |
439 return exit_code | 445 return exit_code |
440 | 446 |
441 | 447 |
442 if __name__ == "__main__": | 448 if __name__ == "__main__": |
443 sys.exit(Main()) | 449 sys.exit(Main()) |
OLD | NEW |