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

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

Issue 268363019: Let test runner rerun failures to test for flakes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | « no previous file | tools/testrunner/local/execution.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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 result.add_option("--no-i18n", "--noi18n", 145 result.add_option("--no-i18n", "--noi18n",
146 help="Skip internationalization tests", 146 help="Skip internationalization tests",
147 default=False, action="store_true") 147 default=False, action="store_true")
148 result.add_option("--no-network", "--nonetwork", 148 result.add_option("--no-network", "--nonetwork",
149 help="Don't distribute tests on the network", 149 help="Don't distribute tests on the network",
150 default=(utils.GuessOS() != "linux"), 150 default=(utils.GuessOS() != "linux"),
151 dest="no_network", action="store_true") 151 dest="no_network", action="store_true")
152 result.add_option("--no-presubmit", "--nopresubmit", 152 result.add_option("--no-presubmit", "--nopresubmit",
153 help='Skip presubmit checks', 153 help='Skip presubmit checks',
154 default=False, dest="no_presubmit", action="store_true") 154 default=False, dest="no_presubmit", action="store_true")
155 result.add_option("--no-repeat-failures", help="Don't rerun failed tests",
156 default=False, action="store_true")
155 result.add_option("--no-snap", "--nosnap", 157 result.add_option("--no-snap", "--nosnap",
156 help='Test a build compiled without snapshot.', 158 help='Test a build compiled without snapshot.',
157 default=False, dest="no_snap", action="store_true") 159 default=False, dest="no_snap", action="store_true")
158 result.add_option("--no-stress", "--nostress", 160 result.add_option("--no-stress", "--nostress",
159 help="Don't run crankshaft --always-opt --stress-op test", 161 help="Don't run crankshaft --always-opt --stress-op test",
160 default=False, dest="no_stress", action="store_true") 162 default=False, dest="no_stress", action="store_true")
161 result.add_option("--no-variants", "--novariants", 163 result.add_option("--no-variants", "--novariants",
162 help="Don't run any testing variants", 164 help="Don't run any testing variants",
163 default=False, dest="no_variants", action="store_true") 165 default=False, dest="no_variants", action="store_true")
164 result.add_option("--variants", 166 result.add_option("--variants",
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 367
366 for (arch, mode) in options.arch_and_mode: 368 for (arch, mode) in options.arch_and_mode:
367 try: 369 try:
368 code = Execute(arch, mode, args, options, suites, workspace) 370 code = Execute(arch, mode, args, options, suites, workspace)
369 except KeyboardInterrupt: 371 except KeyboardInterrupt:
370 return 2 372 return 2
371 exit_code = exit_code or code 373 exit_code = exit_code or code
372 return exit_code 374 return exit_code
373 375
374 376
377 def RunTests(suites, num_tests, ctx, options, workspace):
378 # Run the tests, either locally or distributed on the network.
379 try:
380 start_time = time.time()
381 progress_indicator = progress.PROGRESS_INDICATORS[options.progress]()
382 if options.junitout:
383 progress_indicator = progress.JUnitTestProgressIndicator(
384 progress_indicator, options.junitout, options.junittestsuite)
385
386 run_networked = not options.no_network
387 if not run_networked:
388 print("Network distribution disabled, running tests locally.")
389 elif utils.GuessOS() != "linux":
390 print("Network distribution is only supported on Linux, sorry!")
391 run_networked = False
392 peers = []
393 if run_networked:
394 peers = network_execution.GetPeers()
395 if not peers:
396 print("No connection to distribution server; running tests locally.")
397 run_networked = False
398 elif len(peers) == 1:
399 print("No other peers on the network; running tests locally.")
400 run_networked = False
401 elif num_tests <= 100:
402 print("Less than 100 tests, running them locally.")
403 run_networked = False
404
405 if run_networked:
406 runner = network_execution.NetworkedRunner(suites, progress_indicator,
407 ctx, peers, workspace)
408 else:
409 runner = execution.Runner(suites, progress_indicator, ctx)
410
411 # TODO(machenbach): Maybe use single thread for reruns?
412 exit_code = runner.Run(options.j)
413 if runner.terminate:
414 return [], exit_code
415 overall_duration = time.time() - start_time
416 except KeyboardInterrupt:
417 raise
418
419 if options.time:
420 verbose.PrintTestDurations(suites, overall_duration)
421 return runner.FailedTests(), exit_code
422
423
375 def Execute(arch, mode, args, options, suites, workspace): 424 def Execute(arch, mode, args, options, suites, workspace):
376 print(">>> Running tests for %s.%s" % (arch, mode)) 425 print(">>> Running tests for %s.%s" % (arch, mode))
377 426
378 shell_dir = options.shell_dir 427 shell_dir = options.shell_dir
379 if not shell_dir: 428 if not shell_dir:
380 if options.buildbot: 429 if options.buildbot:
381 shell_dir = os.path.join(workspace, options.outdir, mode) 430 shell_dir = os.path.join(workspace, options.outdir, mode)
382 mode = mode.lower() 431 mode = mode.lower()
383 else: 432 else:
384 shell_dir = os.path.join(workspace, options.outdir, 433 shell_dir = os.path.join(workspace, options.outdir,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if options.cat: 500 if options.cat:
452 return 0 # We're done here. 501 return 0 # We're done here.
453 502
454 if options.report: 503 if options.report:
455 verbose.PrintReport(all_tests) 504 verbose.PrintReport(all_tests)
456 505
457 if num_tests == 0: 506 if num_tests == 0:
458 print "No tests to run." 507 print "No tests to run."
459 return 0 508 return 0
460 509
461 # Run the tests, either locally or distributed on the network. 510 failed_tests, exit_code = RunTests(
462 try: 511 suites, num_tests, ctx, options, workspace)
463 start_time = time.time() 512 if not failed_tests or options.no_repeat_failures:
464 progress_indicator = progress.PROGRESS_INDICATORS[options.progress]() 513 return exit_code
465 if options.junitout:
466 progress_indicator = progress.JUnitTestProgressIndicator(
467 progress_indicator, options.junitout, options.junittestsuite)
468 514
469 run_networked = not options.no_network 515 # TODO(machenbach): Additional features: Rerun count, max rerun test cases,
470 if not run_networked: 516 # rerun dependent on test timing (i.e. don't rerun very slow tests), group
471 print("Network distribution disabled, running tests locally.") 517 # flakes, e.g. flaky crashes, flaky failures.
472 elif utils.GuessOS() != "linux": 518 print(">>> Rerunning failures for %s.%s" % (arch, mode))
473 print("Network distribution is only supported on Linux, sorry!") 519 num_tests = 0
474 run_networked = False 520 for s in suites:
475 peers = [] 521 s.tests = [t.Copy() for t in failed_tests if t in s.tests]
476 if run_networked: 522 num_tests += len(s.tests)
477 peers = network_execution.GetPeers()
478 if not peers:
479 print("No connection to distribution server; running tests locally.")
480 run_networked = False
481 elif len(peers) == 1:
482 print("No other peers on the network; running tests locally.")
483 run_networked = False
484 elif num_tests <= 100:
485 print("Less than 100 tests, running them locally.")
486 run_networked = False
487 523
488 if run_networked: 524 # TODO(machenbach): Use exit_code of final result as soon as flakes can be
489 runner = network_execution.NetworkedRunner(suites, progress_indicator, 525 # displayed as warnings. For now, the rerun is just FYI.
490 ctx, peers, workspace) 526 # TODO(machenbach): Never hide failures in gc-stress mode.
491 else: 527 failed_tests, _ = RunTests(
492 runner = execution.Runner(suites, progress_indicator, ctx) 528 suites, num_tests, ctx, options, workspace)
493
494 exit_code = runner.Run(options.j)
495 if runner.terminate:
496 return exit_code
497 overall_duration = time.time() - start_time
498 except KeyboardInterrupt:
499 raise
500
501 if options.time:
502 verbose.PrintTestDurations(suites, overall_duration)
503 return exit_code 529 return exit_code
504 530
505 531
506 if __name__ == "__main__": 532 if __name__ == "__main__":
507 sys.exit(Main()) 533 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | tools/testrunner/local/execution.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698