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

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

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/push-to-trunk/test_scripts.py ('k') | tools/testrunner/local/junit_output.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 23 matching lines...) Expand all
92 help="Architecture and mode in the format 'arch.mode'", 96 help="Architecture and mode in the format 'arch.mode'",
93 default=None) 97 default=None)
94 result.add_option("--buildbot", 98 result.add_option("--buildbot",
95 help="Adapt to path structure used on buildbots", 99 help="Adapt to path structure used on buildbots",
96 default=False, action="store_true") 100 default=False, action="store_true")
97 result.add_option("--cat", help="Print the source of the tests", 101 result.add_option("--cat", help="Print the source of the tests",
98 default=False, action="store_true") 102 default=False, action="store_true")
99 result.add_option("--flaky-tests", 103 result.add_option("--flaky-tests",
100 help="Regard tests marked as flaky (run|skip|dontcare)", 104 help="Regard tests marked as flaky (run|skip|dontcare)",
101 default="dontcare") 105 default="dontcare")
106 result.add_option("--slow-tests",
107 help="Regard slow tests (run|skip|dontcare)",
108 default="dontcare")
109 result.add_option("--pass-fail-tests",
110 help="Regard pass|fail tests (run|skip|dontcare)",
111 default="dontcare")
102 result.add_option("--command-prefix", 112 result.add_option("--command-prefix",
103 help="Prepended to each shell command used to run a test", 113 help="Prepended to each shell command used to run a test",
104 default="") 114 default="")
105 result.add_option("--download-data", help="Download missing test suite data", 115 result.add_option("--download-data", help="Download missing test suite data",
106 default=False, action="store_true") 116 default=False, action="store_true")
107 result.add_option("--extra-flags", 117 result.add_option("--extra-flags",
108 help="Additional flags to pass to each test command", 118 help="Additional flags to pass to each test command",
109 default="") 119 default="")
110 result.add_option("--isolates", help="Whether to test isolates", 120 result.add_option("--isolates", help="Whether to test isolates",
111 default=False, action="store_true") 121 default=False, action="store_true")
(...skipping 11 matching lines...) Expand all
123 dest="no_network", action="store_true") 133 dest="no_network", action="store_true")
124 result.add_option("--no-presubmit", "--nopresubmit", 134 result.add_option("--no-presubmit", "--nopresubmit",
125 help='Skip presubmit checks', 135 help='Skip presubmit checks',
126 default=False, dest="no_presubmit", action="store_true") 136 default=False, dest="no_presubmit", action="store_true")
127 result.add_option("--no-stress", "--nostress", 137 result.add_option("--no-stress", "--nostress",
128 help="Don't run crankshaft --always-opt --stress-op test", 138 help="Don't run crankshaft --always-opt --stress-op test",
129 default=False, dest="no_stress", action="store_true") 139 default=False, dest="no_stress", action="store_true")
130 result.add_option("--no-variants", "--novariants", 140 result.add_option("--no-variants", "--novariants",
131 help="Don't run any testing variants", 141 help="Don't run any testing variants",
132 default=False, dest="no_variants", action="store_true") 142 default=False, dest="no_variants", action="store_true")
143 result.add_option("--variants",
144 help="Comma-separated list of testing variants")
133 result.add_option("--outdir", help="Base directory with compile output", 145 result.add_option("--outdir", help="Base directory with compile output",
134 default="out") 146 default="out")
135 result.add_option("-p", "--progress", 147 result.add_option("-p", "--progress",
136 help=("The style of progress indicator" 148 help=("The style of progress indicator"
137 " (verbose, dots, color, mono)"), 149 " (verbose, dots, color, mono)"),
138 choices=progress.PROGRESS_INDICATORS.keys(), default="mono") 150 choices=progress.PROGRESS_INDICATORS.keys(), default="mono")
139 result.add_option("--report", help="Print a summary of the tests to be run", 151 result.add_option("--report", help="Print a summary of the tests to be run",
140 default=False, action="store_true") 152 default=False, action="store_true")
141 result.add_option("--shard-count", 153 result.add_option("--shard-count",
142 help="Split testsuites into this number of shards", 154 help="Split testsuites into this number of shards",
(...skipping 23 matching lines...) Expand all
166 default=False, action="store_true") 178 default=False, action="store_true")
167 result.add_option("--junitout", help="File name of the JUnit output") 179 result.add_option("--junitout", help="File name of the JUnit output")
168 result.add_option("--junittestsuite", 180 result.add_option("--junittestsuite",
169 help="The testsuite name in the JUnit output file", 181 help="The testsuite name in the JUnit output file",
170 default="v8tests") 182 default="v8tests")
171 return result 183 return result
172 184
173 185
174 def ProcessOptions(options): 186 def ProcessOptions(options):
175 global VARIANT_FLAGS 187 global VARIANT_FLAGS
188 global VARIANTS
176 189
177 # Architecture and mode related stuff. 190 # Architecture and mode related stuff.
178 if options.arch_and_mode: 191 if options.arch_and_mode:
179 tokens = options.arch_and_mode.split(".") 192 tokens = options.arch_and_mode.split(".")
180 options.arch = tokens[0] 193 options.arch = tokens[0]
181 options.mode = tokens[1] 194 options.mode = tokens[1]
182 options.mode = options.mode.split(",") 195 options.mode = options.mode.split(",")
183 for mode in options.mode: 196 for mode in options.mode:
184 if not mode.lower() in ["debug", "release"]: 197 if not mode.lower() in ["debug", "release"]:
185 print "Unknown mode %s" % mode 198 print "Unknown mode %s" % mode
(...skipping 18 matching lines...) Expand all
204 options.no_network = True 217 options.no_network = True
205 options.command_prefix = shlex.split(options.command_prefix) 218 options.command_prefix = shlex.split(options.command_prefix)
206 options.extra_flags = shlex.split(options.extra_flags) 219 options.extra_flags = shlex.split(options.extra_flags)
207 if options.j == 0: 220 if options.j == 0:
208 options.j = multiprocessing.cpu_count() 221 options.j = multiprocessing.cpu_count()
209 222
210 def excl(*args): 223 def excl(*args):
211 """Returns true if zero or one of multiple arguments are true.""" 224 """Returns true if zero or one of multiple arguments are true."""
212 return reduce(lambda x, y: x + y, args) <= 1 225 return reduce(lambda x, y: x + y, args) <= 1
213 226
214 if not excl(options.no_stress, options.stress_only, options.no_variants): 227 if not excl(options.no_stress, options.stress_only, options.no_variants,
215 print "Use only one of --no-stress, --stress-only or --no-variants." 228 bool(options.variants)):
229 print("Use only one of --no-stress, --stress-only, --no-variants or "
230 "--variants.")
216 return False 231 return False
217 if options.no_stress: 232 if options.no_stress:
218 VARIANT_FLAGS = [[], ["--nocrankshaft"]] 233 VARIANTS = ["default", "nocrankshaft"]
219 if options.no_variants: 234 if options.no_variants:
220 VARIANT_FLAGS = [[]] 235 VARIANTS = ["default"]
236 if options.stress_only:
237 VARIANTS = ["stress"]
238 if options.variants:
239 VARIANTS = options.variants.split(",")
240 if not set(VARIANTS).issubset(VARIANT_FLAGS.keys()):
241 print "All variants must be in %s" % str(VARIANT_FLAGS.keys())
242 return False
221 if not options.shell_dir: 243 if not options.shell_dir:
222 if options.shell: 244 if options.shell:
223 print "Warning: --shell is deprecated, use --shell-dir instead." 245 print "Warning: --shell is deprecated, use --shell-dir instead."
224 options.shell_dir = os.path.dirname(options.shell) 246 options.shell_dir = os.path.dirname(options.shell)
225 if options.stress_only:
226 VARIANT_FLAGS = [["--stress-opt", "--always-opt"]]
227 if options.valgrind: 247 if options.valgrind:
228 run_valgrind = os.path.join("tools", "run-valgrind.py") 248 run_valgrind = os.path.join("tools", "run-valgrind.py")
229 # This is OK for distributed running, so we don't need to set no_network. 249 # This is OK for distributed running, so we don't need to set no_network.
230 options.command_prefix = (["python", "-u", run_valgrind] + 250 options.command_prefix = (["python", "-u", run_valgrind] +
231 options.command_prefix) 251 options.command_prefix)
232 if not options.flaky_tests in ["run", "skip", "dontcare"]: 252 def CheckTestMode(name, option):
233 print "Unknown flaky test mode %s" % options.flaky_tests 253 if not option in ["run", "skip", "dontcare"]:
254 print "Unknown %s mode %s" % (name, option)
255 return False
256 return True
257 if not CheckTestMode("flaky test", options.flaky_tests):
258 return False
259 if not CheckTestMode("slow test", options.slow_tests):
260 return False
261 if not CheckTestMode("pass|fail test", options.pass_fail_tests):
234 return False 262 return False
235 if not options.no_i18n: 263 if not options.no_i18n:
236 DEFAULT_TESTS.append("intl") 264 DEFAULT_TESTS.append("intl")
237 return True 265 return True
238 266
239 267
240 def ShardTests(tests, shard_count, shard_run): 268 def ShardTests(tests, shard_count, shard_run):
241 if shard_count < 2: 269 if shard_count < 2:
242 return tests 270 return tests
243 if shard_run < 1 or shard_run > shard_count: 271 if shard_run < 1 or shard_run > shard_count:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 371 }
344 all_tests = [] 372 all_tests = []
345 num_tests = 0 373 num_tests = 0
346 test_id = 0 374 test_id = 0
347 for s in suites: 375 for s in suites:
348 s.ReadStatusFile(variables) 376 s.ReadStatusFile(variables)
349 s.ReadTestCases(ctx) 377 s.ReadTestCases(ctx)
350 if len(args) > 0: 378 if len(args) > 0:
351 s.FilterTestCasesByArgs(args) 379 s.FilterTestCasesByArgs(args)
352 all_tests += s.tests 380 all_tests += s.tests
353 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests) 381 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests,
382 options.slow_tests, options.pass_fail_tests)
354 if options.cat: 383 if options.cat:
355 verbose.PrintTestSource(s.tests) 384 verbose.PrintTestSource(s.tests)
356 continue 385 continue
386 variant_flags = [VARIANT_FLAGS[var] for var in VARIANTS]
357 s.tests = [ t.CopyAddingFlags(v) 387 s.tests = [ t.CopyAddingFlags(v)
358 for t in s.tests 388 for t in s.tests
359 for v in s.VariantFlags(t, VARIANT_FLAGS) ] 389 for v in s.VariantFlags(t, variant_flags) ]
360 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) 390 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run)
361 num_tests += len(s.tests) 391 num_tests += len(s.tests)
362 for t in s.tests: 392 for t in s.tests:
363 t.id = test_id 393 t.id = test_id
364 test_id += 1 394 test_id += 1
365 395
366 if options.cat: 396 if options.cat:
367 return 0 # We're done here. 397 return 0 # We're done here.
368 398
369 if options.report: 399 if options.report:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 except KeyboardInterrupt: 443 except KeyboardInterrupt:
414 return 1 444 return 1
415 445
416 if options.time: 446 if options.time:
417 verbose.PrintTestDurations(suites, overall_duration) 447 verbose.PrintTestDurations(suites, overall_duration)
418 return exit_code 448 return exit_code
419 449
420 450
421 if __name__ == "__main__": 451 if __name__ == "__main__":
422 sys.exit(Main()) 452 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/push-to-trunk/test_scripts.py ('k') | tools/testrunner/local/junit_output.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698