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", "base-unittests", | 54 DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "base-unittests", |
54 "cctest", "compiler-unittests", "message", "preparser"] | 55 "cctest", "compiler-unittests", "message", "preparser"] |
| 56 |
| 57 # Map of test name synonyms to lists of test suites. Should be ordered by |
| 58 # expected runtimes (suites with slow test cases first). These groups are |
| 59 # invoked in seperate steps on the bots. |
| 60 TEST_MAP = { |
| 61 "default": [ |
| 62 "mjsunit", |
| 63 "fuzz-natives", |
| 64 "cctest", |
| 65 "message", |
| 66 "preparser", |
| 67 ], |
| 68 "optimize_for_size": [ |
| 69 "mjsunit", |
| 70 "cctest", |
| 71 "webkit", |
| 72 ], |
| 73 "unittests": [ |
| 74 "compiler-unittests", |
| 75 "heap-unittests", |
| 76 "base-unittests", |
| 77 "libplatform-unittests", |
| 78 ], |
| 79 } |
| 80 |
55 TIMEOUT_DEFAULT = 60 | 81 TIMEOUT_DEFAULT = 60 |
56 TIMEOUT_SCALEFACTOR = {"debug" : 4, | 82 TIMEOUT_SCALEFACTOR = {"debug" : 4, |
57 "release" : 1 } | 83 "release" : 1 } |
58 | 84 |
59 # Use this to run several variants of the tests. | 85 # Use this to run several variants of the tests. |
60 VARIANT_FLAGS = { | 86 VARIANT_FLAGS = { |
61 "default": [], | 87 "default": [], |
62 "stress": ["--stress-opt", "--always-opt"], | 88 "stress": ["--stress-opt", "--always-opt"], |
63 "turbofan": ["--turbo-filter=*", "--always-opt"], | 89 "turbofan": ["--turbo-filter=*", "--always-opt"], |
64 "nocrankshaft": ["--nocrankshaft"]} | 90 "nocrankshaft": ["--nocrankshaft"]} |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 396 |
371 exit_code = 0 | 397 exit_code = 0 |
372 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) | 398 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) |
373 if not options.no_presubmit: | 399 if not options.no_presubmit: |
374 print ">>> running presubmit tests" | 400 print ">>> running presubmit tests" |
375 exit_code = subprocess.call( | 401 exit_code = subprocess.call( |
376 [sys.executable, join(workspace, "tools", "presubmit.py")]) | 402 [sys.executable, join(workspace, "tools", "presubmit.py")]) |
377 | 403 |
378 suite_paths = utils.GetSuitePaths(join(workspace, "test")) | 404 suite_paths = utils.GetSuitePaths(join(workspace, "test")) |
379 | 405 |
| 406 # Expand arguments with grouped tests. The args should reflect the list of |
| 407 # suites as otherwise filters would break. |
| 408 def ExpandTestGroups(name): |
| 409 if name in TEST_MAP: |
| 410 return [suite for suite in TEST_MAP[arg]] |
| 411 else: |
| 412 return [name] |
| 413 args = reduce(lambda x, y: x + y, |
| 414 [ExpandTestGroups(arg) for arg in args], |
| 415 []) |
| 416 |
380 if len(args) == 0: | 417 if len(args) == 0: |
381 suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ] | 418 suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ] |
382 else: | 419 else: |
383 args_suites = set() | 420 args_suites = OrderedDict() # Used as set |
384 for arg in args: | 421 for arg in args: |
385 suite = arg.split(os.path.sep)[0] | 422 args_suites[arg.split(os.path.sep)[0]] = True |
386 if not suite in args_suites: | |
387 args_suites.add(suite) | |
388 suite_paths = [ s for s in args_suites if s in suite_paths ] | 423 suite_paths = [ s for s in args_suites if s in suite_paths ] |
389 | 424 |
390 suites = [] | 425 suites = [] |
391 for root in suite_paths: | 426 for root in suite_paths: |
392 suite = testsuite.TestSuite.LoadTestSuite( | 427 suite = testsuite.TestSuite.LoadTestSuite( |
393 os.path.join(workspace, "test", root)) | 428 os.path.join(workspace, "test", root)) |
394 if suite: | 429 if suite: |
395 suites.append(suite) | 430 suites.append(suite) |
396 | 431 |
397 if options.download_data: | 432 if options.download_data: |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 exit_code = runner.Run(options.j) | 576 exit_code = runner.Run(options.j) |
542 overall_duration = time.time() - start_time | 577 overall_duration = time.time() - start_time |
543 | 578 |
544 if options.time: | 579 if options.time: |
545 verbose.PrintTestDurations(suites, overall_duration) | 580 verbose.PrintTestDurations(suites, overall_duration) |
546 return exit_code | 581 return exit_code |
547 | 582 |
548 | 583 |
549 if __name__ == "__main__": | 584 if __name__ == "__main__": |
550 sys.exit(Main()) | 585 sys.exit(Main()) |
OLD | NEW |