| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 759 |
| 760 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 760 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 761 if (test_name.find("DISABLED") != std::string::npos) { | 761 if (test_name.find("DISABLED") != std::string::npos) { |
| 762 results_tracker_.AddDisabledTest(test_name); | 762 results_tracker_.AddDisabledTest(test_name); |
| 763 | 763 |
| 764 // Skip disabled tests unless explicitly requested. | 764 // Skip disabled tests unless explicitly requested. |
| 765 if (!command_line->HasSwitch(kGTestRunDisabledTestsFlag)) | 765 if (!command_line->HasSwitch(kGTestRunDisabledTestsFlag)) |
| 766 continue; | 766 continue; |
| 767 } | 767 } |
| 768 | 768 |
| 769 std::string filtering_test_name = | |
| 770 launcher_delegate_->GetTestNameForFiltering(test_case, test_info); | |
| 771 | |
| 772 // Skip the test that doesn't match the filter (if given). | 769 // Skip the test that doesn't match the filter (if given). |
| 773 if (!positive_test_filter_.empty()) { | 770 if (!positive_test_filter_.empty()) { |
| 774 bool found = false; | 771 bool found = false; |
| 775 for (size_t k = 0; k < positive_test_filter_.size(); ++k) { | 772 for (size_t k = 0; k < positive_test_filter_.size(); ++k) { |
| 776 if (MatchPattern(filtering_test_name, positive_test_filter_[k])) { | 773 if (MatchPattern(test_name, positive_test_filter_[k])) { |
| 777 found = true; | 774 found = true; |
| 778 break; | 775 break; |
| 779 } | 776 } |
| 780 } | 777 } |
| 781 | 778 |
| 782 if (!found) | 779 if (!found) |
| 783 continue; | 780 continue; |
| 784 } | 781 } |
| 785 bool excluded = false; | 782 bool excluded = false; |
| 786 for (size_t k = 0; k < negative_test_filter_.size(); ++k) { | 783 for (size_t k = 0; k < negative_test_filter_.size(); ++k) { |
| 787 if (MatchPattern(filtering_test_name, negative_test_filter_[k])) { | 784 if (MatchPattern(test_name, negative_test_filter_[k])) { |
| 788 excluded = true; | 785 excluded = true; |
| 789 break; | 786 break; |
| 790 } | 787 } |
| 791 } | 788 } |
| 792 if (excluded) | 789 if (excluded) |
| 793 continue; | 790 continue; |
| 794 | 791 |
| 795 if (!launcher_delegate_->ShouldRunTest(test_case, test_info)) | 792 if (!launcher_delegate_->ShouldRunTest(test_case, test_info)) |
| 796 continue; | 793 continue; |
| 797 | 794 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 824 // Special value "-1" means "repeat indefinitely". | 821 // Special value "-1" means "repeat indefinitely". |
| 825 cycles_ = (cycles_ == -1) ? cycles_ : cycles_ - 1; | 822 cycles_ = (cycles_ == -1) ? cycles_ : cycles_ - 1; |
| 826 | 823 |
| 827 test_started_count_ = 0; | 824 test_started_count_ = 0; |
| 828 test_finished_count_ = 0; | 825 test_finished_count_ = 0; |
| 829 test_success_count_ = 0; | 826 test_success_count_ = 0; |
| 830 test_broken_count_ = 0; | 827 test_broken_count_ = 0; |
| 831 retry_count_ = 0; | 828 retry_count_ = 0; |
| 832 tests_to_retry_.clear(); | 829 tests_to_retry_.clear(); |
| 833 results_tracker_.OnTestIterationStarting(); | 830 results_tracker_.OnTestIterationStarting(); |
| 834 launcher_delegate_->OnTestIterationStarting(); | |
| 835 | 831 |
| 836 MessageLoop::current()->PostTask( | 832 MessageLoop::current()->PostTask( |
| 837 FROM_HERE, Bind(&TestLauncher::RunTests, Unretained(this))); | 833 FROM_HERE, Bind(&TestLauncher::RunTests, Unretained(this))); |
| 838 } | 834 } |
| 839 | 835 |
| 840 void TestLauncher::MaybeSaveSummaryAsJSON() { | 836 void TestLauncher::MaybeSaveSummaryAsJSON() { |
| 841 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 837 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 842 if (command_line->HasSwitch(switches::kTestLauncherSummaryOutput)) { | 838 if (command_line->HasSwitch(switches::kTestLauncherSummaryOutput)) { |
| 843 FilePath summary_path(command_line->GetSwitchValuePath( | 839 FilePath summary_path(command_line->GetSwitchValuePath( |
| 844 switches::kTestLauncherSummaryOutput)); | 840 switches::kTestLauncherSummaryOutput)); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1057 |
| 1062 g_live_processes.Get().erase(process_handle); | 1058 g_live_processes.Get().erase(process_handle); |
| 1063 } | 1059 } |
| 1064 | 1060 |
| 1065 base::CloseProcessHandle(process_handle); | 1061 base::CloseProcessHandle(process_handle); |
| 1066 | 1062 |
| 1067 return exit_code; | 1063 return exit_code; |
| 1068 } | 1064 } |
| 1069 | 1065 |
| 1070 } // namespace base | 1066 } // namespace base |
| OLD | NEW |