From patchwork Mon Oct 10 16:17:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spring Zhang X-Patchwork-Id: 4588 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 50CC623E0B for ; Mon, 10 Oct 2011 16:17:24 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id D12F7A181C9 for ; Mon, 10 Oct 2011 16:17:23 +0000 (UTC) Received: by gyd8 with SMTP id 8so8497205gyd.11 for ; Mon, 10 Oct 2011 09:17:23 -0700 (PDT) Received: by 10.223.77.71 with SMTP id f7mr11389591fak.33.1318263443013; Mon, 10 Oct 2011 09:17:23 -0700 (PDT) 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.152.24.41 with SMTP id r9cs121669laf; Mon, 10 Oct 2011 09:17:22 -0700 (PDT) Received: by 10.227.129.5 with SMTP id m5mr6616301wbs.67.1318263436922; Mon, 10 Oct 2011 09:17:16 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id fe15si13926880wbb.132.2011.10.10.09.17.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Oct 2011 09:17:16 -0700 (PDT) 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 1RDIXU-0002Cd-Dv for ; Mon, 10 Oct 2011 16:17:16 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 5FF90E0419 for ; Mon, 10 Oct 2011 16:17:16 +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: 129 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 129: create random result directory on Android test to fix bug 861115 Message-Id: <20111010161716.31794.76643.launchpad@ackee.canonical.com> Date: Mon, 10 Oct 2011 16:17:16 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14123"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 4a3859759594ee158c5b292ad09569d482117598 Merge authors: Spring Zhang (qzhang) Related merge proposals: https://code.launchpad.net/~qzhang/lava-dispatcher/fix-861115/+merge/77290 proposed by: Spring Zhang (qzhang) review: Approve - Yongqin Liu (liuyq0307) review: Resubmit - Spring Zhang (qzhang) ------------------------------------------------------------ revno: 129 [merge] committer: Spring Zhang branch nick: fix-861115 timestamp: Tue 2011-10-11 00:15:01 +0800 message: create random result directory on Android test to fix bug 861115 modified: lava_dispatcher/__init__.py lava_dispatcher/actions/launch_control.py lava_dispatcher/actions/lava-android-test.py lava_dispatcher/android_client.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/__init__.py' --- lava_dispatcher/__init__.py 2011-09-28 03:41:31 +0000 +++ lava_dispatcher/__init__.py 2011-09-28 07:12:06 +0000 @@ -146,6 +146,8 @@ @property def lava_result_dir(self): + if self.client.android_result_dir: + return self.client.android_result_dir return self.config.get("LAVA_RESULT_DIR") @property === modified file 'lava_dispatcher/actions/launch_control.py' --- lava_dispatcher/actions/launch_control.py 2011-09-27 10:36:53 +0000 +++ lava_dispatcher/actions/launch_control.py 2011-10-10 10:19:45 +0000 @@ -70,18 +70,16 @@ logging.warning("Fault string: %s" % err.faultString) class cmd_submit_results_on_host(SubmitResultAction): - def run(self, server, stream): - #Upload bundle files to dashboard logging.info("Executing submit_results_on_host command") bundlename_list = [] status = 'pass' err_msg = '' try: - bundle_list = os.listdir("/tmp/%s" % self.context.lava_result_dir) + bundle_list = os.listdir(self.context.lava_result_dir) for bundle_name in bundle_list: - bundle = "/tmp/%s/%s" % (self.context.lava_result_dir, bundle_name) + bundle = "%s/%s" % (self.context.lava_result_dir, bundle_name) bundlename_list.append(bundle) f = open(bundle) content = f.read() @@ -92,17 +90,15 @@ status = 'fail' err_msg = err_msg + " Some test case result appending failed." - self.submit_combine_bundles(status, err_msg, server, stream) - if status == 'fail': - raise OperationFailed(err_msg) - for bundle in bundlename_list: os.remove(bundle) + shutil.rmtree(self.context.lava_result_dir) + if status == 'fail': + raise OperationFailed(err_msg) class cmd_submit_results(SubmitResultAction): - def run(self, server, stream, result_disk="testrootfs"): """Submit test results to a lava-dashboard server :param server: URL of the lava-dashboard server RPC endpoint @@ -133,7 +129,7 @@ status = 'pass' err_msg = '' master_ip = client.get_master_ip() - if master_ip != None: + if master_ip: # Set 80 as server port client.run_cmd_master('python -m SimpleHTTPServer 80 &> /dev/null &') time.sleep(3) @@ -144,7 +140,6 @@ # download test result with a retry mechanism # set retry timeout to 2mins - logging.info("About to download the result tarball to host") now = time.time() timeout = 120 @@ -195,6 +190,7 @@ def _get_dashboard(server): if not server.endswith("/"): server = ''.join([server, "/"]) + #add backward compatible for 'dashboard/'-end URL #Fix it: it's going to be deleted after transition if server.endswith("dashboard/"): @@ -211,6 +207,7 @@ else: logging.warn("The url seems not RPC2 or xml-rpc endpoints, please make sure it's a valid one!!!") dashboard = srv.dashboard + logging.info("server RPC endpoint URL: %s" % server) return dashboard === modified file 'lava_dispatcher/actions/lava-android-test.py' --- lava_dispatcher/actions/lava-android-test.py 2011-09-20 06:14:43 +0000 +++ lava_dispatcher/actions/lava-android-test.py 2011-10-10 10:19:45 +0000 @@ -18,6 +18,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . + import sys import pexpect import time @@ -61,11 +62,11 @@ return dev_name class cmd_lava_android_test_run(AndroidTestAction): - def run(self, test_name, timeout= -1): + def run(self, test_name, timeout=-1): #Make sure in test image now dev_name = self.is_ready_for_test() bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S") - cmd = 'lava-android-test run %s -s %s -o /tmp/%s/%s.bundle' % ( + cmd = 'lava-android-test run %s -s %s -o %s/%s.bundle' % ( test_name, dev_name, self.context.lava_result_dir, bundle_name) rc = pexpect.run(cmd, timeout=None, logfile=sys.stdout, withexitstatus=True)[1] === modified file 'lava_dispatcher/android_client.py' --- lava_dispatcher/android_client.py 2011-09-23 02:53:30 +0000 +++ lava_dispatcher/android_client.py 2011-10-10 10:19:45 +0000 @@ -19,15 +19,23 @@ import pexpect import sys +import os import time from lava_dispatcher.client import LavaClient, OperationFailed, NetworkError, GeneralError import logging from utils import string_to_list +from tempfile import mkdtemp class LavaAndroidClient(LavaClient): + def __init__(self, context, config): + LavaClient.__init__(self, context, config) + # use a random result directory on android for they are using same host + self.android_result_dir = mkdtemp( + dir='/tmp/%s' % context.config.get("LAVA_RESULT_DIR")) + os.chmod(self.android_result_dir, 0755) - def run_adb_shell_command(self, dev_id, cmd, response, timeout= -1): + def run_adb_shell_command(self, dev_id, cmd, response, timeout=-1): adb_cmd = "adb -s %s shell %s" % (dev_id, cmd) try: adb_proc = pexpect.spawn(adb_cmd, logfile=sys.stdout)