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

Side by Side Diff: base/test/parallel_test_launcher.cc

Issue 24892002: GTTF: Fix handling of PRE_ tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « base/test/parallel_test_launcher.h ('k') | base/test/test_launcher.h » ('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/parallel_test_launcher.h" 5 #include "base/test/parallel_test_launcher.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 worker_pool_owner_->pool()->Shutdown(); 147 worker_pool_owner_->pool()->Shutdown();
148 } 148 }
149 149
150 void ParallelTestLauncher::LaunchChildGTestProcess( 150 void ParallelTestLauncher::LaunchChildGTestProcess(
151 const CommandLine& command_line, 151 const CommandLine& command_line,
152 const std::string& wrapper, 152 const std::string& wrapper,
153 base::TimeDelta timeout, 153 base::TimeDelta timeout,
154 const LaunchChildGTestProcessCallback& callback) { 154 const LaunchChildGTestProcessCallback& callback) {
155 DCHECK(thread_checker_.CalledOnValidThread()); 155 DCHECK(thread_checker_.CalledOnValidThread());
156 156
157 LaunchSequencedChildGTestProcess(
158 worker_pool_owner_->pool()->GetSequenceToken(),
159 command_line,
160 wrapper,
161 timeout,
162 callback);
163 }
164
165 void ParallelTestLauncher::LaunchNamedSequencedChildGTestProcess(
166 const std::string& token_name,
167 const CommandLine& command_line,
168 const std::string& wrapper,
169 base::TimeDelta timeout,
170 const LaunchChildGTestProcessCallback& callback) {
171 DCHECK(thread_checker_.CalledOnValidThread());
172
173 LaunchSequencedChildGTestProcess(
174 worker_pool_owner_->pool()->GetNamedSequenceToken(token_name),
175 command_line,
176 wrapper,
177 timeout,
178 callback);
179 }
180
181 void ParallelTestLauncher::ResetOutputWatchdog() {
182 DCHECK(thread_checker_.CalledOnValidThread());
183 timer_.Reset();
184 }
185
186 void ParallelTestLauncher::LaunchSequencedChildGTestProcess(
187 SequencedWorkerPool::SequenceToken sequence_token,
188 const CommandLine& command_line,
189 const std::string& wrapper,
190 base::TimeDelta timeout,
191 const LaunchChildGTestProcessCallback& callback) {
192 DCHECK(thread_checker_.CalledOnValidThread());
193
194 // Record the exact command line used to launch the child. 157 // Record the exact command line used to launch the child.
195 CommandLine new_command_line( 158 CommandLine new_command_line(
196 PrepareCommandLineForGTest(command_line, wrapper)); 159 PrepareCommandLineForGTest(command_line, wrapper));
197 launch_sequence_number_++; 160 launch_sequence_number_++;
198 running_processes_map_.insert( 161 running_processes_map_.insert(
199 std::make_pair(launch_sequence_number_, new_command_line)); 162 std::make_pair(launch_sequence_number_, new_command_line));
200 163
201 worker_pool_owner_->pool()->PostSequencedWorkerTask( 164 worker_pool_owner_->pool()->PostWorkerTask(
202 sequence_token,
203 FROM_HERE, 165 FROM_HERE,
204 Bind(&DoLaunchChildTestProcess, 166 Bind(&DoLaunchChildTestProcess,
205 new_command_line, 167 new_command_line,
206 timeout, 168 timeout,
207 MessageLoopProxy::current(), 169 MessageLoopProxy::current(),
208 Bind(&ParallelTestLauncher::OnLaunchTestProcessFinished, 170 Bind(&ParallelTestLauncher::OnLaunchTestProcessFinished,
209 Unretained(this), 171 Unretained(this),
210 launch_sequence_number_, 172 launch_sequence_number_,
211 callback))); 173 callback)));
212 } 174 }
213 175
176 void ParallelTestLauncher::ResetOutputWatchdog() {
177 DCHECK(thread_checker_.CalledOnValidThread());
178 timer_.Reset();
179 }
180
214 void ParallelTestLauncher::OnLaunchTestProcessFinished( 181 void ParallelTestLauncher::OnLaunchTestProcessFinished(
215 size_t sequence_number, 182 size_t sequence_number,
216 const LaunchChildGTestProcessCallback& callback, 183 const LaunchChildGTestProcessCallback& callback,
217 int exit_code, 184 int exit_code,
218 const TimeDelta& elapsed_time, 185 const TimeDelta& elapsed_time,
219 bool was_timeout, 186 bool was_timeout,
220 const std::string& output) { 187 const std::string& output) {
221 DCHECK(thread_checker_.CalledOnValidThread()); 188 DCHECK(thread_checker_.CalledOnValidThread());
222 running_processes_map_.erase(sequence_number); 189 running_processes_map_.erase(sequence_number);
223 callback.Run(exit_code, elapsed_time, was_timeout, output); 190 callback.Run(exit_code, elapsed_time, was_timeout, output);
(...skipping 14 matching lines...) Expand all
238 #endif 205 #endif
239 } 206 }
240 207
241 fflush(stdout); 208 fflush(stdout);
242 209
243 // Arm the timer again - otherwise it would fire only once. 210 // Arm the timer again - otherwise it would fire only once.
244 timer_.Reset(); 211 timer_.Reset();
245 } 212 }
246 213
247 } // namespace base 214 } // namespace base
OLDNEW
« no previous file with comments | « base/test/parallel_test_launcher.h ('k') | base/test/test_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698