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

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

Issue 85733003: Make test runner more flexible for running fast tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | « test/mozilla/mozilla.status ('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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 from testrunner.objects import context 46 from testrunner.objects import context
47 47
48 48
49 ARCH_GUESS = utils.DefaultArch() 49 ARCH_GUESS = utils.DefaultArch()
50 DEFAULT_TESTS = ["mjsunit", "cctest", "message", "preparser"] 50 DEFAULT_TESTS = ["mjsunit", "cctest", "message", "preparser"]
51 TIMEOUT_DEFAULT = 60 51 TIMEOUT_DEFAULT = 60
52 TIMEOUT_SCALEFACTOR = {"debug" : 4, 52 TIMEOUT_SCALEFACTOR = {"debug" : 4,
53 "release" : 1 } 53 "release" : 1 }
54 54
55 # Use this to run several variants of the tests. 55 # Use this to run several variants of the tests.
56 VARIANT_FLAGS = [[], 56 VARIANT_FLAGS = {
57 ["--stress-opt", "--always-opt"], 57 "default": [],
58 ["--nocrankshaft"]] 58 "stress": ["--stress-opt", "--always-opt"],
59 "nocrankshaft": ["--nocrankshaft"]}
60
61 VARIANTS = ["default", "stress", "nocrankshaft"]
62
59 MODE_FLAGS = { 63 MODE_FLAGS = {
60 "debug" : ["--nobreak-on-abort", "--nodead-code-elimination", 64 "debug" : ["--nobreak-on-abort", "--nodead-code-elimination",
61 "--nofold-constants", "--enable-slow-asserts", 65 "--nofold-constants", "--enable-slow-asserts",
62 "--debug-code", "--verify-heap"], 66 "--debug-code", "--verify-heap"],
63 "release" : ["--nobreak-on-abort", "--nodead-code-elimination", 67 "release" : ["--nobreak-on-abort", "--nodead-code-elimination",
64 "--nofold-constants"]} 68 "--nofold-constants"]}
65 69
66 SUPPORTED_ARCHS = ["android_arm", 70 SUPPORTED_ARCHS = ["android_arm",
67 "android_ia32", 71 "android_ia32",
68 "arm", 72 "arm",
(...skipping 21 matching lines...) Expand all
90 help="Architecture and mode in the format 'arch.mode'", 94 help="Architecture and mode in the format 'arch.mode'",
91 default=None) 95 default=None)
92 result.add_option("--buildbot", 96 result.add_option("--buildbot",
93 help="Adapt to path structure used on buildbots", 97 help="Adapt to path structure used on buildbots",
94 default=False, action="store_true") 98 default=False, action="store_true")
95 result.add_option("--cat", help="Print the source of the tests", 99 result.add_option("--cat", help="Print the source of the tests",
96 default=False, action="store_true") 100 default=False, action="store_true")
97 result.add_option("--flaky-tests", 101 result.add_option("--flaky-tests",
98 help="Regard tests marked as flaky (run|skip|dontcare)", 102 help="Regard tests marked as flaky (run|skip|dontcare)",
99 default="dontcare") 103 default="dontcare")
104 result.add_option("--slow-tests",
105 help="Regard slow tests (run|skip|dontcare)",
106 default="dontcare")
107 result.add_option("--pass-fail-tests",
108 help="Regard pass|fail tests (run|skip|dontcare)",
109 default="dontcare")
100 result.add_option("--command-prefix", 110 result.add_option("--command-prefix",
101 help="Prepended to each shell command used to run a test", 111 help="Prepended to each shell command used to run a test",
102 default="") 112 default="")
103 result.add_option("--download-data", help="Download missing test suite data", 113 result.add_option("--download-data", help="Download missing test suite data",
104 default=False, action="store_true") 114 default=False, action="store_true")
105 result.add_option("--extra-flags", 115 result.add_option("--extra-flags",
106 help="Additional flags to pass to each test command", 116 help="Additional flags to pass to each test command",
107 default="") 117 default="")
108 result.add_option("--isolates", help="Whether to test isolates", 118 result.add_option("--isolates", help="Whether to test isolates",
109 default=False, action="store_true") 119 default=False, action="store_true")
(...skipping 11 matching lines...) Expand all
121 dest="no_network", action="store_true") 131 dest="no_network", action="store_true")
122 result.add_option("--no-presubmit", "--nopresubmit", 132 result.add_option("--no-presubmit", "--nopresubmit",
123 help='Skip presubmit checks', 133 help='Skip presubmit checks',
124 default=False, dest="no_presubmit", action="store_true") 134 default=False, dest="no_presubmit", action="store_true")
125 result.add_option("--no-stress", "--nostress", 135 result.add_option("--no-stress", "--nostress",
126 help="Don't run crankshaft --always-opt --stress-op test", 136 help="Don't run crankshaft --always-opt --stress-op test",
127 default=False, dest="no_stress", action="store_true") 137 default=False, dest="no_stress", action="store_true")
128 result.add_option("--no-variants", "--novariants", 138 result.add_option("--no-variants", "--novariants",
129 help="Don't run any testing variants", 139 help="Don't run any testing variants",
130 default=False, dest="no_variants", action="store_true") 140 default=False, dest="no_variants", action="store_true")
141 result.add_option("--variants",
142 help="Comma-separated list of testing variants")
131 result.add_option("--outdir", help="Base directory with compile output", 143 result.add_option("--outdir", help="Base directory with compile output",
132 default="out") 144 default="out")
133 result.add_option("-p", "--progress", 145 result.add_option("-p", "--progress",
134 help=("The style of progress indicator" 146 help=("The style of progress indicator"
135 " (verbose, dots, color, mono)"), 147 " (verbose, dots, color, mono)"),
136 choices=progress.PROGRESS_INDICATORS.keys(), default="mono") 148 choices=progress.PROGRESS_INDICATORS.keys(), default="mono")
137 result.add_option("--report", help="Print a summary of the tests to be run", 149 result.add_option("--report", help="Print a summary of the tests to be run",
138 default=False, action="store_true") 150 default=False, action="store_true")
139 result.add_option("--shard-count", 151 result.add_option("--shard-count",
140 help="Split testsuites into this number of shards", 152 help="Split testsuites into this number of shards",
(...skipping 19 matching lines...) Expand all
160 default=False, action="store_true") 172 default=False, action="store_true")
161 result.add_option("--junitout", help="File name of the JUnit output") 173 result.add_option("--junitout", help="File name of the JUnit output")
162 result.add_option("--junittestsuite", 174 result.add_option("--junittestsuite",
163 help="The testsuite name in the JUnit output file", 175 help="The testsuite name in the JUnit output file",
164 default="v8tests") 176 default="v8tests")
165 return result 177 return result
166 178
167 179
168 def ProcessOptions(options): 180 def ProcessOptions(options):
169 global VARIANT_FLAGS 181 global VARIANT_FLAGS
182 global VARIANTS
170 183
171 # Architecture and mode related stuff. 184 # Architecture and mode related stuff.
172 if options.arch_and_mode: 185 if options.arch_and_mode:
173 tokens = options.arch_and_mode.split(".") 186 tokens = options.arch_and_mode.split(".")
174 options.arch = tokens[0] 187 options.arch = tokens[0]
175 options.mode = tokens[1] 188 options.mode = tokens[1]
176 options.mode = options.mode.split(",") 189 options.mode = options.mode.split(",")
177 for mode in options.mode: 190 for mode in options.mode:
178 if not mode.lower() in ["debug", "release"]: 191 if not mode.lower() in ["debug", "release"]:
179 print "Unknown mode %s" % mode 192 print "Unknown mode %s" % mode
(...skipping 18 matching lines...) Expand all
198 options.no_network = True 211 options.no_network = True
199 options.command_prefix = shlex.split(options.command_prefix) 212 options.command_prefix = shlex.split(options.command_prefix)
200 options.extra_flags = shlex.split(options.extra_flags) 213 options.extra_flags = shlex.split(options.extra_flags)
201 if options.j == 0: 214 if options.j == 0:
202 options.j = multiprocessing.cpu_count() 215 options.j = multiprocessing.cpu_count()
203 216
204 def excl(*args): 217 def excl(*args):
205 """Returns true if zero or one of multiple arguments are true.""" 218 """Returns true if zero or one of multiple arguments are true."""
206 return reduce(lambda x, y: x + y, args) <= 1 219 return reduce(lambda x, y: x + y, args) <= 1
207 220
208 if not excl(options.no_stress, options.stress_only, options.no_variants): 221 if not excl(options.no_stress, options.stress_only, options.no_variants,
209 print "Use only one of --no-stress, --stress-only or --no-variants." 222 bool(options.variants)):
223 print("Use only one of --no-stress, --stress-only, --no-variants or "
224 "--variants.")
210 return False 225 return False
211 if options.no_stress: 226 if options.no_stress:
212 VARIANT_FLAGS = [[], ["--nocrankshaft"]] 227 VARIANTS = ["default", "nocrankshaft"]
213 if options.no_variants: 228 if options.no_variants:
214 VARIANT_FLAGS = [[]] 229 VARIANTS = ["default"]
230 if options.stress_only:
231 VARIANTS = ["stress"]
232 if options.variants:
233 VARIANTS = options.variants.split(",")
234 if not set(VARIANTS).issubset(VARIANT_FLAGS.keys()):
235 print "All variants must be in %s" % str(VARIANT_FLAGS.keys())
236 return False
215 if not options.shell_dir: 237 if not options.shell_dir:
216 if options.shell: 238 if options.shell:
217 print "Warning: --shell is deprecated, use --shell-dir instead." 239 print "Warning: --shell is deprecated, use --shell-dir instead."
218 options.shell_dir = os.path.dirname(options.shell) 240 options.shell_dir = os.path.dirname(options.shell)
219 if options.stress_only:
220 VARIANT_FLAGS = [["--stress-opt", "--always-opt"]]
221 if options.valgrind: 241 if options.valgrind:
222 run_valgrind = os.path.join("tools", "run-valgrind.py") 242 run_valgrind = os.path.join("tools", "run-valgrind.py")
223 # This is OK for distributed running, so we don't need to set no_network. 243 # This is OK for distributed running, so we don't need to set no_network.
224 options.command_prefix = (["python", "-u", run_valgrind] + 244 options.command_prefix = (["python", "-u", run_valgrind] +
225 options.command_prefix) 245 options.command_prefix)
226 if not options.flaky_tests in ["run", "skip", "dontcare"]: 246 def CheckTestMode(name, option):
227 print "Unknown flaky test mode %s" % options.flaky_tests 247 if not option in ["run", "skip", "dontcare"]:
248 print "Unknown %s mode %s" % (name, option)
249 return False
250 return True
251 if not CheckTestMode("flaky test", options.flaky_tests):
252 return False
253 if not CheckTestMode("slow test", options.slow_tests):
254 return False
255 if not CheckTestMode("pass|fail test", options.pass_fail_tests):
228 return False 256 return False
229 if not options.no_i18n: 257 if not options.no_i18n:
230 DEFAULT_TESTS.append("intl") 258 DEFAULT_TESTS.append("intl")
231 return True 259 return True
232 260
233 261
234 def ShardTests(tests, shard_count, shard_run): 262 def ShardTests(tests, shard_count, shard_run):
235 if shard_count < 2: 263 if shard_count < 2:
236 return tests 264 return tests
237 if shard_run < 1 or shard_run > shard_count: 265 if shard_run < 1 or shard_run > shard_count:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 362 }
335 all_tests = [] 363 all_tests = []
336 num_tests = 0 364 num_tests = 0
337 test_id = 0 365 test_id = 0
338 for s in suites: 366 for s in suites:
339 s.ReadStatusFile(variables) 367 s.ReadStatusFile(variables)
340 s.ReadTestCases(ctx) 368 s.ReadTestCases(ctx)
341 if len(args) > 0: 369 if len(args) > 0:
342 s.FilterTestCasesByArgs(args) 370 s.FilterTestCasesByArgs(args)
343 all_tests += s.tests 371 all_tests += s.tests
344 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests) 372 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests,
373 options.slow_tests, options.pass_fail_tests)
345 if options.cat: 374 if options.cat:
346 verbose.PrintTestSource(s.tests) 375 verbose.PrintTestSource(s.tests)
347 continue 376 continue
377 variant_flags = [VARIANT_FLAGS[var] for var in VARIANTS]
348 s.tests = [ t.CopyAddingFlags(v) 378 s.tests = [ t.CopyAddingFlags(v)
349 for t in s.tests 379 for t in s.tests
350 for v in s.VariantFlags(t, VARIANT_FLAGS) ] 380 for v in s.VariantFlags(t, variant_flags) ]
351 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) 381 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run)
352 num_tests += len(s.tests) 382 num_tests += len(s.tests)
353 for t in s.tests: 383 for t in s.tests:
354 t.id = test_id 384 t.id = test_id
355 test_id += 1 385 test_id += 1
356 386
357 if options.cat: 387 if options.cat:
358 return 0 # We're done here. 388 return 0 # We're done here.
359 389
360 if options.report: 390 if options.report:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 except KeyboardInterrupt: 434 except KeyboardInterrupt:
405 return 1 435 return 1
406 436
407 if options.time: 437 if options.time:
408 verbose.PrintTestDurations(suites, overall_duration) 438 verbose.PrintTestDurations(suites, overall_duration)
409 return exit_code 439 return exit_code
410 440
411 441
412 if __name__ == "__main__": 442 if __name__ == "__main__":
413 sys.exit(Main()) 443 sys.exit(Main())
OLDNEW
« no previous file with comments | « test/mozilla/mozilla.status ('k') | tools/testrunner/local/statusfile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698