Bug 736112 - add try/except blocks around all harnesses devicemanager initialization so we always return an error code. r=wlach

This commit is contained in:
Joel Maher 2012-03-22 10:45:30 -04:00
parent bd5f2d8dcf
commit 883f765d75

View File

@ -390,13 +390,18 @@ def main():
print "Error: you must provide a device IP to connect to via the --device option" print "Error: you must provide a device IP to connect to via the --device option"
sys.exit(1) sys.exit(1)
if (options.dm_trans == "adb"): try:
if (options.deviceIP): if (options.dm_trans == "adb"):
dm = devicemanagerADB.DeviceManagerADB(options.deviceIP, options.devicePort) if (options.deviceIP):
dm = devicemanagerADB.DeviceManagerADB(options.deviceIP, options.devicePort)
else:
dm = devicemanagerADB.DeviceManagerADB(None, None)
else: else:
dm = devicemanagerADB.DeviceManagerADB(None, None) dm = devicemanagerSUT.DeviceManagerSUT(options.deviceIP, options.devicePort)
else: except devicemanager.DMError:
dm = devicemanagerSUT.DeviceManagerSUT(options.deviceIP, options.devicePort) print "Error: exception while initializing devicemanager. Most likely the device is not in a testable state."
sys.exit(1)
automation.setDeviceManager(dm) automation.setDeviceManager(dm)
if (options.remoteProductName != None): if (options.remoteProductName != None):