diff mbox

[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
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Oct. 13, 2011, 9:31 p.m. UTC
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 <michael.hudson@linaro.org>
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
diff mbox

Patch

=== 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