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

Side by Side Diff: common/battor/battor/battor_wrapper.py

Issue 2869913002: Add logging to debug battor not running (Closed)
Patch Set: Created 3 years, 7 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
« 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 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import atexit 5 import atexit
6 import datetime 6 import datetime
7 import os 7 import os
8 import logging 8 import logging
9 import platform 9 import platform
10 import random 10 import random
(...skipping 19 matching lines...) Expand all
30 def IsBattOrConnected(test_platform, android_device=None, 30 def IsBattOrConnected(test_platform, android_device=None,
31 android_device_map=None, android_device_file=None): 31 android_device_map=None, android_device_file=None):
32 """Returns True if BattOr is detected.""" 32 """Returns True if BattOr is detected."""
33 if test_platform == 'android': 33 if test_platform == 'android':
34 if not android_device: 34 if not android_device:
35 raise ValueError('Must pass android device serial when determining ' 35 raise ValueError('Must pass android device serial when determining '
36 'support on android platform') 36 'support on android platform')
37 37
38 if not android_device_map: 38 if not android_device_map:
39 device_tree = find_usb_devices.GetBusNumberToDeviceTreeMap() 39 device_tree = find_usb_devices.GetBusNumberToDeviceTreeMap()
40 logging.warning('Device tree:', device_tree)
40 if len(battor_device_mapping.GetBattOrList(device_tree)) == 1: 41 if len(battor_device_mapping.GetBattOrList(device_tree)) == 1:
41 return True 42 return True
42 if android_device_file: 43 if android_device_file:
43 android_device_map = battor_device_mapping.ReadSerialMapFile( 44 android_device_map = battor_device_mapping.ReadSerialMapFile(
44 android_device_file) 45 android_device_file)
45 else: 46 else:
46 try: 47 try:
47 android_device_map = battor_device_mapping.GenerateSerialMap() 48 android_device_map = battor_device_mapping.GenerateSerialMap()
49 logging.warning('Android device map:', android_device_map)
48 except battor_error.BattOrError: 50 except battor_error.BattOrError:
51 logging.exception('Error generating serial map')
49 return False 52 return False
50 53
51 # If neither if statement above is triggered, it means that an 54 # If neither if statement above is triggered, it means that an
52 # android_device_map was passed in and will be used. 55 # android_device_map was passed in and will be used.
53 return str(android_device) in android_device_map 56 return str(android_device) in android_device_map
54 57
55 elif test_platform == 'win': 58 elif test_platform == 'win':
56 for (_1, desc, _2) in serial.tools.list_ports.comports(): 59 for (_1, desc, _2) in serial.tools.list_ports.comports():
57 if 'USB Serial Port' in desc: 60 if 'USB Serial Port' in desc:
58 return True 61 return True
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 except subprocess.CalledProcessError as e: 405 except subprocess.CalledProcessError as e:
403 raise BattOrFlashError('BattOr flash failed with return code %s.' 406 raise BattOrFlashError('BattOr flash failed with return code %s.'
404 % e.returncode) 407 % e.returncode)
405 408
406 self._git_hash = None 409 self._git_hash = None
407 return True 410 return True
408 411
409 412
410 class BattOrFlashError(Exception): 413 class BattOrFlashError(Exception):
411 pass 414 pass
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