From patchwork Thu Jan 3 16:38:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Terceiro X-Patchwork-Id: 13781 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2BCD023E03 for ; Thu, 3 Jan 2013 16:38:16 +0000 (UTC) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by fiordland.canonical.com (Postfix) with ESMTP id B121BA1958F for ; Thu, 3 Jan 2013 16:38:15 +0000 (UTC) Received: by mail-vb0-f50.google.com with SMTP id ft2so3876303vbb.23 for ; Thu, 03 Jan 2013 08:38:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=JckquYAhLsynTGGxrG1K6+ihOBVrgkSfWlbuPiO8GKU=; b=C8nTeTqbRj7cwvGgM8oKeboWzNNDsMDPXSFOlg3Jcw1PU+ywaw2PDL9dJuGN3Atzwl sr8XMGArqNKoH4+9wE+ebxEjaQLWudXLIT15V0x4iO4ddag0e6yDk9IsR6hPKnnZNet9 k1R0x3myp1WQfAuwojsO66RAefO1O+bsQBA0qZsvbTaYnzBQqH3S7moxliPtVaChQvfk ZfMgLTG8J7AaabEwl8f3VQlAfu/qz+ciAFcanxyVozQOo8POl74U1rPy6Kl+0Bw6SUNI wmCmkAGIOSZFZTFxxbP+UpjOVSVncsEBaVm21IV5Cx9oFGjDlq1swlpLJOV2iK82vL91 y4dw== X-Received: by 10.52.70.205 with SMTP id o13mr64710316vdu.75.1357231095148; Thu, 03 Jan 2013 08:38:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp99968veb; Thu, 3 Jan 2013 08:38:13 -0800 (PST) X-Received: by 10.180.99.1 with SMTP id em1mr75844998wib.20.1357231093296; Thu, 03 Jan 2013 08:38:13 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id v3si83806723wiz.5.2013.01.03.08.38.12 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Jan 2013 08:38:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Tqno4-00048x-4K for ; Thu, 03 Jan 2013 16:38:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 0F438E0159 for ; Thu, 3 Jan 2013 16:38:12 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 516 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 516: Adapt lava_android_test code to work with the Galaxy Nexus Message-Id: <20130103163812.13203.62622.launchpad@ackee.canonical.com> Date: Thu, 03 Jan 2013 16:38:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16393"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 773f59ca86183f88691a3a09adf4211c490441e2 X-Gm-Message-State: ALoCoQnRk5Va5Ojq55UCvGCRKr0Ve+yJ/Lrme68d3XY2P7I+upiw4m4Sg+xsEEJtCg5jwrkMoQ0G Merge authors: Antonio Terceiro (terceiro) Related merge proposals: https://code.launchpad.net/~terceiro/lava-dispatcher/lava-android-test-nexus/+merge/141128 proposed by: Antonio Terceiro (terceiro) review: Approve - Andy Doan (doanac) ------------------------------------------------------------ revno: 516 [merge] committer: Antonio Terceiro branch nick: trunk timestamp: Thu 2013-01-03 13:35:49 -0300 message: Adapt lava_android_test code to work with the Galaxy Nexus modified: lava_dispatcher/client/base.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/client/base.py' --- lava_dispatcher/client/base.py 2012-12-13 20:02:55 +0000 +++ lava_dispatcher/client/base.py 2013-01-02 18:55:32 +0000 @@ -194,8 +194,42 @@ prompt_str_includes_rc=client.target_device.deployment_data['TESTER_PS1_INCLUDES_RC']) self.dev_name = None + def connect(self): + if self._client.target_device.config.android_adb_over_tcp: + self._setup_adb_over_tcp() + elif self._client.target_device.config.android_adb_over_usb: + self._setup_adb_over_usb() + else: + raise CriticalError('ADB not configured for TCP or USB') + + def _setup_adb_over_tcp(self): + logging.info("adb connect over default network interface") + self.dev_ip = self.get_default_nic_ip() + if self.dev_ip is None: + raise OperationFailed("failed to get board ip address") + try: + ## just disconnect the adb connection in case is remained + ## by last action or last job + ## that connection should be expired already + self.android_adb_over_tcp_disconnect() + except: + ## ignore all exception + ## this just in case of exception + pass + self.android_adb_over_tcp_connect() + self.wait_until_attached() + + def _setup_adb_over_usb(self): + self.run('getprop ro.serialno', response = ['[0-9A-F]{16}']) + self.dev_name = self.match.group(0) + + def disconnect(self): + if self._client.target_device.config.android_adb_over_tcp: + self.android_adb_over_tcp_disconnect() + # adb cound be connected through network - def android_adb_connect(self, dev_ip): + def android_adb_over_tcp_connect(self): + dev_ip = self.dev_ip pattern1 = "connected to (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5})" pattern2 = "already connected to (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5})" pattern3 = "unable to connect to" @@ -207,7 +241,8 @@ if match_id in [0, 1]: self.dev_name = adb_proc.match.groups()[0] - def android_adb_disconnect(self, dev_ip): + def android_adb_over_tcp_disconnect(self): + dev_ip = self.dev_ip cmd = "adb disconnect %s" % dev_ip logging.info("Execute adb command on host: %s" % cmd) pexpect.run(cmd, timeout=300, logfile=sys.stdout) @@ -325,26 +360,12 @@ self.boot_linaro_android_image() session = AndroidTesterCommandRunner(self) - logging.info("adb connect over default network interface") - dev_ip = session.get_default_nic_ip() - if dev_ip is None: - raise OperationFailed("failed to get board ip address") - try: - ## just disconnect the adb connection in case is remained - ## by last action or last job - ## that connection should be expired already - session.android_adb_disconnect(dev_ip) - except: - ## ignore all exception - ## this just in case of exception - pass - session.android_adb_connect(dev_ip) - session.wait_until_attached() - + session.connect() + try: yield session finally: - session.android_adb_disconnect(dev_ip) + session.disconnect() def reliable_session(self): """