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/test_launcher.h" | 5 #include "base/test/launcher/test_launcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
32 #include "base/strings/stringize_macros.h" | 32 #include "base/strings/stringize_macros.h" |
33 #include "base/strings/stringprintf.h" | 33 #include "base/strings/stringprintf.h" |
34 #include "base/strings/utf_string_conversions.h" | 34 #include "base/strings/utf_string_conversions.h" |
35 #include "base/test/gtest_util.h" | 35 #include "base/test/gtest_util.h" |
36 #include "base/test/launcher/test_launcher_tracer.h" | 36 #include "base/test/launcher/test_launcher_tracer.h" |
37 #include "base/test/launcher/test_results_tracker.h" | 37 #include "base/test/launcher/test_results_tracker.h" |
38 #include "base/test/sequenced_worker_pool_owner.h" | 38 #include "base/test/sequenced_worker_pool_owner.h" |
39 #include "base/test/test_switches.h" | 39 #include "base/test/test_switches.h" |
40 #include "base/test/test_timeouts.h" | 40 #include "base/test/test_timeouts.h" |
41 #include "base/threading/sequenced_worker_pool.h" | |
42 #include "base/threading/thread.h" | 41 #include "base/threading/thread.h" |
43 #include "base/threading/thread_checker.h" | 42 #include "base/threading/thread_checker.h" |
44 #include "base/threading/thread_task_runner_handle.h" | 43 #include "base/threading/thread_task_runner_handle.h" |
45 #include "base/time/time.h" | 44 #include "base/time/time.h" |
46 #include "build/build_config.h" | 45 #include "build/build_config.h" |
47 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
48 | 47 |
49 #if defined(OS_POSIX) | 48 #if defined(OS_POSIX) |
50 #include <fcntl.h> | 49 #include <fcntl.h> |
51 | 50 |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 parallel_jobs_ = jobs; | 812 parallel_jobs_ = jobs; |
814 } else if (command_line->HasSwitch(kGTestFilterFlag) && !BotModeEnabled()) { | 813 } else if (command_line->HasSwitch(kGTestFilterFlag) && !BotModeEnabled()) { |
815 // Do not run jobs in parallel by default if we are running a subset of | 814 // Do not run jobs in parallel by default if we are running a subset of |
816 // the tests and if bot mode is off. | 815 // the tests and if bot mode is off. |
817 parallel_jobs_ = 1U; | 816 parallel_jobs_ = 1U; |
818 } | 817 } |
819 | 818 |
820 fprintf(stdout, "Using %" PRIuS " parallel jobs.\n", parallel_jobs_); | 819 fprintf(stdout, "Using %" PRIuS " parallel jobs.\n", parallel_jobs_); |
821 fflush(stdout); | 820 fflush(stdout); |
822 if (parallel_jobs_ > 1U) { | 821 if (parallel_jobs_ > 1U) { |
823 // Allow usage of SequencedWorkerPool to launch test processes. | |
824 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler | |
825 // redirection experiment concludes https://crbug.com/622400. | |
826 SequencedWorkerPool::EnableForProcess(); | |
827 | |
828 worker_pool_owner_ = MakeUnique<SequencedWorkerPoolOwner>( | 822 worker_pool_owner_ = MakeUnique<SequencedWorkerPoolOwner>( |
829 parallel_jobs_, "test_launcher"); | 823 parallel_jobs_, "test_launcher"); |
830 } else { | 824 } else { |
831 worker_thread_ = MakeUnique<Thread>("test_launcher"); | 825 worker_thread_ = MakeUnique<Thread>("test_launcher"); |
832 worker_thread_->Start(); | 826 worker_thread_->Start(); |
833 } | 827 } |
834 | 828 |
835 if (command_line->HasSwitch(switches::kTestLauncherFilterFile) && | 829 if (command_line->HasSwitch(switches::kTestLauncherFilterFile) && |
836 command_line->HasSwitch(kGTestFilterFlag)) { | 830 command_line->HasSwitch(kGTestFilterFlag)) { |
837 LOG(ERROR) << "Only one of --test-launcher-filter-file and --gtest_filter " | 831 LOG(ERROR) << "Only one of --test-launcher-filter-file and --gtest_filter " |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 } | 1168 } |
1175 | 1169 |
1176 std::string snippet(full_output.substr(run_pos)); | 1170 std::string snippet(full_output.substr(run_pos)); |
1177 if (end_pos != std::string::npos) | 1171 if (end_pos != std::string::npos) |
1178 snippet = full_output.substr(run_pos, end_pos - run_pos); | 1172 snippet = full_output.substr(run_pos, end_pos - run_pos); |
1179 | 1173 |
1180 return snippet; | 1174 return snippet; |
1181 } | 1175 } |
1182 | 1176 |
1183 } // namespace base | 1177 } // namespace base |
OLD | NEW |