| 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" | 
| 41 #include "base/threading/thread.h" | 42 #include "base/threading/thread.h" | 
| 42 #include "base/threading/thread_checker.h" | 43 #include "base/threading/thread_checker.h" | 
| 43 #include "base/threading/thread_task_runner_handle.h" | 44 #include "base/threading/thread_task_runner_handle.h" | 
| 44 #include "base/time/time.h" | 45 #include "base/time/time.h" | 
| 45 #include "build/build_config.h" | 46 #include "build/build_config.h" | 
| 46 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" | 
| 47 | 48 | 
| 48 #if defined(OS_POSIX) | 49 #if defined(OS_POSIX) | 
| 49 #include <fcntl.h> | 50 #include <fcntl.h> | 
| 50 | 51 | 
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 812     parallel_jobs_ = jobs; | 813     parallel_jobs_ = jobs; | 
| 813   } else if (command_line->HasSwitch(kGTestFilterFlag) && !BotModeEnabled()) { | 814   } else if (command_line->HasSwitch(kGTestFilterFlag) && !BotModeEnabled()) { | 
| 814     // Do not run jobs in parallel by default if we are running a subset of | 815     // Do not run jobs in parallel by default if we are running a subset of | 
| 815     // the tests and if bot mode is off. | 816     // the tests and if bot mode is off. | 
| 816     parallel_jobs_ = 1U; | 817     parallel_jobs_ = 1U; | 
| 817   } | 818   } | 
| 818 | 819 | 
| 819   fprintf(stdout, "Using %" PRIuS " parallel jobs.\n", parallel_jobs_); | 820   fprintf(stdout, "Using %" PRIuS " parallel jobs.\n", parallel_jobs_); | 
| 820   fflush(stdout); | 821   fflush(stdout); | 
| 821   if (parallel_jobs_ > 1U) { | 822   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 | 
| 822     worker_pool_owner_ = MakeUnique<SequencedWorkerPoolOwner>( | 828     worker_pool_owner_ = MakeUnique<SequencedWorkerPoolOwner>( | 
| 823         parallel_jobs_, "test_launcher"); | 829         parallel_jobs_, "test_launcher"); | 
| 824   } else { | 830   } else { | 
| 825     worker_thread_ = MakeUnique<Thread>("test_launcher"); | 831     worker_thread_ = MakeUnique<Thread>("test_launcher"); | 
| 826     worker_thread_->Start(); | 832     worker_thread_->Start(); | 
| 827   } | 833   } | 
| 828 | 834 | 
| 829   if (command_line->HasSwitch(switches::kTestLauncherFilterFile) && | 835   if (command_line->HasSwitch(switches::kTestLauncherFilterFile) && | 
| 830       command_line->HasSwitch(kGTestFilterFlag)) { | 836       command_line->HasSwitch(kGTestFilterFlag)) { | 
| 831     LOG(ERROR) << "Only one of --test-launcher-filter-file and --gtest_filter " | 837     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... | 
| 1168   } | 1174   } | 
| 1169 | 1175 | 
| 1170   std::string snippet(full_output.substr(run_pos)); | 1176   std::string snippet(full_output.substr(run_pos)); | 
| 1171   if (end_pos != std::string::npos) | 1177   if (end_pos != std::string::npos) | 
| 1172     snippet = full_output.substr(run_pos, end_pos - run_pos); | 1178     snippet = full_output.substr(run_pos, end_pos - run_pos); | 
| 1173 | 1179 | 
| 1174   return snippet; | 1180   return snippet; | 
| 1175 } | 1181 } | 
| 1176 | 1182 | 
| 1177 }  // namespace base | 1183 }  // namespace base | 
| OLD | NEW | 
|---|