Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/test/launcher/test_launcher.h" | 5 #include "base/test/launcher/test_launcher.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 | 571 |
| 572 fprintf(stdout, "Retrying %" PRIuS " test%s (retry #%" PRIuS ")\n", | 572 fprintf(stdout, "Retrying %" PRIuS " test%s (retry #%" PRIuS ")\n", |
| 573 retry_started_count, | 573 retry_started_count, |
| 574 retry_started_count > 1 ? "s" : "", | 574 retry_started_count > 1 ? "s" : "", |
| 575 retry_count_); | 575 retry_count_); |
| 576 fflush(stdout); | 576 fflush(stdout); |
| 577 | 577 |
| 578 test_started_count_ += retry_started_count; | 578 test_started_count_ += retry_started_count; |
| 579 } | 579 } |
| 580 | 580 |
| 581 std::string TestLauncher::FormatFullTestName(const std::string& test_case_name, | |
|
sky
2014/07/31 15:57:22
Add // static on previous line (see style guide).
Sergiy Byelozyorov
2014/07/31 17:33:03
Done.
| |
| 582 const std::string& test_name) { | |
| 583 return test_case_name + "." + test_name; | |
| 584 } | |
| 585 | |
| 581 bool TestLauncher::Init() { | 586 bool TestLauncher::Init() { |
| 582 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 587 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 583 | 588 |
| 584 // Initialize sharding. Command line takes precedence over legacy environment | 589 // Initialize sharding. Command line takes precedence over legacy environment |
| 585 // variables. | 590 // variables. |
| 586 if (command_line->HasSwitch(switches::kTestLauncherTotalShards) && | 591 if (command_line->HasSwitch(switches::kTestLauncherTotalShards) && |
| 587 command_line->HasSwitch(switches::kTestLauncherShardIndex)) { | 592 command_line->HasSwitch(switches::kTestLauncherShardIndex)) { |
| 588 if (!StringToInt( | 593 if (!StringToInt( |
| 589 command_line->GetSwitchValueASCII( | 594 command_line->GetSwitchValueASCII( |
| 590 switches::kTestLauncherTotalShards), | 595 switches::kTestLauncherTotalShards), |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 780 | 785 |
| 781 void TestLauncher::RunTests() { | 786 void TestLauncher::RunTests() { |
| 782 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); | 787 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); |
| 783 | 788 |
| 784 std::vector<std::string> test_names; | 789 std::vector<std::string> test_names; |
| 785 | 790 |
| 786 for (int i = 0; i < unit_test->total_test_case_count(); ++i) { | 791 for (int i = 0; i < unit_test->total_test_case_count(); ++i) { |
| 787 const testing::TestCase* test_case = unit_test->GetTestCase(i); | 792 const testing::TestCase* test_case = unit_test->GetTestCase(i); |
| 788 for (int j = 0; j < test_case->total_test_count(); ++j) { | 793 for (int j = 0; j < test_case->total_test_count(); ++j) { |
| 789 const testing::TestInfo* test_info = test_case->GetTestInfo(j); | 794 const testing::TestInfo* test_info = test_case->GetTestInfo(j); |
| 790 std::string test_name = test_info->test_case_name(); | 795 std::string test_name = FormatFullTestName( |
| 791 test_name.append("."); | 796 test_info->test_case_name(), test_name.append(test_info->name())); |
| 792 test_name.append(test_info->name()); | |
| 793 | 797 |
| 794 results_tracker_.AddTest(test_name); | 798 results_tracker_.AddTest(test_name); |
| 795 | 799 |
| 796 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 800 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 797 if (test_name.find("DISABLED") != std::string::npos) { | 801 if (test_name.find("DISABLED") != std::string::npos) { |
| 798 results_tracker_.AddDisabledTest(test_name); | 802 results_tracker_.AddDisabledTest(test_name); |
| 799 | 803 |
| 800 // Skip disabled tests unless explicitly requested. | 804 // Skip disabled tests unless explicitly requested. |
| 801 if (!command_line->HasSwitch(kGTestRunDisabledTestsFlag)) | 805 if (!command_line->HasSwitch(kGTestRunDisabledTestsFlag)) |
| 802 continue; | 806 continue; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 | 1095 |
| 1092 g_live_processes.Get().erase(process_handle); | 1096 g_live_processes.Get().erase(process_handle); |
| 1093 } | 1097 } |
| 1094 | 1098 |
| 1095 base::CloseProcessHandle(process_handle); | 1099 base::CloseProcessHandle(process_handle); |
| 1096 | 1100 |
| 1097 return exit_code; | 1101 return exit_code; |
| 1098 } | 1102 } |
| 1099 | 1103 |
| 1100 } // namespace base | 1104 } // namespace base |
| OLD | NEW |