OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 | 405 |
406 return exit_code; | 406 return exit_code; |
407 } | 407 } |
408 | 408 |
409 bool RunTests(bool should_shard, int total_shards, int shard_index) { | 409 bool RunTests(bool should_shard, int total_shards, int shard_index) { |
410 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 410 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
411 | 411 |
412 DCHECK(!command_line->HasSwitch(kGTestListTestsFlag)); | 412 DCHECK(!command_line->HasSwitch(kGTestListTestsFlag)); |
413 | 413 |
414 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); | 414 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); |
415 unit_test->parameterized_test_registry().RegisterTests(); | |
Paweł Hajdan Jr.
2011/05/23 19:11:25
I don't think that's very maintainable. What if we
Sheridan Rawlins
2011/05/23 20:37:08
Done.
| |
415 | 416 |
416 std::string filter = command_line->GetSwitchValueASCII(kGTestFilterFlag); | 417 std::string filter = command_line->GetSwitchValueASCII(kGTestFilterFlag); |
417 | 418 |
418 // Split --gtest_filter at '-', if there is one, to separate into | 419 // Split --gtest_filter at '-', if there is one, to separate into |
419 // positive filter and negative filter portions. | 420 // positive filter and negative filter portions. |
420 std::string positive_filter = filter; | 421 std::string positive_filter = filter; |
421 std::string negative_filter = ""; | 422 std::string negative_filter = ""; |
422 size_t dash_pos = filter.find('-'); | 423 size_t dash_pos = filter.find('-'); |
423 if (dash_pos != std::string::npos) { | 424 if (dash_pos != std::string::npos) { |
424 positive_filter = filter.substr(0, dash_pos); // Everything up to the dash. | 425 positive_filter = filter.substr(0, dash_pos); // Everything up to the dash. |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 exit_code = 1; | 641 exit_code = 1; |
641 break; | 642 break; |
642 } | 643 } |
643 | 644 |
644 // Special value "-1" means "repeat indefinitely". | 645 // Special value "-1" means "repeat indefinitely". |
645 if (cycles != -1) | 646 if (cycles != -1) |
646 cycles--; | 647 cycles--; |
647 } | 648 } |
648 return exit_code; | 649 return exit_code; |
649 } | 650 } |
OLD | NEW |