| Index: base/test/launcher/test_launcher.cc
|
| diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
|
| index 76fa0d40731336bffe5d0133edaebcf9acdff954..bbba0026fa988810b6a1c2e68124ad397a671c3c 100644
|
| --- a/base/test/launcher/test_launcher.cc
|
| +++ b/base/test/launcher/test_launcher.cc
|
| @@ -390,6 +390,9 @@ void DoLaunchChildTestProcess(
|
|
|
| LaunchOptions options;
|
| #if defined(OS_WIN)
|
| + options.inherit_mode = test_launch_options.inherit_mode;
|
| + options.handles_to_inherit = test_launch_options.handles_to_inherit;
|
| +
|
| win::ScopedHandle handle;
|
|
|
| if (redirect_stdio) {
|
| @@ -397,21 +400,14 @@ void DoLaunchChildTestProcess(
|
| FILE_SHARE_READ | FILE_SHARE_DELETE, nullptr,
|
| OPEN_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL));
|
| CHECK(handle.IsValid());
|
| - options.inherit_handles = true;
|
| options.stdin_handle = INVALID_HANDLE_VALUE;
|
| options.stdout_handle = handle.Get();
|
| options.stderr_handle = handle.Get();
|
| - }
|
| -
|
| - if (test_launch_options.inherit_handles) {
|
| - if (!options.inherit_handles) {
|
| - options.inherit_handles = true;
|
| - options.stdin_handle = nullptr;
|
| - options.stdout_handle = nullptr;
|
| - options.stderr_handle = nullptr;
|
| - }
|
| - DCHECK(!options.handles_to_inherit);
|
| - options.handles_to_inherit = test_launch_options.handles_to_inherit;
|
| + // See LaunchOptions.stdout_handle comments for why this compares against
|
| + // FILE_TYPE_CHAR.
|
| + if (options.inherit_mode == base::LaunchOptions::Inherit::kSpecific &&
|
| + GetFileType(handle.Get()) != FILE_TYPE_CHAR)
|
| + options.handles_to_inherit.push_back(handle.Get());
|
| }
|
|
|
| #elif defined(OS_POSIX)
|
| @@ -420,22 +416,17 @@ void DoLaunchChildTestProcess(
|
| options.kill_on_parent_death = true;
|
| #endif // defined(OS_LINUX)
|
|
|
| - FileHandleMappingVector fds_mapping;
|
| ScopedFD output_file_fd;
|
|
|
| + options.fds_to_remap = test_launch_options.fds_to_remap;
|
| if (redirect_stdio) {
|
| output_file_fd.reset(open(output_file.value().c_str(), O_RDWR));
|
| CHECK(output_file_fd.is_valid());
|
|
|
| - fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDOUT_FILENO));
|
| - fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDERR_FILENO));
|
| - options.fds_to_remap = &fds_mapping;
|
| - }
|
| - if (test_launch_options.fds_to_remap) {
|
| - fds_mapping.insert(fds_mapping.end(),
|
| - test_launch_options.fds_to_remap->begin(),
|
| - test_launch_options.fds_to_remap->end());
|
| - options.fds_to_remap = &fds_mapping;
|
| + options.fds_to_remap.push_back(
|
| + std::make_pair(output_file_fd.get(), STDOUT_FILENO));
|
| + options.fds_to_remap.push_back(
|
| + std::make_pair(output_file_fd.get(), STDERR_FILENO));
|
| }
|
| #endif
|
|
|
| @@ -482,6 +473,11 @@ const char kGTestOutputFlag[] = "gtest_output";
|
|
|
| TestLauncherDelegate::~TestLauncherDelegate() {}
|
|
|
| +TestLauncher::LaunchOptions::LaunchOptions() = default;
|
| +TestLauncher::LaunchOptions::LaunchOptions(const LaunchOptions& other) =
|
| + default;
|
| +TestLauncher::LaunchOptions::~LaunchOptions() = default;
|
| +
|
| TestLauncher::TestLauncher(TestLauncherDelegate* launcher_delegate,
|
| size_t parallel_jobs)
|
| : launcher_delegate_(launcher_delegate),
|
|
|