| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 default="v8tests") | 183 default="v8tests") |
| 183 return result | 184 return result |
| 184 | 185 |
| 185 | 186 |
| 186 def ProcessOptions(options): | 187 def ProcessOptions(options): |
| 187 global VARIANT_FLAGS | 188 global VARIANT_FLAGS |
| 188 global VARIANTS | 189 global VARIANTS |
| 189 | 190 |
| 190 # Architecture and mode related stuff. | 191 # Architecture and mode related stuff. |
| 191 if options.arch_and_mode: | 192 if options.arch_and_mode: |
| 192 tokens = options.arch_and_mode.split(".") | 193 options.arch_and_mode = [arch_and_mode.split(".") |
| 193 options.arch = tokens[0] | 194 for arch_and_mode in options.arch_and_mode.split(",")] |
| 194 options.mode = tokens[1] | 195 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) |
| 196 options.mode = ",".join([tokens[1] for tokens in options.arch_and_mode]) |
| 195 options.mode = options.mode.split(",") | 197 options.mode = options.mode.split(",") |
| 196 for mode in options.mode: | 198 for mode in options.mode: |
| 197 if not mode.lower() in ["debug", "release"]: | 199 if not mode.lower() in ["debug", "release"]: |
| 198 print "Unknown mode %s" % mode | 200 print "Unknown mode %s" % mode |
| 199 return False | 201 return False |
| 200 if options.arch in ["auto", "native"]: | 202 if options.arch in ["auto", "native"]: |
| 201 options.arch = ARCH_GUESS | 203 options.arch = ARCH_GUESS |
| 202 options.arch = options.arch.split(",") | 204 options.arch = options.arch.split(",") |
| 203 for arch in options.arch: | 205 for arch in options.arch: |
| 204 if not arch in SUPPORTED_ARCHS: | 206 if not arch in SUPPORTED_ARCHS: |
| 205 print "Unknown architecture %s" % arch | 207 print "Unknown architecture %s" % arch |
| 206 return False | 208 return False |
| 207 | 209 |
| 210 # Store the final configuration in arch_and_mode list. Don't overwrite |
| 211 # predefined arch_and_mode since it is more expressive than arch and mode. |
| 212 if not options.arch_and_mode: |
| 213 options.arch_and_mode = itertools.product(options.arch, options.mode) |
| 214 |
| 208 # Special processing of other options, sorted alphabetically. | 215 # Special processing of other options, sorted alphabetically. |
| 209 | 216 |
| 210 if options.buildbot: | 217 if options.buildbot: |
| 211 # Buildbots run presubmit tests as a separate step. | 218 # Buildbots run presubmit tests as a separate step. |
| 212 options.no_presubmit = True | 219 options.no_presubmit = True |
| 213 options.no_network = True | 220 options.no_network = True |
| 214 if options.command_prefix: | 221 if options.command_prefix: |
| 215 print("Specifying --command-prefix disables network distribution, " | 222 print("Specifying --command-prefix disables network distribution, " |
| 216 "running tests locally.") | 223 "running tests locally.") |
| 217 options.no_network = True | 224 options.no_network = True |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) | 299 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) |
| 293 if not options.no_presubmit: | 300 if not options.no_presubmit: |
| 294 print ">>> running presubmit tests" | 301 print ">>> running presubmit tests" |
| 295 code = subprocess.call( | 302 code = subprocess.call( |
| 296 [sys.executable, join(workspace, "tools", "presubmit.py")]) | 303 [sys.executable, join(workspace, "tools", "presubmit.py")]) |
| 297 exit_code = code | 304 exit_code = code |
| 298 | 305 |
| 299 suite_paths = utils.GetSuitePaths(join(workspace, "test")) | 306 suite_paths = utils.GetSuitePaths(join(workspace, "test")) |
| 300 | 307 |
| 301 if len(args) == 0: | 308 if len(args) == 0: |
| 302 suite_paths = [ s for s in suite_paths if s in DEFAULT_TESTS ] | 309 suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ] |
| 303 else: | 310 else: |
| 304 args_suites = set() | 311 args_suites = set() |
| 305 for arg in args: | 312 for arg in args: |
| 306 suite = arg.split(os.path.sep)[0] | 313 suite = arg.split(os.path.sep)[0] |
| 307 if not suite in args_suites: | 314 if not suite in args_suites: |
| 308 args_suites.add(suite) | 315 args_suites.add(suite) |
| 309 suite_paths = [ s for s in suite_paths if s in args_suites ] | 316 suite_paths = [ s for s in args_suites if s in suite_paths ] |
| 310 | 317 |
| 311 suites = [] | 318 suites = [] |
| 312 for root in suite_paths: | 319 for root in suite_paths: |
| 313 suite = testsuite.TestSuite.LoadTestSuite( | 320 suite = testsuite.TestSuite.LoadTestSuite( |
| 314 os.path.join(workspace, "test", root)) | 321 os.path.join(workspace, "test", root)) |
| 315 if suite: | 322 if suite: |
| 316 suites.append(suite) | 323 suites.append(suite) |
| 317 | 324 |
| 318 if options.download_data: | 325 if options.download_data: |
| 319 for s in suites: | 326 for s in suites: |
| 320 s.DownloadData() | 327 s.DownloadData() |
| 321 | 328 |
| 322 for mode in options.mode: | 329 for (arch, mode) in options.arch_and_mode: |
| 323 for arch in options.arch: | 330 code = Execute(arch, mode, args, options, suites, workspace) |
| 324 code = Execute(arch, mode, args, options, suites, workspace) | 331 exit_code = exit_code or code |
| 325 exit_code = exit_code or code | |
| 326 return exit_code | 332 return exit_code |
| 327 | 333 |
| 328 | 334 |
| 329 def Execute(arch, mode, args, options, suites, workspace): | 335 def Execute(arch, mode, args, options, suites, workspace): |
| 330 print(">>> Running tests for %s.%s" % (arch, mode)) | 336 print(">>> Running tests for %s.%s" % (arch, mode)) |
| 331 | 337 |
| 332 shell_dir = options.shell_dir | 338 shell_dir = options.shell_dir |
| 333 if not shell_dir: | 339 if not shell_dir: |
| 334 if options.buildbot: | 340 if options.buildbot: |
| 335 shell_dir = os.path.join(workspace, options.outdir, mode) | 341 shell_dir = os.path.join(workspace, options.outdir, mode) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 except KeyboardInterrupt: | 449 except KeyboardInterrupt: |
| 444 return 1 | 450 return 1 |
| 445 | 451 |
| 446 if options.time: | 452 if options.time: |
| 447 verbose.PrintTestDurations(suites, overall_duration) | 453 verbose.PrintTestDurations(suites, overall_duration) |
| 448 return exit_code | 454 return exit_code |
| 449 | 455 |
| 450 | 456 |
| 451 if __name__ == "__main__": | 457 if __name__ == "__main__": |
| 452 sys.exit(Main()) | 458 sys.exit(Main()) |
| OLD | NEW |