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 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 967 } | 967 } |
| 968 | 968 |
| 969 if (!launcher_delegate_->ShouldRunTest( | 969 if (!launcher_delegate_->ShouldRunTest( |
| 970 tests_[i].test_case_name, tests_[i].test_name)) { | 970 tests_[i].test_case_name, tests_[i].test_name)) { |
| 971 continue; | 971 continue; |
| 972 } | 972 } |
| 973 | 973 |
| 974 // Count tests in the binary, before we apply filter and sharding. | 974 // Count tests in the binary, before we apply filter and sharding. |
| 975 test_found_count_++; | 975 test_found_count_++; |
| 976 | 976 |
| 977 std::string normlized_test_name = NormalizeTestName(test_name); | |
|
Paweł Hajdan Jr.
2016/10/25 18:16:59
nit: normlized -> normalized (typo)
stgao
2016/10/25 19:16:49
Done.
| |
| 978 | |
| 977 // Skip the test that doesn't match the filter (if given). | 979 // Skip the test that doesn't match the filter (if given). |
| 978 if (!positive_test_filter_.empty()) { | 980 if (!positive_test_filter_.empty()) { |
| 979 bool found = false; | 981 bool found = false; |
| 980 for (size_t k = 0; k < positive_test_filter_.size(); ++k) { | 982 for (size_t k = 0; k < positive_test_filter_.size(); ++k) { |
| 981 if (MatchPattern(test_name, positive_test_filter_[k])) { | 983 if (MatchPattern(test_name, positive_test_filter_[k]) || |
| 984 MatchPattern(normlized_test_name, positive_test_filter_[k])) { | |
| 982 found = true; | 985 found = true; |
| 983 break; | 986 break; |
| 984 } | 987 } |
| 985 } | 988 } |
| 986 | 989 |
| 987 if (!found) | 990 if (!found) |
| 988 continue; | 991 continue; |
| 989 } | 992 } |
| 990 bool excluded = false; | 993 if (!negative_test_filter_.empty()) { |
| 991 for (size_t k = 0; k < negative_test_filter_.size(); ++k) { | 994 bool excluded = false; |
| 992 if (MatchPattern(test_name, negative_test_filter_[k])) { | 995 for (size_t k = 0; k < negative_test_filter_.size(); ++k) { |
| 993 excluded = true; | 996 if (MatchPattern(test_name, negative_test_filter_[k]) || |
| 994 break; | 997 MatchPattern(normlized_test_name, negative_test_filter_[k])) { |
| 998 excluded = true; | |
| 999 break; | |
| 1000 } | |
| 995 } | 1001 } |
| 1002 | |
| 1003 if (excluded) | |
| 1004 continue; | |
| 996 } | 1005 } |
| 997 if (excluded) | |
| 998 continue; | |
| 999 | 1006 |
| 1000 if (Hash(test_name) % total_shards_ != static_cast<uint32_t>(shard_index_)) | 1007 if (Hash(test_name) % total_shards_ != static_cast<uint32_t>(shard_index_)) |
| 1001 continue; | 1008 continue; |
| 1002 | 1009 |
| 1003 test_names.push_back(test_name); | 1010 test_names.push_back(test_name); |
| 1004 } | 1011 } |
| 1005 | 1012 |
| 1006 // Save an early test summary in case the launcher crashes or gets killed. | 1013 // Save an early test summary in case the launcher crashes or gets killed. |
| 1007 MaybeSaveSummaryAsJSON({"EARLY_SUMMARY", kUnreliableResultsTag}); | 1014 MaybeSaveSummaryAsJSON({"EARLY_SUMMARY", kUnreliableResultsTag}); |
| 1008 | 1015 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1158 } | 1165 } |
| 1159 | 1166 |
| 1160 std::string snippet(full_output.substr(run_pos)); | 1167 std::string snippet(full_output.substr(run_pos)); |
| 1161 if (end_pos != std::string::npos) | 1168 if (end_pos != std::string::npos) |
| 1162 snippet = full_output.substr(run_pos, end_pos - run_pos); | 1169 snippet = full_output.substr(run_pos, end_pos - run_pos); |
| 1163 | 1170 |
| 1164 return snippet; | 1171 return snippet; |
| 1165 } | 1172 } |
| 1166 | 1173 |
| 1167 } // namespace base | 1174 } // namespace base |
| OLD | NEW |