Bug 1251012 - Remove support for Android 2.3 from mach; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Mon, 04 Apr 2016 19:15:24 -0600
changeset 347712 61c5789a67aee10a69947c83342aa1d5cd24b3a0
parent 347711 85740a5fc12fb0264ab964a262fa8bf6a45d7c55
child 347713 ab1e55d01de8dfc614e7a3d127c3add27beb030c
push id14653
push userolivier@olivieryiptong.com
push dateTue, 05 Apr 2016 19:21:01 +0000
reviewersjmaher
bugs1251012
milestone48.0a1
Bug 1251012 - Remove support for Android 2.3 from mach; r=jmaher
mobile/android/mach_commands.py
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -98,18 +98,18 @@ class AndroidEmulatorCommands(MachComman
     """
        Run the Android emulator with one of the AVDs used in the Mozilla
        automated test environment. If necessary, the AVD is fetched from
        the tooltool server and installed.
     """
     @Command('android-emulator', category='devenv',
         conditions=[],
         description='Run the Android emulator with an AVD from test automation.')
-    @CommandArgument('--version', metavar='VERSION', choices=['2.3', '4.3', 'x86'],
-        help='Specify Android version to run in emulator. One of "2.3", "4.3", or "x86".',
+    @CommandArgument('--version', metavar='VERSION', choices=['4.3', 'x86'],
+        help='Specify Android version to run in emulator. One of "4.3", or "x86".',
         default='4.3')
     @CommandArgument('--wait', action='store_true',
         help='Wait for emulator to be closed.')
     @CommandArgument('--force-update', action='store_true',
         help='Update AVD definition even when AVD is already installed.')
     @CommandArgument('--verbose', action='store_true',
         help='Log informative status messages.')
     def emulator(self, version, wait=False, force_update=False, verbose=False):
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ -30,60 +30,44 @@ MANIFEST_PATH = 'testing/config/tooltool
 
 verbose_logging = False
 
 class AvdInfo(object):
     """
        Simple class to contain an AVD description.
     """
     def __init__(self, description, name, tooltool_manifest, extra_args,
-                 port, uses_sut, sut_port, sut_port2):
+                 port):
         self.description = description
         self.name = name
         self.tooltool_manifest = tooltool_manifest
         self.extra_args = extra_args
         self.port = port
-        self.uses_sut = uses_sut
-        self.sut_port = sut_port
-        self.sut_port2 = sut_port2
 
 
 """
    A dictionary to map an AVD type to a description of that type of AVD.
 
    There is one entry for each type of AVD used in Mozilla automated tests
    and the parameters for each reflect those used in mozharness.
 """
 AVD_DICT = {
-    '2.3': AvdInfo('Android 2.3',
-                   'mozemulator-2.3',
-                   'testing/config/tooltool-manifests/androidarm/releng.manifest',
-                   ['-debug',
-                    'init,console,gles,memcheck,adbserver,adbclient,adb,avd_config,socket',
-                    '-qemu', '-m', '1024', '-cpu', 'cortex-a9'],
-                   5554,
-                   True,
-                   20701, 20700),
     '4.3': AvdInfo('Android 4.3',
                    'mozemulator-4.3',
                    'testing/config/tooltool-manifests/androidarm_4_3/releng.manifest',
                    ['-show-kernel', '-debug',
                     'init,console,gles,memcheck,adbserver,adbclient,adb,avd_config,socket'],
-                   5554,
-                   False,
-                   0, 0),
+                   5554),
     'x86': AvdInfo('Android 4.2 x86',
                    'mozemulator-x86',
                    'testing/config/tooltool-manifests/androidx86/releng.manifest',
                    ['-debug',
                     'init,console,gles,memcheck,adbserver,adbclient,adb,avd_config,socket',
                     '-qemu', '-m', '1024', '-enable-kvm'],
-                   5554,
-                   False,
-                   0, 0)
+                   5554)
 }
 
 def verify_android_device(build_obj, install=False, xre=False, debugger=False):
     """
        Determine if any Android device is connected via adb.
        If no device is found, prompt to start an emulator.
        If a device is found or an emulator started and 'install' is
        specified, also check whether Firefox is installed on the
@@ -441,19 +425,16 @@ class AndroidEmulator(object):
                 time.sleep(10)
                 if self.proc.proc.poll() is not None:
                     _log_warning("Emulator has already completed!")
                     return False
         _log_debug("Android boot status verified.")
 
         if not self._verify_emulator():
             return False
-        if self.avd_info.uses_sut:
-            if not self._verify_sut():
-                return False
         return True
 
     def wait(self):
         """
            Wait for the emulator to close. If interrupted, close the emulator.
         """
         try:
             self.proc.wait()
@@ -509,25 +490,16 @@ class AndroidEmulator(object):
         telnet_ok = False
         tn = None
         while(not telnet_ok):
             try:
                 tn = telnetlib.Telnet('localhost', self.avd_info.port, 10)
                 if tn is not None:
                     res = tn.read_until('OK', 10)
                     self._telnet_cmd(tn, 'avd status')
-                    if self.avd_info.uses_sut:
-                        cmd = 'redir add tcp:%s:%s' % \
-                           (str(self.avd_info.sut_port),
-                            str(self.avd_info.sut_port))
-                        self._telnet_cmd(tn, cmd)
-                        cmd = 'redir add tcp:%s:%s' % \
-                            (str(self.avd_info.sut_port2),
-                             str(self.avd_info.sut_port2))
-                        self._telnet_cmd(tn, cmd)
                     self._telnet_cmd(tn, 'redir list')
                     self._telnet_cmd(tn, 'network status')
                     tn.write('quit\n')
                     tn.read_all()
                     telnet_ok = True
                 else:
                     _log_warning("Unable to connect to port %d" % port)
             except:
@@ -537,44 +509,16 @@ class AndroidEmulator(object):
                     tn.close()
             if not telnet_ok:
                 time.sleep(10)
                 if self.proc.proc.poll() is not None:
                     _log_warning("Emulator has already completed!")
                     return False
         return telnet_ok
 
-    def _verify_sut(self):
-        sut_ok = False
-        while(not sut_ok):
-            try:
-                tn = telnetlib.Telnet('localhost', self.avd_info.sut_port, 10)
-                if tn is not None:
-                    _log_debug(
-                        "Connected to port %d" % self.avd_info.sut_port)
-                    res = tn.read_until('$>', 10)
-                    if res.find('$>') == -1:
-                        _log_debug("Unexpected SUT response: %s" % res)
-                    else:
-                        _log_debug("SUT response: %s" % res)
-                        sut_ok = True
-                    tn.write('quit\n')
-                    tn.read_all()
-            except:
-                _log_debug("Caught exception while verifying sutagent")
-            finally:
-                if tn is not None:
-                    tn.close()
-            if not sut_ok:
-                time.sleep(10)
-                if self.proc.proc.poll() is not None:
-                    _log_warning("Emulator has already completed!")
-                    return False
-        return sut_ok
-
     def _get_avd_type(self, requested):
         if requested in AVD_DICT.keys():
             return requested
         if self.substs:
             if not self.substs['TARGET_CPU'].startswith('arm'):
                 return 'x86'
         return '4.3'