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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 if (shard_index_ < 0 || | 609 if (shard_index_ < 0 || |
610 total_shards_ < 0 || | 610 total_shards_ < 0 || |
611 shard_index_ >= total_shards_) { | 611 shard_index_ >= total_shards_) { |
612 LOG(ERROR) << "Invalid sharding settings: we require 0 <= " | 612 LOG(ERROR) << "Invalid sharding settings: we require 0 <= " |
613 << kTestShardIndex << " < " << kTestTotalShards | 613 << kTestShardIndex << " < " << kTestTotalShards |
614 << ", but you have " << kTestShardIndex << "=" << shard_index_ | 614 << ", but you have " << kTestShardIndex << "=" << shard_index_ |
615 << ", " << kTestTotalShards << "=" << total_shards_ << ".\n"; | 615 << ", " << kTestTotalShards << "=" << total_shards_ << ".\n"; |
616 return false; | 616 return false; |
617 } | 617 } |
618 | 618 |
619 // Make sure we don't pass any sharding-related environment to the child | |
620 // processes. This test launcher implements the sharding completely. | |
621 scoped_ptr<Environment> env(Environment::Create()); | |
622 CHECK(env->UnSetVar("GTEST_TOTAL_SHARDS")); | |
623 CHECK(env->UnSetVar("GTEST_SHARD_INDEX")); | |
624 | |
625 if (command_line->HasSwitch(kGTestRepeatFlag) && | 619 if (command_line->HasSwitch(kGTestRepeatFlag) && |
626 !StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), | 620 !StringToInt(command_line->GetSwitchValueASCII(kGTestRepeatFlag), |
627 &cycles_)) { | 621 &cycles_)) { |
628 LOG(ERROR) << "Invalid value for " << kGTestRepeatFlag; | 622 LOG(ERROR) << "Invalid value for " << kGTestRepeatFlag; |
629 return false; | 623 return false; |
630 } | 624 } |
631 | 625 |
632 // Split --gtest_filter at '-', if there is one, to separate into | 626 // Split --gtest_filter at '-', if there is one, to separate into |
633 // positive filter and negative filter portions. | 627 // positive filter and negative filter portions. |
634 std::string filter = command_line->GetSwitchValueASCII(kGTestFilterFlag); | 628 std::string filter = command_line->GetSwitchValueASCII(kGTestFilterFlag); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 | 921 |
928 g_live_processes.Get().erase(process_handle); | 922 g_live_processes.Get().erase(process_handle); |
929 } | 923 } |
930 | 924 |
931 base::CloseProcessHandle(process_handle); | 925 base::CloseProcessHandle(process_handle); |
932 | 926 |
933 return exit_code; | 927 return exit_code; |
934 } | 928 } |
935 | 929 |
936 } // namespace base | 930 } // namespace base |
OLD | NEW |