Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: base/test/launcher/test_launcher.cc

Issue 2517443002: Revert of Disallow posting tasks to SequencedWorkerPools by default. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/test/test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698