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

Side by Side Diff: content/test/test_launcher.cc

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/public/test/test_launcher.h ('k') | tools/sharding_supervisor/sharding_supervisor.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/test_launcher.h" 5 #include "content/public/test/test_launcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 const char kGTestOutputFlag[] = "gtest_output"; 567 const char kGTestOutputFlag[] = "gtest_output";
568 568
569 const char kSingleProcessTestsFlag[] = "single_process"; 569 const char kSingleProcessTestsFlag[] = "single_process";
570 const char kSingleProcessTestsAndChromeFlag[] = "single-process"; 570 const char kSingleProcessTestsAndChromeFlag[] = "single-process";
571 // The following is kept for historical reasons (so people that are used to 571 // The following is kept for historical reasons (so people that are used to
572 // using it don't get surprised). 572 // using it don't get surprised).
573 const char kChildProcessFlag[] = "child"; 573 const char kChildProcessFlag[] = "child";
574 574
575 const char kHelpFlag[] = "help"; 575 const char kHelpFlag[] = "help";
576 576
577 const char kWarmupFlag[] = "warmup";
578
577 TestLauncherDelegate::~TestLauncherDelegate() { 579 TestLauncherDelegate::~TestLauncherDelegate() {
578 } 580 }
579 581
580 int LaunchTests(TestLauncherDelegate* launcher_delegate, 582 int LaunchTests(TestLauncherDelegate* launcher_delegate,
581 int argc, 583 int argc,
582 char** argv) { 584 char** argv) {
583 launcher_delegate->EarlyInitialize(); 585 launcher_delegate->EarlyInitialize();
584 586
585 CommandLine::Init(argc, argv); 587 CommandLine::Init(argc, argv);
586 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 588 const CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 "process mode).\n"); 630 "process mode).\n");
629 631
630 testing::InitGoogleTest(&argc, argv); 632 testing::InitGoogleTest(&argc, argv);
631 TestTimeouts::Initialize(); 633 TestTimeouts::Initialize();
632 int exit_code = 0; 634 int exit_code = 0;
633 635
634 // Make sure the entire browser code is loaded into memory. Reading it 636 // Make sure the entire browser code is loaded into memory. Reading it
635 // from disk may be slow on a busy bot, and can easily exceed the default 637 // from disk may be slow on a busy bot, and can easily exceed the default
636 // timeout causing flaky test failures. Use an empty test that only starts 638 // timeout causing flaky test failures. Use an empty test that only starts
637 // and closes a browser with a long timeout to avoid those problems. 639 // and closes a browser with a long timeout to avoid those problems.
638 // NOTE: we don't do this when specifying a filter because this slows down the 640 // NOTE: We don't do this when specifying a filter because this slows down the
639 // common case of running one test locally, and also on trybots when sharding 641 // common case of running one test locally, and also on trybots when sharding
640 // as this one test runs ~200 times and wastes a few minutes. 642 // as this one test runs ~200 times and wastes a few minutes.
641 if (!should_shard && !command_line->HasSwitch(kGTestFilterFlag)) { 643 bool warmup = command_line->HasSwitch(kWarmupFlag);
644 bool has_filter = command_line->HasSwitch(kGTestFilterFlag);
645 if (warmup || (!should_shard && !has_filter)) {
642 exit_code = RunTest(launcher_delegate, 646 exit_code = RunTest(launcher_delegate,
643 kEmptyTestName, 647 kEmptyTestName,
644 TestTimeouts::large_test_timeout_ms(), 648 TestTimeouts::large_test_timeout_ms(),
645 NULL); 649 NULL);
646 if (exit_code != 0) 650 if (exit_code != 0 || warmup)
647 return exit_code; 651 return exit_code;
648 } 652 }
649 653
650 int cycles = 1; 654 int cycles = 1;
651 if (command_line->HasSwitch(kGTestRepeatFlag)) { 655 if (command_line->HasSwitch(kGTestRepeatFlag)) {
652 base::StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), 656 base::StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag),
653 &cycles); 657 &cycles);
654 } 658 }
655 659
656 while (cycles != 0) { 660 while (cycles != 0) {
657 if (!RunTests(launcher_delegate, 661 if (!RunTests(launcher_delegate,
658 should_shard, 662 should_shard,
659 total_shards, 663 total_shards,
660 shard_index)) { 664 shard_index)) {
661 exit_code = 1; 665 exit_code = 1;
662 break; 666 break;
663 } 667 }
664 668
665 // Special value "-1" means "repeat indefinitely". 669 // Special value "-1" means "repeat indefinitely".
666 if (cycles != -1) 670 if (cycles != -1)
667 cycles--; 671 cycles--;
668 } 672 }
669 return exit_code; 673 return exit_code;
670 } 674 }
671 675
672 } // namespace test_launcher 676 } // namespace test_launcher
OLDNEW
« no previous file with comments | « content/public/test/test_launcher.h ('k') | tools/sharding_supervisor/sharding_supervisor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698