=== modified file 'lava_dispatcher/__init__.py'
@@ -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'
@@ -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'
@@ -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'
@@ -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