From 1bf9cf462c7c33214426012160d01e91f9e0af7b Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Mon, 19 Jun 2017 15:32:43 -0600 Subject: [PATCH] Bug 1371805 - Eliminate android emulator telnet verification; r=jmaher --- .../scripts/android_emulator_unittest.py | 44 +------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/testing/mozharness/scripts/android_emulator_unittest.py b/testing/mozharness/scripts/android_emulator_unittest.py index ba783d78c4d0..9c7a8315a44a 100644 --- a/testing/mozharness/scripts/android_emulator_unittest.py +++ b/testing/mozharness/scripts/android_emulator_unittest.py @@ -14,7 +14,6 @@ import sys import signal import socket import subprocess -import telnetlib import time import tempfile @@ -262,12 +261,6 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin self.info('stderr: %s' % str(err.strip())) return out - def _telnet_cmd(self, telnet, command): - telnet.write('%s\n' % command) - result = telnet.read_until('OK', 10) - self.info('%s: %s' % (command, result)) - return result - def _verify_adb(self): self.info('Verifying adb connectivity') self._run_with_timeout(180, [self.adb_path, 'wait-for-device']) @@ -287,37 +280,6 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin return True return False - def _telnet_to_emulator(self): - port = self.emulator["emulator_port"] - telnet_ok = False - try: - tn = telnetlib.Telnet('localhost', port, 10) - if tn is not None: - self.info('Connected to port %d' % port) - res = tn.read_until('OK', 10) - self.info(res) - self._telnet_cmd(tn, 'avd status') - self._telnet_cmd(tn, 'redir list') - self._telnet_cmd(tn, 'network status') - tn.write('quit\n') - tn.read_all() - telnet_ok = True - else: - self.warning('Unable to connect to port %d' % port) - except socket.error, e: - self.info('Trying again after socket error: %s' % str(e)) - pass - except EOFError: - self.info('Trying again after EOF') - pass - except: - self.info('Trying again after unexpected exception') - pass - finally: - if tn is not None: - tn.close() - return telnet_ok - def _verify_emulator(self): adb_ok = self._verify_adb() if not adb_ok: @@ -331,10 +293,6 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin if not boot_ok: self.warning('Unable to verify Android boot completion') return False - telnet_ok = self._retry(4, 30, self._telnet_to_emulator, "Verify telnet to emulator") - if not telnet_ok: - self.warning('Unable to telnet to emulator on port %d' % self.emulator["emulator_port"]) - return False return True def _verify_emulator_and_restart_on_fail(self): @@ -672,7 +630,7 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin def verify_emulator(self): ''' - Check to see if the emulator can be contacted via adb and telnet. + Check to see if the emulator can be contacted via adb. If any communication attempt fails, kill the emulator, re-launch, and re-check. ''' self.mkdir_p(self.query_abs_dirs()['abs_blob_upload_dir'])