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/test_launcher.h" | 5 #include "base/test/test_launcher.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 | 343 |
344 const char kHelpFlag[] = "help"; | 344 const char kHelpFlag[] = "help"; |
345 | 345 |
346 TestResult::TestResult() { | 346 TestResult::TestResult() { |
347 } | 347 } |
348 | 348 |
349 TestLauncherDelegate::~TestLauncherDelegate() { | 349 TestLauncherDelegate::~TestLauncherDelegate() { |
350 } | 350 } |
351 | 351 |
352 int LaunchChildGTestProcess(const CommandLine& command_line, | 352 int LaunchChildGTestProcess(const CommandLine& command_line, |
353 const std::string& wrapper, | |
zhaoqin
2013/06/26 19:03:28
shall we add comment somewhere to indicate why we
Paweł Hajdan Jr.
2013/06/26 19:59:49
Done.
| |
353 base::TimeDelta timeout, | 354 base::TimeDelta timeout, |
354 bool* was_timeout) { | 355 bool* was_timeout) { |
355 CommandLine new_command_line(command_line.GetProgram()); | 356 CommandLine new_command_line(command_line.GetProgram()); |
356 CommandLine::SwitchMap switches = command_line.GetSwitches(); | 357 CommandLine::SwitchMap switches = command_line.GetSwitches(); |
357 | 358 |
358 // Strip out gtest_output flag because otherwise we would overwrite results | 359 // Strip out gtest_output flag because otherwise we would overwrite results |
359 // of the other tests. | 360 // of the other tests. |
360 switches.erase(kGTestOutputFlag); | 361 switches.erase(kGTestOutputFlag); |
361 | 362 |
362 // Strip out gtest_repeat flag - this is handled by the launcher process. | 363 // Strip out gtest_repeat flag - this is handled by the launcher process. |
363 switches.erase(kGTestRepeatFlag); | 364 switches.erase(kGTestRepeatFlag); |
364 | 365 |
365 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); | 366 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); |
366 iter != switches.end(); ++iter) { | 367 iter != switches.end(); ++iter) { |
367 new_command_line.AppendSwitchNative((*iter).first, (*iter).second); | 368 new_command_line.AppendSwitchNative((*iter).first, (*iter).second); |
368 } | 369 } |
369 | 370 |
371 #if defined(OS_WIN) | |
372 new_command_line.PrependWrapper(ASCIIToWide(wrapper)); | |
zhaoqin
2013/06/26 19:03:28
src\base\test\test_launcher.cc(372) : error C3861:
Paweł Hajdan Jr.
2013/06/26 19:59:49
Done.
| |
373 #elif defined(OS_POSIX) | |
374 new_command_line.PrependWrapper(wrapper); | |
375 #endif | |
376 | |
zhaoqin
2013/06/26 19:03:28
shall we move the VLOG here too?
Paweł Hajdan Jr.
2013/06/26 19:59:49
IMHO not worth it. I'm happy to change though if a
| |
370 base::ProcessHandle process_handle; | 377 base::ProcessHandle process_handle; |
371 base::LaunchOptions options; | 378 base::LaunchOptions options; |
372 | 379 |
373 #if defined(OS_POSIX) | 380 #if defined(OS_POSIX) |
374 // On POSIX, we launch the test in a new process group with pgid equal to | 381 // On POSIX, we launch the test in a new process group with pgid equal to |
375 // its pid. Any child processes that the test may create will inherit the | 382 // its pid. Any child processes that the test may create will inherit the |
376 // same pgid. This way, if the test is abruptly terminated, we can clean up | 383 // same pgid. This way, if the test is abruptly terminated, we can clean up |
377 // any orphaned child processes it may have left behind. | 384 // any orphaned child processes it may have left behind. |
378 options.new_process_group = true; | 385 options.new_process_group = true; |
379 #endif | 386 #endif |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 | 436 |
430 // Special value "-1" means "repeat indefinitely". | 437 // Special value "-1" means "repeat indefinitely". |
431 if (cycles != -1) | 438 if (cycles != -1) |
432 cycles--; | 439 cycles--; |
433 } | 440 } |
434 | 441 |
435 return exit_code; | 442 return exit_code; |
436 } | 443 } |
437 | 444 |
438 } // namespace base | 445 } // namespace base |
OLD | NEW |