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

Side by Side Diff: tools/sharding_supervisor/sharding_supervisor.py

Issue 10441103: Make sharding_supervisor.py run InProcessBrowserTest.Empty (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Response to comments Created 8 years, 5 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 | « content/test/test_launcher.cc ('k') | no next file » | 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Shards a given test suite and runs the shards in parallel. 6 """Shards a given test suite and runs the shards in parallel.
7 7
8 ShardingSupervisor is called to process the command line options and creates 8 ShardingSupervisor is called to process the command line options and creates
9 the specified number of worker threads. These threads then run each shard of 9 the specified number of worker threads. These threads then run each shard of
10 the test in a separate process and report on the results. When all the shards 10 the test in a separate process and report on the results. When all the shards
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 num_cores = DetectNumCores() 590 num_cores = DetectNumCores()
591 591
592 if options.shards_per_core < 1: 592 if options.shards_per_core < 1:
593 parser.error("You must have at least 1 shard per core!") 593 parser.error("You must have at least 1 shard per core!")
594 num_shards_to_run = num_cores * options.shards_per_core 594 num_shards_to_run = num_cores * options.shards_per_core
595 595
596 if options.runs_per_core < 1: 596 if options.runs_per_core < 1:
597 parser.error("You must have at least 1 run per core!") 597 parser.error("You must have at least 1 run per core!")
598 num_runs = num_cores * options.runs_per_core 598 num_runs = num_cores * options.runs_per_core
599 599
600 test = args[0]
600 gtest_args = ["--gtest_color=%s" % { 601 gtest_args = ["--gtest_color=%s" % {
601 True: "yes", False: "no"}[options.color]] + args[1:] 602 True: "yes", False: "no"}[options.color]] + args[1:]
602 603
603 if options.original_order: 604 if options.original_order:
604 options.prefix = True 605 options.prefix = True
605 606
606 # TODO(charleslee): for backwards compatibility with buildbot's log_parser 607 # TODO(charleslee): for backwards compatibility with buildbot's log_parser
607 if options.reorder: 608 if options.reorder:
608 options.original_order = False 609 options.original_order = False
609 options.prefix = True 610 options.prefix = True
610 611
611 if options.random_seed: 612 if options.random_seed:
612 seed = random.randint(1, 99999) 613 seed = random.randint(1, 99999)
613 gtest_args.extend(["--gtest_shuffle", "--gtest_random_seed=%i" % seed]) 614 gtest_args.extend(["--gtest_shuffle", "--gtest_random_seed=%i" % seed])
614 615
615 if options.retry_failed: 616 if options.retry_failed:
616 if options.retry_percent < 0 or options.retry_percent > 100: 617 if options.retry_percent < 0 or options.retry_percent > 100:
617 parser.error("Retry percent must be an integer [0, 100]!") 618 parser.error("Retry percent must be an integer [0, 100]!")
618 else: 619 else:
619 options.retry_percent = -1 620 options.retry_percent = -1
620 621
621 if options.runshard != None: 622 if options.runshard != None:
622 # run a single shard and exit 623 # run a single shard and exit
623 if (options.runshard < 0 or options.runshard >= num_shards_to_run): 624 if (options.runshard < 0 or options.runshard >= num_shards_to_run):
624 parser.error("Invalid shard number given parameters!") 625 parser.error("Invalid shard number given parameters!")
625 shard = RunShard( 626 shard = RunShard(
626 args[0], num_shards_to_run, options.runshard, gtest_args, None, None) 627 test, num_shards_to_run, options.runshard, gtest_args, None, None)
627 shard.communicate() 628 shard.communicate()
628 return shard.poll() 629 return shard.poll()
629 630
631 # When running browser_tests, load the test binary into memory before running
632 # any tests. This is needed to prevent loading it from disk causing the first
633 # run tests to timeout flakily. See: http://crbug.com/124260
634 if "browser_tests" in test:
635 args = [test]
636 args.extend(gtest_args)
637 args.append("--warmup")
638 result = subprocess.call(args,
639 bufsize=0,
640 universal_newlines=True)
641 # If the test fails, don't run anything else.
642 if result != 0:
643 return result
644
630 # shard and run the whole test 645 # shard and run the whole test
631 ss = ShardingSupervisor( 646 ss = ShardingSupervisor(
632 args[0], num_shards_to_run, num_runs, options.color, 647 test, num_shards_to_run, num_runs, options.color,
633 options.original_order, options.prefix, options.retry_percent, 648 options.original_order, options.prefix, options.retry_percent,
634 options.timeout, options.total_slaves, options.slave_index, gtest_args) 649 options.timeout, options.total_slaves, options.slave_index, gtest_args)
635 return ss.ShardTest() 650 return ss.ShardTest()
636 651
637 652
638 if __name__ == "__main__": 653 if __name__ == "__main__":
639 sys.exit(main()) 654 sys.exit(main())
OLDNEW
« no previous file with comments | « content/test/test_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698