Bug 1201195 - [mozrunner] Fix IndexError on B2G when running without a build (or bindir), r=armenzg
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 02 Sep 2015 14:58:35 -0400
changeset 260629 1dbf8850f7ed7a3181a09ec1adeda7c4716ccb6c
parent 260628 3104feff953c3474df3cf63657f0ae74d2855e0d
child 260630 5f0d28eff4786909d957b08345d6ad5e0f8d18c2
push id17297
push usercbook@mozilla.com
push dateThu, 03 Sep 2015 12:21:04 +0000
treeherderb2g-inbound@70f7c00f7fe6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Bug 1201195 - [mozrunner] Fix IndexError on B2G when running without a build (or bindir), r=armenzg There is an assumption in application.py that there exists a build with a valid bindir. This directory doesn't exist if no build exist. Before now, this code path hasn't been a problem as it was only used with built emulators. But now gaia is starting to use it and there might not even be a B2G repo at all!
--- a/testing/mozbase/mozrunner/mozrunner/application.py
+++ b/testing/mozbase/mozrunner/mozrunner/application.py
@@ -67,17 +67,17 @@ class B2GContext(object):
     def fastboot(self):
         if self._fastboot is None:
             self._fastboot = self.which('fastboot')
         return self._fastboot
     def update_tools(self):
-        if self._update_tools is None:
+        if self._update_tools is None and self.homedir is not None:
             self._update_tools = os.path.join(self.homedir, 'tools', 'update-tools')
         return self._update_tools
     def adb(self):
         if not self._adb:
             paths = [os.environ.get('ADB'),
@@ -89,17 +89,19 @@ class B2GContext(object):
             self._adb = paths[0]
         return self._adb
     def bindir(self):
         if self._bindir is None and self.homedir is not None:
             # TODO get this via build configuration
             path = os.path.join(self.homedir, 'out', 'host', '*', 'bin')
-            self._bindir = glob.glob(path)[0]
+            paths = glob.glob(path)
+            if paths:
+                self._bindir = paths[0]
         return self._bindir
     def dm(self):
         if not self._dm:
             self._dm = DeviceManagerADB(adbPath=self.adb, autoconnect=False, deviceRoot=self.remote_test_root)
         return self._dm