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 from collections import OrderedDict |
31 import itertools | 32 import itertools |
32 import multiprocessing | 33 import multiprocessing |
33 import optparse | 34 import optparse |
34 import os | 35 import os |
35 from os.path import join | 36 from os.path import join |
36 import platform | 37 import platform |
37 import random | 38 import random |
38 import shlex | 39 import shlex |
39 import subprocess | 40 import subprocess |
40 import sys | 41 import sys |
41 import time | 42 import time |
42 | 43 |
43 from testrunner.local import execution | 44 from testrunner.local import execution |
44 from testrunner.local import progress | 45 from testrunner.local import progress |
45 from testrunner.local import testsuite | 46 from testrunner.local import testsuite |
46 from testrunner.local import utils | 47 from testrunner.local import utils |
47 from testrunner.local import verbose | 48 from testrunner.local import verbose |
48 from testrunner.network import network_execution | 49 from testrunner.network import network_execution |
49 from testrunner.objects import context | 50 from testrunner.objects import context |
50 | 51 |
51 | 52 |
52 ARCH_GUESS = utils.DefaultArch() | 53 ARCH_GUESS = utils.DefaultArch() |
53 DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "cctest", "message", "preparser"] | 54 DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "cctest", "message", "preparser"] |
| 55 |
| 56 # Map of test name synonyms to lists of test suites. Should be ordered by |
| 57 # expected runtimes (suites with slow test cases first). These groups are |
| 58 # invoked in seperate steps on the bots. |
| 59 TEST_MAP = { |
| 60 "default": [ |
| 61 "mjsunit", |
| 62 "fuzz-natives", |
| 63 "cctest", |
| 64 "message", |
| 65 "preparser", |
| 66 ], |
| 67 "optimize_for_size": [ |
| 68 "mjsunit", |
| 69 "cctest", |
| 70 "webkit", |
| 71 ], |
| 72 "unittests": [ |
| 73 "compiler-unittests", |
| 74 "heap-unittests", |
| 75 "base-unittests", |
| 76 "libplatform-unittests", |
| 77 ], |
| 78 } |
| 79 |
54 TIMEOUT_DEFAULT = 60 | 80 TIMEOUT_DEFAULT = 60 |
55 TIMEOUT_SCALEFACTOR = {"debug" : 4, | 81 TIMEOUT_SCALEFACTOR = {"debug" : 4, |
56 "release" : 1 } | 82 "release" : 1 } |
57 | 83 |
58 # Use this to run several variants of the tests. | 84 # Use this to run several variants of the tests. |
59 VARIANT_FLAGS = { | 85 VARIANT_FLAGS = { |
60 "default": [], | 86 "default": [], |
61 "stress": ["--stress-opt", "--always-opt"], | 87 "stress": ["--stress-opt", "--always-opt"], |
62 "nocrankshaft": ["--nocrankshaft"]} | 88 "nocrankshaft": ["--nocrankshaft"]} |
63 | 89 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 370 |
345 exit_code = 0 | 371 exit_code = 0 |
346 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) | 372 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) |
347 if not options.no_presubmit: | 373 if not options.no_presubmit: |
348 print ">>> running presubmit tests" | 374 print ">>> running presubmit tests" |
349 exit_code = subprocess.call( | 375 exit_code = subprocess.call( |
350 [sys.executable, join(workspace, "tools", "presubmit.py")]) | 376 [sys.executable, join(workspace, "tools", "presubmit.py")]) |
351 | 377 |
352 suite_paths = utils.GetSuitePaths(join(workspace, "test")) | 378 suite_paths = utils.GetSuitePaths(join(workspace, "test")) |
353 | 379 |
| 380 # Expand arguments with grouped tests. The args should reflect the list of |
| 381 # suites as otherwise filters would break. |
| 382 def ExpandTestGroups(name): |
| 383 if name in TEST_MAP: |
| 384 return [suite for suite in TEST_MAP[arg]] |
| 385 else: |
| 386 return [name] |
| 387 args = reduce(lambda x, y: x + y, |
| 388 [ExpandTestGroups(arg) for arg in args], |
| 389 []) |
| 390 |
354 if len(args) == 0: | 391 if len(args) == 0: |
355 suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ] | 392 suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ] |
356 else: | 393 else: |
357 args_suites = set() | 394 args_suites = OrderedDict() # Used as set |
358 for arg in args: | 395 for arg in args: |
359 suite = arg.split(os.path.sep)[0] | 396 args_suites[arg.split(os.path.sep)[0]] = True |
360 if not suite in args_suites: | |
361 args_suites.add(suite) | |
362 suite_paths = [ s for s in args_suites if s in suite_paths ] | 397 suite_paths = [ s for s in args_suites if s in suite_paths ] |
363 | 398 |
364 suites = [] | 399 suites = [] |
365 for root in suite_paths: | 400 for root in suite_paths: |
366 suite = testsuite.TestSuite.LoadTestSuite( | 401 suite = testsuite.TestSuite.LoadTestSuite( |
367 os.path.join(workspace, "test", root)) | 402 os.path.join(workspace, "test", root)) |
368 if suite: | 403 if suite: |
369 suites.append(suite) | 404 suites.append(suite) |
370 | 405 |
371 if options.download_data: | 406 if options.download_data: |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 exit_code = runner.Run(options.j) | 541 exit_code = runner.Run(options.j) |
507 overall_duration = time.time() - start_time | 542 overall_duration = time.time() - start_time |
508 | 543 |
509 if options.time: | 544 if options.time: |
510 verbose.PrintTestDurations(suites, overall_duration) | 545 verbose.PrintTestDurations(suites, overall_duration) |
511 return exit_code | 546 return exit_code |
512 | 547 |
513 | 548 |
514 if __name__ == "__main__": | 549 if __name__ == "__main__": |
515 sys.exit(Main()) | 550 sys.exit(Main()) |
OLD | NEW |