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

Side by Side Diff: build/android/emulator.py

Issue 10692132: fix test broken issue when using --use-emulator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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 | « no previous file | build/android/pylib/single_test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provides an interface to start and stop Android emulator. 7 """Provides an interface to start and stop Android emulator.
8 8
9 Assumes system environment ANDROID_NDK_ROOT has been set. 9 Assumes system environment ANDROID_NDK_ROOT has been set.
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 run_command.RunCommand(adb_cmd) 214 run_command.RunCommand(adb_cmd)
215 self.popen.poll() 215 self.popen.poll()
216 if self.popen.returncode != None: 216 if self.popen.returncode != None:
217 raise EmulatorLaunchException('EMULATOR DIED') 217 raise EmulatorLaunchException('EMULATOR DIED')
218 if seconds_waited >= self._LAUNCH_TIMEOUT: 218 if seconds_waited >= self._LAUNCH_TIMEOUT:
219 raise EmulatorLaunchException('TIMEOUT with wait-for-device') 219 raise EmulatorLaunchException('TIMEOUT with wait-for-device')
220 logging.info('Seconds waited on wait-for-device: %d', seconds_waited) 220 logging.info('Seconds waited on wait-for-device: %d', seconds_waited)
221 if wait_for_boot: 221 if wait_for_boot:
222 # Now that we checked for obvious problems, wait for a boot complete. 222 # Now that we checked for obvious problems, wait for a boot complete.
223 # Waiting for the package manager is sometimes problematic. 223 # Waiting for the package manager is sometimes problematic.
224 # TODO(jrg): for reasons I don't understand, sometimes this
225 # gives an "error: device not found" which is only fixed with an
226 # 'adb kill-server' command. Fix.
227 a.Adb().SetTargetSerial(self.device) 224 a.Adb().SetTargetSerial(self.device)
228 a.Adb().WaitForBootComplete(self._WAITFORBOOT_TIMEOUT) 225 a.Adb().WaitForSystemBootCompleted(self._WAITFORBOOT_TIMEOUT)
229 226
230 def Shutdown(self): 227 def Shutdown(self):
231 """Shuts down the process started by launch.""" 228 """Shuts down the process started by launch."""
232 if self.popen: 229 if self.popen:
233 self.popen.poll() 230 self.popen.poll()
234 if self.popen.returncode == None: 231 if self.popen.returncode == None:
235 self.popen.kill() 232 self.popen.kill()
236 self.popen = None 233 self.popen = None
237 234
238 def _ShutdownOnSignal(self, signum, frame): 235 def _ShutdownOnSignal(self, signum, frame):
239 logging.critical('emulator _ShutdownOnSignal') 236 logging.critical('emulator _ShutdownOnSignal')
240 for sig in self._SIGNALS: 237 for sig in self._SIGNALS:
241 signal.signal(sig, signal.SIG_DFL) 238 signal.signal(sig, signal.SIG_DFL)
242 self.Shutdown() 239 self.Shutdown()
243 raise KeyboardInterrupt # print a stack 240 raise KeyboardInterrupt # print a stack
244 241
245 def _InstallKillHandler(self): 242 def _InstallKillHandler(self):
246 """Install a handler to kill the emulator when we exit unexpectedly.""" 243 """Install a handler to kill the emulator when we exit unexpectedly."""
247 for sig in self._SIGNALS: 244 for sig in self._SIGNALS:
248 signal.signal(sig, self._ShutdownOnSignal) 245 signal.signal(sig, self._ShutdownOnSignal)
249 246
250 def main(argv): 247 def main(argv):
251 Emulator(True).Launch(True) 248 Emulator(True).Launch(True)
252 249
253 250
254 if __name__ == '__main__': 251 if __name__ == '__main__':
255 main(sys.argv) 252 main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/single_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698