Bug 1285678 - Remove auth file before launching emulator; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Mon, 27 Nov 2017 11:26:10 -0700
changeset 703825 191a00ee6f9b8fee0ac3ac7ae74adac85169d56a
parent 703824 b85ab2a768181d3d03ff3eb453c3c707656750e4
child 703826 cec895f7cedad28bea953572480acefd7bec4d08
push id90984
push userbmo:gl@mozilla.com
push dateMon, 27 Nov 2017 20:54:52 +0000
reviewersjmaher
bugs1285678
milestone59.0a1
Bug 1285678 - Remove auth file before launching emulator; r=jmaher Newer versions of the Android emulator check an 'auth' file on startup; deleting the file avoids a user prompt to authorize use of the emulator.
testing/mozharness/scripts/android_emulator_unittest.py
--- a/testing/mozharness/scripts/android_emulator_unittest.py
+++ b/testing/mozharness/scripts/android_emulator_unittest.py
@@ -195,16 +195,25 @@ class AndroidEmulatorTest(BlobUploadMixi
         # constructed in start_emulator.
         env['LD_LIBRARY_PATH'] = self.abs_dirs['abs_work_dir']
 
         # Write a default ddms.cfg to avoid unwanted prompts
         avd_home_dir = self.abs_dirs['abs_avds_dir']
         with open(os.path.join(avd_home_dir, "ddms.cfg"), 'w') as f:
             f.write("pingOptIn=false\npingId=0\n")
 
+        # Delete emulator auth file, so it doesn't prompt
+        AUTH_FILE = os.path.join(os.path.expanduser('~'), '.emulator_console_auth_token')
+        if os.path.exists(AUTH_FILE):
+            try:
+                os.remove(AUTH_FILE)
+                self.info("deleted %s" % AUTH_FILE)
+            except:
+                self.warning("failed to remove %s" % AUTH_FILE)
+
         # Set environment variables to help emulator find the AVD.
         # In newer versions of the emulator, ANDROID_AVD_HOME should
         # point to the 'avd' directory.
         # For older versions of the emulator, ANDROID_SDK_HOME should
         # point to the directory containing the '.android' directory
         # containing the 'avd' directory.
         env['ANDROID_AVD_HOME'] = os.path.join(avd_home_dir, 'avd')
         env['ANDROID_SDK_HOME'] = os.path.abspath(os.path.join(avd_home_dir, '..'))