From patchwork Thu Oct 13 21:31:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 4667 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 E66F523E0C for ; Thu, 13 Oct 2011 21:31:17 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id C9A2BA186C9 for ; Thu, 13 Oct 2011 21:31:17 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so1285604bkb.11 for ; Thu, 13 Oct 2011 14:31:17 -0700 (PDT) Received: by 10.204.134.85 with SMTP id i21mr4317385bkt.100.1318541477217; Thu, 13 Oct 2011 14:31:17 -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 r9cs275658laf; Thu, 13 Oct 2011 14:31:16 -0700 (PDT) Received: by 10.213.17.6 with SMTP id q6mr253462eba.128.1318541476335; Thu, 13 Oct 2011 14:31:16 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id n51si1301520weq.25.2011.10.13.14.31.16 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 14:31: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 1RESrz-00013W-Ky for ; Thu, 13 Oct 2011 21:31:15 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 96747E14A5 for ; Thu, 13 Oct 2011 21:31:15 +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: 130 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 130: make the name of the lava_{android_, }test_run test cases submitted to lava include the name of th... Message-Id: <20111013213115.21958.43885.launchpad@ackee.canonical.com> Date: Thu, 13 Oct 2011 21:31:15 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14124"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: fde37dc83887d7209903a3c50a12520b0ac7e899 Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/mangle-lava_test_run-names/+merge/79055 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Yongqin Liu (liuyq0307) ------------------------------------------------------------ revno: 130 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Fri 2011-10-14 10:28:40 +1300 message: make the name of the lava_{android_,}test_run test cases submitted to lava include the name of the test that was run modified: lava_dispatcher/__init__.py lava_dispatcher/actions/__init__.py lava_dispatcher/actions/lava-android-test.py lava_dispatcher/actions/lava-test.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 07:12:06 +0000 +++ lava_dispatcher/__init__.py 2011-10-13 01:42:17 +0000 @@ -99,7 +99,7 @@ else: err_msg = "" self.context.test_data.add_result( - cmd['command'], status, err_msg) + action.test_name(**params), status, err_msg) except: #Capture all user-defined and non-user-defined critical errors self.context.test_data.job_status='fail' === modified file 'lava_dispatcher/actions/__init__.py' --- lava_dispatcher/actions/__init__.py 2011-09-12 22:31:47 +0000 +++ lava_dispatcher/actions/__init__.py 2011-10-13 01:41:00 +0000 @@ -24,6 +24,17 @@ import imp import os + +class classproperty(object): + """Like the builtin @property, but binds to the class not instances.""" + + def __init__(self, func): + self.func = func + + def __get__(self, ob, cls): + return self.func(cls) + + class BaseAction(object): def __init__(self, context): self.context = context @@ -32,15 +43,24 @@ def client(self): return self.context.client + @classproperty + def command_name(cls): + cls_name = cls.__name__ + if cls_name.startswith('cmd_'): + return cls_name[4:] + else: + # This should never happen. But it's not clear that raising an + # AssertionError from this point would be useful either. + return cls_name + + def test_name(self, **params): + return self.command_name + class BaseAndroidAction(BaseAction): def __init__(self, context): self.context = context - @property - def client(self): - return self.context.client - def check_sys_bootup(self): result_pattern = "([0-1])" cmd = "getprop sys.boot_completed" @@ -55,8 +75,7 @@ cmds = {} for name, cls in module.__dict__.iteritems(): if name.startswith("cmd_"): - real_name = name[4:] - cmds[real_name] = cls + cmds[cls.command_name] = cls return cmds def get_all_cmds(): === modified file 'lava_dispatcher/actions/lava-android-test.py' --- lava_dispatcher/actions/lava-android-test.py 2011-10-10 10:19:45 +0000 +++ lava_dispatcher/actions/lava-android-test.py 2011-10-13 01:42:17 +0000 @@ -62,6 +62,11 @@ return dev_name class cmd_lava_android_test_run(AndroidTestAction): + + def test_name(self, test_name, timeout=-1): + return super(cmd_lava_android_test_run, self).test_name() + \ + ' (%s)' % test_name + def run(self, test_name, timeout=-1): #Make sure in test image now dev_name = self.is_ready_for_test() === modified file 'lava_dispatcher/actions/lava-test.py' --- lava_dispatcher/actions/lava-test.py 2011-09-23 03:26:35 +0000 +++ lava_dispatcher/actions/lava-test.py 2011-10-04 04:18:22 +0000 @@ -82,6 +82,10 @@ class cmd_lava_test_run(BaseAction): + + def test_name(self, test_name, timeout=-1): + return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name + def run(self, test_name, timeout=-1): logging.info("Executing lava_test_run %s command" % test_name) #Make sure in test image now