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/unit_test_launcher.h" | 5 #include "base/test/launcher/unit_test_launcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 fprintf(stdout, | 490 fprintf(stdout, |
491 "IMPORTANT DEBUGGING NOTE: batches of tests are run inside their\n" | 491 "IMPORTANT DEBUGGING NOTE: batches of tests are run inside their\n" |
492 "own process. For debugging a test inside a debugger, use the\n" | 492 "own process. For debugging a test inside a debugger, use the\n" |
493 "--gtest_filter=<your_test_name> flag along with\n" | 493 "--gtest_filter=<your_test_name> flag along with\n" |
494 "--single-process-tests.\n"); | 494 "--single-process-tests.\n"); |
495 fflush(stdout); | 495 fflush(stdout); |
496 | 496 |
497 MessageLoopForIO message_loop; | 497 MessageLoopForIO message_loop; |
498 | 498 |
499 UnitTestLauncherDelegate delegate(batch_limit); | 499 UnitTestLauncherDelegate delegate(batch_limit); |
500 base::TestLauncher launcher(&delegate, SysInfo::NumberOfProcessors()); | 500 base::TestLauncher launcher(&delegate, default_jobs); |
501 bool success = launcher.Run(argc, argv); | 501 bool success = launcher.Run(argc, argv); |
502 | 502 |
503 fprintf(stdout, | 503 fprintf(stdout, |
504 "Tests took %" PRId64 " seconds.\n", | 504 "Tests took %" PRId64 " seconds.\n", |
505 (base::TimeTicks::Now() - start_time).InSeconds()); | 505 (base::TimeTicks::Now() - start_time).InSeconds()); |
506 fflush(stdout); | 506 fflush(stdout); |
507 | 507 |
508 return (success ? 0 : 1); | 508 return (success ? 0 : 1); |
509 } | 509 } |
510 | 510 |
511 } // namespace | 511 } // namespace |
512 | 512 |
513 int LaunchUnitTests(int argc, | 513 int LaunchUnitTests(int argc, |
514 char** argv, | 514 char** argv, |
515 const RunTestSuiteCallback& run_test_suite) { | 515 const RunTestSuiteCallback& run_test_suite) { |
516 return LaunchUnitTestsInternal( | 516 return LaunchUnitTestsInternal( |
517 argc, argv, run_test_suite, SysInfo::NumberOfProcessors()); | 517 argc, argv, run_test_suite, SysInfo::NumberOfProcessors()); |
518 } | 518 } |
519 | 519 |
520 int LaunchUnitTestsSerially(int argc, | 520 int LaunchUnitTestsSerially(int argc, |
521 char** argv, | 521 char** argv, |
522 const RunTestSuiteCallback& run_test_suite) { | 522 const RunTestSuiteCallback& run_test_suite) { |
523 return LaunchUnitTestsInternal(argc, argv, run_test_suite, 1); | 523 return LaunchUnitTestsInternal(argc, argv, run_test_suite, 1); |
524 } | 524 } |
525 | 525 |
526 } // namespace base | 526 } // namespace base |
OLD | NEW |