diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 299: merge the monkeyrunner support branch

Message ID 20120524015810.16830.50100.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Yongqin Liu May 24, 2012, 1:58 a.m. UTC
Merge authors:
  Yongqin Liu (liuyq0307)
Related merge proposals:
  https://code.launchpad.net/~liuyq0307/lava-dispatcher/monkeyrunner/+merge/106959
  proposed by: Yongqin Liu (liuyq0307)
  review: Approve - Yongqin Liu (liuyq0307)
------------------------------------------------------------
revno: 299 [merge]
committer: Yongqin Liu <yongqin.liu@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2012-05-24 09:53:30 +0800
message:
  merge the monkeyrunner support branch
modified:
  doc/examples/jobs/lava-android-test.json
  lava_dispatcher/actions/lava-android-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 'doc/examples/jobs/lava-android-test.json'
--- doc/examples/jobs/lava-android-test.json	2012-03-15 09:16:09 +0000
+++ doc/examples/jobs/lava-android-test.json	2012-04-19 11:38:00 +0000
@@ -65,6 +65,13 @@ 
         }
     },
     {
+      "command": "lava_android_test_run_monkeyrunner",
+      "parameters":
+        {
+          "url": "git://android.git.linaro.org/test/linaro/android/system.git"
+        }
+    },
+    {
       "command": "submit_results_on_host",
       "parameters":
         {

=== modified file 'lava_dispatcher/actions/lava-android-test.py'
--- lava_dispatcher/actions/lava-android-test.py	2012-03-19 06:52:06 +0000
+++ lava_dispatcher/actions/lava-android-test.py	2012-04-26 07:44:18 +0000
@@ -22,7 +22,6 @@ 
 import os
 import subprocess
 import logging
-from datetime import datetime
 from lava_dispatcher.actions import BaseAction
 from lava_dispatcher.client.base import OperationFailed
 from lava_dispatcher.utils import generate_bundle_file_name
@@ -126,6 +125,45 @@ 
                                                     session.dev_name, rc))
 
 
+class cmd_lava_android_test_run_monkeyrunner(AndroidTestAction):
+    '''
+    This action is added to make doing the monkeyrunner script test more easily
+    from android build page. With this action, we only need to specify the url
+    of the repository where the monkeyrunner script are stored.
+    Then lava-android-test will run all the monkeyrunner scripts in that
+    repository, and help to gather all the png files genereated when run
+    '''
+    parameters_schema = {
+        'type': 'object',
+        'properties': {
+            'url': {'type': 'string'},
+            'timeout': {'type': 'integer', 'optional': True},
+            },
+        'additionalProperties': False,
+        }
+
+    def test_name(self, url=None, timeout=-1):
+        return '%s (url=[%s])' % (
+             super(cmd_lava_android_test_run_monkeyrunner, self).test_name(),
+                url)
+
+    def run(self, url=None, timeout=-1):
+        #Make sure in test image now
+        self.check_lava_android_test_installed()
+        with self.client.android_tester_session() as session:
+            bundle_name = generate_bundle_file_name('monkeyrunner')
+            cmds = ["lava-android-test", 'run-monkeyrunner', url]
+            cmds.extend(['-s', session.dev_name, '-o',
+                         '%s/%s.bundle' % (self.context.host_result_dir,
+                                           bundle_name)])
+            logging.info("Execute command on host: %s" % (' '.join(cmds)))
+            rc = subprocess.call(cmds)
+            if rc != 0:
+                raise OperationFailed(
+                    "Failed to run monkeyrunner test url[%s] on device(%s)"
+                    " with return value: %s" % (url, session.dev_name, rc))
+
+
 class cmd_lava_android_test_install(AndroidTestAction):
     """
     lava-test deployment to test image rootfs by chroot