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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 #if defined(OS_POSIX) | 394 #if defined(OS_POSIX) |
395 if (exit_code != 0) { | 395 if (exit_code != 0) { |
396 // On POSIX, in case the test does not exit cleanly, either due to a crash | 396 // On POSIX, in case the test does not exit cleanly, either due to a crash |
397 // or due to it timing out, we need to clean up any child processes that | 397 // or due to it timing out, we need to clean up any child processes that |
398 // it might have created. On Windows, child processes are automatically | 398 // it might have created. On Windows, child processes are automatically |
399 // cleaned up using JobObjects. | 399 // cleaned up using JobObjects. |
400 base::KillProcessGroup(process_handle); | 400 base::KillProcessGroup(process_handle); |
401 } | 401 } |
402 #endif | 402 #endif |
403 | 403 |
404 base::CloseProcessHandle(process_handle); | |
405 | |
406 return exit_code; | 404 return exit_code; |
407 } | 405 } |
408 | 406 |
409 bool RunTests(bool should_shard, int total_shards, int shard_index) { | 407 bool RunTests(bool should_shard, int total_shards, int shard_index) { |
410 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 408 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
411 | 409 |
412 DCHECK(!command_line->HasSwitch(kGTestListTestsFlag)); | 410 DCHECK(!command_line->HasSwitch(kGTestListTestsFlag)); |
413 | 411 |
414 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); | 412 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); |
415 | 413 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 exit_code = 1; | 626 exit_code = 1; |
629 break; | 627 break; |
630 } | 628 } |
631 | 629 |
632 // Special value "-1" means "repeat indefinitely". | 630 // Special value "-1" means "repeat indefinitely". |
633 if (cycles != -1) | 631 if (cycles != -1) |
634 cycles--; | 632 cycles--; |
635 } | 633 } |
636 return exit_code; | 634 return exit_code; |
637 } | 635 } |
OLD | NEW |