Wez | 5b7d16e | 2021-02-20 00:01:38 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/bind.h" |
| 6 | #include "base/system/sys_info.h" |
| 7 | #include "base/test/launcher/unit_test_launcher.h" |
| 8 | #include "base/test/test_suite.h" |
| 9 | #include "build/build_config.h" |
| 10 | |
| 11 | constexpr size_t kDefaultTestBatchLimit = 10; |
| 12 | |
| 13 | int main(int argc, char** argv) { |
| 14 | base::TestSuite test_suite(argc, argv); |
| 15 | |
| 16 | // Each test launches a complete set of components, so allow two CPU cores |
| 17 | // per test. |
| 18 | size_t jobs = base::SysInfo::NumberOfProcessors(); |
| 19 | if (jobs > 1) |
| 20 | jobs /= 2; |
| 21 | |
| 22 | return base::LaunchUnitTestsWithOptions( |
| 23 | argc, argv, jobs, kDefaultTestBatchLimit, true /* use_job_objects */, |
| 24 | base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 25 | } |