From patchwork Tue Sep 27 10:16:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqin Liu X-Patchwork-Id: 4371 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 E200723EF6 for ; Tue, 27 Sep 2011 10:16:15 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id CFB66A18631 for ; Tue, 27 Sep 2011 10:16:15 +0000 (UTC) Received: by fxe23 with SMTP id 23so9693375fxe.11 for ; Tue, 27 Sep 2011 03:16:15 -0700 (PDT) Received: by 10.223.63.8 with SMTP id z8mr12165506fah.84.1317118575663; Tue, 27 Sep 2011 03:16:15 -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.3.234 with SMTP id f10cs67341laf; Tue, 27 Sep 2011 03:16:14 -0700 (PDT) Received: by 10.14.20.65 with SMTP id o41mr2669850eeo.55.1317118574289; Tue, 27 Sep 2011 03:16:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id u55si20328397weq.70.2011.09.27.03.16.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Sep 2011 03:16:14 -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 1R8Uhx-0001Fu-NO for ; Tue, 27 Sep 2011 10:16:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id A7E9DE2972 for ; Tue, 27 Sep 2011 10:16:13 +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: 124 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 124: merge to trunk: Message-Id: <20110927101613.31509.57357.launchpad@ackee.canonical.com> Date: Tue, 27 Sep 2011 10:16:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14041"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: b28dd3fef5618888ed77d22604c8a06d34e40c1e Merge authors: Yongqin Liu (liuyq0307) Related merge proposals: https://code.launchpad.net/~liuyq0307/lava-dispatcher/combine/+merge/76966 proposed by: Yongqin Liu (liuyq0307) review: Approve - Spring Zhang (qzhang) ------------------------------------------------------------ revno: 124 [merge] committer: Yongqin Liu branch nick: lava-dispatcher timestamp: Tue 2011-09-27 18:12:50 +0800 message: merge to trunk: add combine process for submit_results_on_host action make 0xbench execute first befor monkey in job file add busybox test to job file modified: doc/lava-android-test-leb-panda.json lava_dispatcher/actions/launch_control.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 'doc/lava-android-test-leb-panda.json' --- doc/lava-android-test-leb-panda.json 2011-09-20 06:14:43 +0000 +++ doc/lava-android-test-leb-panda.json 2011-09-27 10:12:50 +0000 @@ -25,7 +25,21 @@ "command": "lava_android_test_install", "parameters": { - "tests": ["monkey", "0xbench"] + "tests": ["monkey", "0xbench", "busybox"] + } + }, + { + "command": "lava_android_test_run", + "parameters": + { + "test_name": "busybox" + } + }, + { + "command": "lava_android_test_run", + "parameters": + { + "test_name": "0xbench" } }, { @@ -36,13 +50,6 @@ } }, { - "command": "lava_android_test_run", - "parameters": - { - "test_name": "0xbench" - } - }, - { "command": "submit_results_on_host", "parameters": { === modified file 'lava_dispatcher/actions/launch_control.py' --- lava_dispatcher/actions/launch_control.py 2011-09-23 02:53:30 +0000 +++ lava_dispatcher/actions/launch_control.py 2011-09-26 11:37:32 +0000 @@ -33,42 +33,81 @@ import xmlrpclib import traceback -class cmd_submit_results_on_host(BaseAction): +class SubmitResultAction(BaseAction): + all_bundles = [] + def combine_bundles(self): + if not self.all_bundles: + return { + "test_runs": [], + "format": "Dashboard Bundle Format 1.2" + } + main_bundle = self.all_bundles.pop(0) + test_runs = main_bundle['test_runs'] + for bundle in self.all_bundles: + test_runs += bundle['test_runs'] + return main_bundle + + def submit_combine_bundles(self, status='pass', err_msg='', server=None, stream=None): + dashboard = _get_dashboard(server) + main_bundle = self.combine_bundles() + self.context.test_data.add_seriallog( + self.context.client.get_seriallog()) + # add gather_results result + self.context.test_data.add_result('gather_results', status, err_msg) + main_bundle['test_runs'].append(self.context.test_data.get_test_run()) + for test_run in main_bundle['test_runs']: + attributes = test_run.get('attributes', {}) + attributes.update(self.context.test_data.get_metadata()) + test_run['attributes'] = attributes + json_bundle = json.dumps(main_bundle) + + try: + print >> self.context.oob_file, 'dashboard-put-result:', \ + dashboard.put_ex(json_bundle, 'lava-dispatcher.bundle', stream) + except xmlrpclib.Fault, err: + logging.warning("xmlrpclib.Fault occurred") + logging.warning("Fault code: %d" % err.faultCode) + logging.warning("Fault string: %s" % err.faultString) + +class cmd_submit_results_on_host(SubmitResultAction): + def run(self, server, stream): - dashboard = _get_dashboard(server) #Upload bundle files to dashboard logging.info("Executing submit_results_on_host command") - bundle_list = os.listdir("/tmp/%s" % self.context.lava_result_dir) - for bundle_name in bundle_list: - bundle = "/tmp/%s/%s" % (self.context.lava_result_dir, bundle_name) - f = open(bundle) - content = f.read() - f.close() - job_name = self.context.job_data.get('job_name', "LAVA Results") - try: - print >> self.context.oob_file, 'dashboard-put-result:', \ - dashboard.put_ex(content, job_name, stream) - except xmlrpclib.Fault, err: - logging.warning("xmlrpclib.Fault occurred") - logging.warning("Fault code: %d" % err.faultCode) - logging.warning("Fault string: %s" % err.faultString) - - # After uploading, remove the bundle file at the host side + bundlename_list = [] + status = 'pass' + err_msg = '' + try: + bundle_list = os.listdir("/tmp/%s" % self.context.lava_result_dir) + for bundle_name in bundle_list: + bundle = "/tmp/%s/%s" % (self.context.lava_result_dir, bundle_name) + bundlename_list.append(bundle) + f = open(bundle) + content = f.read() + f.close() + self.all_bundles.append(json.loads(content)) + except: + print traceback.format_exc() + 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) - -class cmd_submit_results(BaseAction): - all_bundles = [] +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 :param stream: Stream on the lava-dashboard server to save the result to """ - #Create l-d server connection - dashboard = _get_dashboard(server) - client = self.client try: self.in_master_shell() @@ -110,11 +149,11 @@ now = time.time() timeout = 120 try: - while time.time() < now+timeout: + while time.time() < now + timeout: try: result_path = download(result_tarball, tarball_dir) except: - if time.time() >= now+timeout: + if time.time() >= now + timeout: raise except: logging.warning(traceback.format_exc()) @@ -148,37 +187,10 @@ #flush the serial log client.run_shell_command("") - - main_bundle = self.combine_bundles() - self.context.test_data.add_seriallog( - self.context.client.get_seriallog()) - # add gather_results result - self.context.test_data.add_result('gather_results', status, err_msg) - main_bundle['test_runs'].append(self.context.test_data.get_test_run()) - for test_run in main_bundle['test_runs']: - attributes = test_run.get('attributes',{}) - attributes.update(self.context.test_data.get_metadata()) - test_run['attributes'] = attributes - json_bundle = json.dumps(main_bundle) - job_name = self.context.job_data.get('job_name', "LAVA Results") - print >> self.context.oob_file, 'dashboard-put-result:', \ - dashboard.put_ex(json_bundle, job_name, stream) - + self.submit_combine_bundles(status, err_msg, server, stream) if status == 'fail': raise OperationFailed(err_msg) - def combine_bundles(self): - if not self.all_bundles: - return { - "test_runs": [], - "format": "Dashboard Bundle Format 1.2" - } - main_bundle = self.all_bundles.pop(0) - test_runs = main_bundle['test_runs'] - for bundle in self.all_bundles: - test_runs += bundle['test_runs'] - return main_bundle - #util function, see if it needs to be part of utils.py def _get_dashboard(server): if not server.endswith("/"):