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

Side by Side Diff: tools/run-tests.py

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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/run-deopt-fuzzer.py ('k') | tools/testrunner/local/statusfile.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
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 itertools
32 import multiprocessing 32 import multiprocessing
33 import optparse 33 import optparse
34 import os 34 import os
35 from os.path import join 35 from os.path import join
36 import platform
36 import shlex 37 import shlex
37 import subprocess 38 import subprocess
38 import sys 39 import sys
39 import time 40 import time
40 41
41 from testrunner.local import execution 42 from testrunner.local import execution
42 from testrunner.local import progress 43 from testrunner.local import progress
43 from testrunner.local import testsuite 44 from testrunner.local import testsuite
44 from testrunner.local import utils 45 from testrunner.local import utils
45 from testrunner.local import verbose 46 from testrunner.local import verbose
46 from testrunner.network import network_execution 47 from testrunner.network import network_execution
47 from testrunner.objects import context 48 from testrunner.objects import context
48 49
49 50
50 ARCH_GUESS = utils.DefaultArch() 51 ARCH_GUESS = utils.DefaultArch()
51 DEFAULT_TESTS = ["lexer", "mjsunit", "cctest"] 52 DEFAULT_TESTS = ["mjsunit", "cctest", "message", "preparser", "lexer"]
52 TIMEOUT_DEFAULT = 60 53 TIMEOUT_DEFAULT = 60
53 TIMEOUT_SCALEFACTOR = {"debug" : 4, 54 TIMEOUT_SCALEFACTOR = {"debug" : 4,
54 "release" : 1 } 55 "release" : 1 }
55 56
56 # Use this to run several variants of the tests. 57 # Use this to run several variants of the tests.
58 VARIANT_FLAGS = {
59 "default": [],
60 "stress": ["--stress-opt", "--always-opt"],
61 "nocrankshaft": ["--nocrankshaft"]}
57 62
58 VARIANTS = ["default"] 63 VARIANTS = ["default", "stress", "nocrankshaft"]
59
60 VARIANT_FLAGS = {
61 "default": []
62 }
63 64
64 MODE_FLAGS = { 65 MODE_FLAGS = {
65 "debug" : ["--nobreak-on-abort", "--nodead-code-elimination", 66 "debug" : ["--nohard-abort", "--nodead-code-elimination",
66 "--nofold-constants", "--enable-slow-asserts", 67 "--nofold-constants", "--enable-slow-asserts",
67 "--debug-code", "--verify-heap"], 68 "--debug-code", "--verify-heap"],
68 "release" : ["--nobreak-on-abort", "--nodead-code-elimination", 69 "release" : ["--nohard-abort", "--nodead-code-elimination",
69 "--nofold-constants"]} 70 "--nofold-constants"]}
70 71
72 GC_STRESS_FLAGS = ["--gc-interval=500", "--stress-compaction",
73 "--concurrent-recompilation-queue-length=64",
74 "--concurrent-recompilation-delay=500",
75 "--concurrent-recompilation"]
76
71 SUPPORTED_ARCHS = ["android_arm", 77 SUPPORTED_ARCHS = ["android_arm",
72 "android_ia32", 78 "android_ia32",
73 "arm", 79 "arm",
74 "ia32", 80 "ia32",
75 "mipsel", 81 "mipsel",
76 "nacl_ia32", 82 "nacl_ia32",
77 "nacl_x64", 83 "nacl_x64",
78 "x64"] 84 "x64",
85 "a64"]
79 # Double the timeout for these: 86 # Double the timeout for these:
80 SLOW_ARCHS = ["android_arm", 87 SLOW_ARCHS = ["android_arm",
81 "android_ia32", 88 "android_ia32",
82 "arm", 89 "arm",
83 "mipsel", 90 "mipsel",
84 "nacl_ia32", 91 "nacl_ia32",
85 "nacl_x64"] 92 "nacl_x64",
93 "a64"]
86 94
87 95
88 def BuildOptions(): 96 def BuildOptions():
89 result = optparse.OptionParser() 97 result = optparse.OptionParser()
90 result.add_option("--arch", 98 result.add_option("--arch",
91 help=("The architecture to run tests for, " 99 help=("The architecture to run tests for, "
92 "'auto' or 'native' for auto-detect"), 100 "'auto' or 'native' for auto-detect"),
93 default="ia32,x64,arm") 101 default="ia32,x64,arm")
94 result.add_option("--arch-and-mode", 102 result.add_option("--arch-and-mode",
95 help="Architecture and mode in the format 'arch.mode'", 103 help="Architecture and mode in the format 'arch.mode'",
96 default=None) 104 default=None)
105 result.add_option("--asan",
106 help="Regard test expectations for ASAN",
107 default=False, action="store_true")
97 result.add_option("--buildbot", 108 result.add_option("--buildbot",
98 help="Adapt to path structure used on buildbots", 109 help="Adapt to path structure used on buildbots",
99 default=False, action="store_true") 110 default=False, action="store_true")
100 result.add_option("--cat", help="Print the source of the tests", 111 result.add_option("--cat", help="Print the source of the tests",
101 default=False, action="store_true") 112 default=False, action="store_true")
102 result.add_option("--flaky-tests", 113 result.add_option("--flaky-tests",
103 help="Regard tests marked as flaky (run|skip|dontcare)", 114 help="Regard tests marked as flaky (run|skip|dontcare)",
104 default="dontcare") 115 default="dontcare")
105 result.add_option("--slow-tests", 116 result.add_option("--slow-tests",
106 help="Regard slow tests (run|skip|dontcare)", 117 help="Regard slow tests (run|skip|dontcare)",
107 default="dontcare") 118 default="dontcare")
108 result.add_option("--pass-fail-tests", 119 result.add_option("--pass-fail-tests",
109 help="Regard pass|fail tests (run|skip|dontcare)", 120 help="Regard pass|fail tests (run|skip|dontcare)",
110 default="dontcare") 121 default="dontcare")
122 result.add_option("--gc-stress",
123 help="Switch on GC stress mode",
124 default=False, action="store_true")
111 result.add_option("--command-prefix", 125 result.add_option("--command-prefix",
112 help="Prepended to each shell command used to run a test", 126 help="Prepended to each shell command used to run a test",
113 default="") 127 default="")
114 result.add_option("--download-data", help="Download missing test suite data", 128 result.add_option("--download-data", help="Download missing test suite data",
115 default=False, action="store_true") 129 default=False, action="store_true")
116 result.add_option("--extra-flags", 130 result.add_option("--extra-flags",
117 help="Additional flags to pass to each test command", 131 help="Additional flags to pass to each test command",
118 default="") 132 default="")
119 result.add_option("--isolates", help="Whether to test isolates", 133 result.add_option("--isolates", help="Whether to test isolates",
120 default=False, action="store_true") 134 default=False, action="store_true")
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 default=False, action="store_true") 167 default=False, action="store_true")
154 result.add_option("--shard-count", 168 result.add_option("--shard-count",
155 help="Split testsuites into this number of shards", 169 help="Split testsuites into this number of shards",
156 default=1, type="int") 170 default=1, type="int")
157 result.add_option("--shard-run", 171 result.add_option("--shard-run",
158 help="Run this shard from the split up tests.", 172 help="Run this shard from the split up tests.",
159 default=1, type="int") 173 default=1, type="int")
160 result.add_option("--shell", help="DEPRECATED! use --shell-dir", default="") 174 result.add_option("--shell", help="DEPRECATED! use --shell-dir", default="")
161 result.add_option("--shell-dir", help="Directory containing executables", 175 result.add_option("--shell-dir", help="Directory containing executables",
162 default="") 176 default="")
177 result.add_option("--dont-skip-slow-simulator-tests",
178 help="Don't skip more slow tests when using a simulator.",
179 default=False, action="store_true",
180 dest="dont_skip_simulator_slow_tests")
163 result.add_option("--stress-only", 181 result.add_option("--stress-only",
164 help="Only run tests with --always-opt --stress-opt", 182 help="Only run tests with --always-opt --stress-opt",
165 default=False, action="store_true") 183 default=False, action="store_true")
166 result.add_option("--time", help="Print timing information after running", 184 result.add_option("--time", help="Print timing information after running",
167 default=False, action="store_true") 185 default=False, action="store_true")
168 result.add_option("-t", "--timeout", help="Timeout in seconds", 186 result.add_option("-t", "--timeout", help="Timeout in seconds",
169 default= -1, type="int") 187 default= -1, type="int")
170 result.add_option("-v", "--verbose", help="Verbose output", 188 result.add_option("-v", "--verbose", help="Verbose output",
171 default=False, action="store_true") 189 default=False, action="store_true")
172 result.add_option("--valgrind", help="Run tests through valgrind", 190 result.add_option("--valgrind", help="Run tests through valgrind",
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if options.buildbot: 231 if options.buildbot:
214 # Buildbots run presubmit tests as a separate step. 232 # Buildbots run presubmit tests as a separate step.
215 options.no_presubmit = True 233 options.no_presubmit = True
216 options.no_network = True 234 options.no_network = True
217 if options.command_prefix: 235 if options.command_prefix:
218 print("Specifying --command-prefix disables network distribution, " 236 print("Specifying --command-prefix disables network distribution, "
219 "running tests locally.") 237 "running tests locally.")
220 options.no_network = True 238 options.no_network = True
221 options.command_prefix = shlex.split(options.command_prefix) 239 options.command_prefix = shlex.split(options.command_prefix)
222 options.extra_flags = shlex.split(options.extra_flags) 240 options.extra_flags = shlex.split(options.extra_flags)
241
242 if options.gc_stress:
243 options.extra_flags += GC_STRESS_FLAGS
244
223 if options.j == 0: 245 if options.j == 0:
224 options.j = multiprocessing.cpu_count() 246 options.j = multiprocessing.cpu_count()
225 247
226 def excl(*args): 248 def excl(*args):
227 """Returns true if zero or one of multiple arguments are true.""" 249 """Returns true if zero or one of multiple arguments are true."""
228 return reduce(lambda x, y: x + y, args) <= 1 250 return reduce(lambda x, y: x + y, args) <= 1
229 251
230 if not excl(options.no_stress, options.stress_only, options.no_variants, 252 if not excl(options.no_stress, options.stress_only, options.no_variants,
231 bool(options.variants), options.quickcheck): 253 bool(options.variants), options.quickcheck):
232 print("Use only one of --no-stress, --stress-only, --no-variants, " 254 print("Use only one of --no-stress, --stress-only, --no-variants, "
(...skipping 29 matching lines...) Expand all
262 if not option in ["run", "skip", "dontcare"]: 284 if not option in ["run", "skip", "dontcare"]:
263 print "Unknown %s mode %s" % (name, option) 285 print "Unknown %s mode %s" % (name, option)
264 return False 286 return False
265 return True 287 return True
266 if not CheckTestMode("flaky test", options.flaky_tests): 288 if not CheckTestMode("flaky test", options.flaky_tests):
267 return False 289 return False
268 if not CheckTestMode("slow test", options.slow_tests): 290 if not CheckTestMode("slow test", options.slow_tests):
269 return False 291 return False
270 if not CheckTestMode("pass|fail test", options.pass_fail_tests): 292 if not CheckTestMode("pass|fail test", options.pass_fail_tests):
271 return False 293 return False
294 if not options.no_i18n:
295 DEFAULT_TESTS.append("intl")
272 return True 296 return True
273 297
274 298
275 def ShardTests(tests, shard_count, shard_run): 299 def ShardTests(tests, shard_count, shard_run):
276 if shard_count < 2: 300 if shard_count < 2:
277 return tests 301 return tests
278 if shard_run < 1 or shard_run > shard_count: 302 if shard_run < 1 or shard_run > shard_count:
279 print "shard-run not a valid number, should be in [1:shard-count]" 303 print "shard-run not a valid number, should be in [1:shard-count]"
280 print "defaulting back to running all tests" 304 print "defaulting back to running all tests"
281 return tests 305 return tests
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 timeout = TIMEOUT_DEFAULT; 386 timeout = TIMEOUT_DEFAULT;
363 387
364 timeout *= TIMEOUT_SCALEFACTOR[mode] 388 timeout *= TIMEOUT_SCALEFACTOR[mode]
365 ctx = context.Context(arch, mode, shell_dir, 389 ctx = context.Context(arch, mode, shell_dir,
366 mode_flags, options.verbose, 390 mode_flags, options.verbose,
367 timeout, options.isolates, 391 timeout, options.isolates,
368 options.command_prefix, 392 options.command_prefix,
369 options.extra_flags, 393 options.extra_flags,
370 options.no_i18n) 394 options.no_i18n)
371 395
396 # TODO(all): Combine "simulator" and "simulator_run".
397 simulator_run = not options.dont_skip_simulator_slow_tests and \
398 arch in ['a64', 'arm', 'mips'] and ARCH_GUESS and arch != ARCH_GUESS
372 # Find available test suites and read test cases from them. 399 # Find available test suites and read test cases from them.
373 variables = { 400 variables = {
401 "arch": arch,
402 "asan": options.asan,
403 "deopt_fuzzer": False,
404 "gc_stress": options.gc_stress,
405 "isolates": options.isolates,
374 "mode": mode, 406 "mode": mode,
375 "arch": arch, 407 "no_i18n": options.no_i18n,
408 "simulator_run": simulator_run,
409 "simulator": utils.UseSimulator(arch),
376 "system": utils.GuessOS(), 410 "system": utils.GuessOS(),
377 "isolates": options.isolates,
378 "deopt_fuzzer": False,
379 "no_i18n": options.no_i18n,
380 } 411 }
381 all_tests = [] 412 all_tests = []
382 num_tests = 0 413 num_tests = 0
383 test_id = 0 414 test_id = 0
384 for s in suites: 415 for s in suites:
385 s.ReadStatusFile(variables) 416 s.ReadStatusFile(variables)
386 s.ReadTestCases(ctx) 417 s.ReadTestCases(ctx)
387 if len(args) > 0: 418 if len(args) > 0:
388 s.FilterTestCasesByArgs(args) 419 s.FilterTestCasesByArgs(args)
389 all_tests += s.tests 420 all_tests += s.tests
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 except KeyboardInterrupt: 483 except KeyboardInterrupt:
453 raise 484 raise
454 485
455 if options.time: 486 if options.time:
456 verbose.PrintTestDurations(suites, overall_duration) 487 verbose.PrintTestDurations(suites, overall_duration)
457 return exit_code 488 return exit_code
458 489
459 490
460 if __name__ == "__main__": 491 if __name__ == "__main__":
461 sys.exit(Main()) 492 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/run-deopt-fuzzer.py ('k') | tools/testrunner/local/statusfile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698