Bug 1236451 - Make some android mach commands more robust; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Wed, 06 Jan 2016 06:37:41 -0700
changeset 278826 0fc4b8fc291124a665df02112c3a12e9721f274b
parent 278825 dbd04edcb86a991829df7f6c5b8e7a534e4f8bd0
child 278827 36c1e4eb0c9141aae4071a917ce4e3a59f5a79c6
push id29860
push usercbook@mozilla.com
push dateThu, 07 Jan 2016 10:51:20 +0000
treeherdermozilla-central@e0bcd16e1d4b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1236451
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1236451 - Make some android mach commands more robust; r=jmaher
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ -157,17 +157,16 @@ def verify_android_device(build_obj, ins
                     err = None
                     break
         if err:
             _log_info("Host utilities not found: %s" % err)
             response = raw_input(
                 "Download and setup your host utilities? (Y/n) ").strip()
             if response.lower().startswith('y') or response == '':
                 _log_info("Installing host utilities. This may take a while...")
-                _download_file(TOOLTOOL_URL, 'tooltool.py', EMULATOR_HOME_DIR)
                 host_platform = _get_host_platform()
                 if host_platform:
                     path = os.path.join(MANIFEST_PATH, host_platform, 'hostutils.manifest')
                     _get_tooltool_manifest(build_obj.substs, path, EMULATOR_HOME_DIR, 'releng.manifest')
                     _tooltool_fetch()
                     xre_path = glob.glob(os.path.join(EMULATOR_HOME_DIR, 'host-utils*'))
                     for path in xre_path:
                         if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'xpcshell')):
@@ -349,17 +348,16 @@ class AndroidEmulator(object):
            required archive (unless already present in the local tooltool
            cache) and install the AVD.
         """
         avd = os.path.join(
             EMULATOR_HOME_DIR, 'avd', self.avd_info.name + '.avd')
         if force and os.path.exists(avd):
             shutil.rmtree(avd)
         if not os.path.exists(avd):
-            _download_file(TOOLTOOL_URL, 'tooltool.py', EMULATOR_HOME_DIR)
             url = '%s/%s' % (TRY_URL, self.avd_info.tooltool_manifest)
             _download_file(url, 'releng.manifest', EMULATOR_HOME_DIR)
             _tooltool_fetch()
             self._update_avd_paths()
 
     def start(self):
         """
            Launch the emulator.
@@ -647,31 +645,37 @@ def _download_file(url, filename, path):
             return False
     local_file = open(os.path.join(path, filename), 'wb')
     local_file.write(f.read())
     local_file.close()
     _log_debug("Downloaded %s to %s/%s" % (url, path, filename))
     return True
 
 def _get_tooltool_manifest(substs, src_path, dst_path, filename):
+    if not os.path.isdir(dst_path):
+        try:
+            os.makedirs(dst_path)
+        except Exception, e:
+            _log_warning(str(e))
     copied = False
     if substs and 'top_srcdir' in substs:
         src = os.path.join(substs['top_srcdir'], src_path)
         if os.path.exists(src):
             dst = os.path.join(dst_path, filename)
             shutil.copy(src, dst)
             copied = True
             _log_debug("Copied tooltool manifest %s to %s" % (src, dst))
     if not copied:
         url = os.path.join(TRY_URL, src_path)
         _download_file(url, filename, dst_path)
 
 def _tooltool_fetch():
     def outputHandler(line):
         _log_debug(line)
+    _download_file(TOOLTOOL_URL, 'tooltool.py', EMULATOR_HOME_DIR)
     command = ['python', 'tooltool.py', 'fetch', '-o', '-m', 'releng.manifest']
     proc = ProcessHandler(
         command, processOutputLine=outputHandler, storeOutput=False,
         cwd=EMULATOR_HOME_DIR)
     proc.run()
     try:
         proc.wait()
     except: