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

Side by Side Diff: build/android/buildbot/bb_device_status_check.py

Issue 56063002: [Android]: Only kill 'adb' during device status check, not all commands with adb in command line. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 | no next file » | 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 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 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 """A class to keep track of devices across builds and report state.""" 7 """A class to keep track of devices across builds and report state."""
8 import logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 if failed_restart: 250 if failed_restart:
251 return 1 251 return 1
252 252
253 return 0 253 return 0
254 254
255 255
256 def KillAllAdb(): 256 def KillAllAdb():
257 def GetAllAdb(): 257 def GetAllAdb():
258 for p in psutil.process_iter(): 258 for p in psutil.process_iter():
259 if 'adb' in p.name or 'adb' in ' '.join(p.cmdline): 259 if 'adb' in p.name:
260 yield p 260 yield p
261 261
262 for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]: 262 for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]:
263 for p in GetAllAdb(): 263 for p in GetAllAdb():
264 try: 264 try:
265 print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name, 265 print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name,
266 ' '.join(p.cmdline)) 266 ' '.join(p.cmdline))
267 p.send_signal(sig) 267 p.send_signal(sig)
268 except psutil.error.NoSuchProcess: 268 except psutil.error.NoSuchProcess:
269 pass 269 pass
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 # devices with critically low battery or install speed. Remove those devices 350 # devices with critically low battery or install speed. Remove those devices
351 # from testing, allowing build to continue with good devices. 351 # from testing, allowing build to continue with good devices.
352 return 1 352 return 1
353 353
354 if not devices: 354 if not devices:
355 return 1 355 return 1
356 356
357 357
358 if __name__ == '__main__': 358 if __name__ == '__main__':
359 sys.exit(main()) 359 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698