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

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

Issue 10781032: restarting adb server before each testing start will cause conflict for multiple emulators (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and address the issues in comments 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if new_avd_name: 142 if new_avd_name:
143 self.default_avd = False 143 self.default_avd = False
144 self.avd = self._CreateAVD(new_avd_name) 144 self.avd = self._CreateAVD(new_avd_name)
145 145
146 def _DeviceName(self): 146 def _DeviceName(self):
147 """Return our device name.""" 147 """Return our device name."""
148 port = _GetAvailablePort() 148 port = _GetAvailablePort()
149 return ('emulator-%d' % port, port) 149 return ('emulator-%d' % port, port)
150 150
151 def _CreateAVD(self, avd_name): 151 def _CreateAVD(self, avd_name):
152 """Creates an AVD with the given name.
153
154 Return avd_name if succeed.
bulach 2012/07/20 11:28:51 nit: hmm, looks like it's never checking for any r
Wei James(wistoch) 2012/07/20 12:48:25 fixed. thanks
155 """
152 avd_command = [ 156 avd_command = [
153 self.android, 157 self.android,
154 '--silent', 158 '--silent',
155 'create', 'avd', 159 'create', 'avd',
156 '--name', avd_name, 160 '--name', avd_name,
157 '--abi', self.abi, 161 '--abi', self.abi,
158 '--target', 'android-15', 162 '--target', 'android-15',
159 '-c', '64M', 163 '-c', '64M',
160 '--force', 164 '--force',
161 ] 165 ]
162 avd_process = subprocess.Popen(args=avd_command, 166 avd_process = subprocess.Popen(args=avd_command,
163 stdin=subprocess.PIPE, 167 stdin=subprocess.PIPE,
164 stdout=subprocess.PIPE, 168 stdout=subprocess.PIPE,
165 stderr=subprocess.STDOUT) 169 stderr=subprocess.STDOUT)
166 avd_process.stdin.write('no\n') 170 avd_process.stdin.write('no\n')
167 avd_process.wait() 171 avd_process.wait()
168 logging.info('Create AVD command: %s', ' '.join(avd_command)) 172 logging.info('Create AVD command: %s', ' '.join(avd_command))
169 return self.avd 173 return avd_name
170 174
171 def _DeleteAVD(self): 175 def _DeleteAVD(self):
176 """Delete the AVD of this emulator."""
172 avd_command = [ 177 avd_command = [
173 self.android, 178 self.android,
174 '--silent', 179 '--silent',
175 'delete', 180 'delete',
176 'avd', 181 'avd',
177 '--name', self.avd, 182 '--name', self.avd,
178 ] 183 ]
179 avd_process = subprocess.Popen(args=avd_command, 184 avd_process = subprocess.Popen(args=avd_command,
180 stdout=subprocess.PIPE, 185 stdout=subprocess.PIPE,
181 stderr=subprocess.STDOUT) 186 stderr=subprocess.STDOUT)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 """Install a handler to kill the emulator when we exit unexpectedly.""" 294 """Install a handler to kill the emulator when we exit unexpectedly."""
290 for sig in self._SIGNALS: 295 for sig in self._SIGNALS:
291 signal.signal(sig, self._ShutdownOnSignal) 296 signal.signal(sig, self._ShutdownOnSignal)
292 297
293 def main(argv): 298 def main(argv):
294 Emulator(None, True).Launch(True) 299 Emulator(None, True).Launch(True)
295 300
296 301
297 if __name__ == '__main__': 302 if __name__ == '__main__':
298 main(sys.argv) 303 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