[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 144: Allow use of override options flag in lava-test

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

Commit Message

Paul Larson Oct. 20, 2011, 5:59 p.m.
Merge authors:
  Le Chi Thu le.chi.thu@linaro.org <le.chi.thu@linaro.org>
Related merge proposals:
  https://code.launchpad.net/~le-chi-thu/lava-dispatcher/override-test-options/+merge/79784
  proposed by: Le Chi Thu (le-chi-thu)
  review: Approve - Spring Zhang (qzhang)
------------------------------------------------------------
revno: 144 [merge]
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-dispatcher
timestamp: Thu 2011-10-20 12:57:23 -0500
message:
  Allow use of override options flag in lava-test
added:
  doc/test_with_testoptions.json
modified:
  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

Patch

=== added file 'doc/test_with_testoptions.json'
--- doc/test_with_testoptions.json	1970-01-01 00:00:00 +0000
+++ doc/test_with_testoptions.json	2011-10-19 09:18:04 +0000
@@ -0,0 +1,25 @@ 
+{
+  "job_name": "foo",
+  "target": "panda01",
+  "timeout": 18000,
+  "actions": [
+    {
+      "command": "lava_test_install",
+      "parameters":
+        {
+            "tests": ["peacekeeper"]
+        }
+    },
+    {
+      "command": "boot_linaro_image"
+    },
+    {
+      "command": "lava_test_run",
+      "parameters":
+        {
+          "test_name": "peacekeeper",
+          "test_options": "firefox"
+        }
+    }
+  ]
+}

=== modified file 'lava_dispatcher/actions/lava-test.py'
--- lava_dispatcher/actions/lava-test.py	2011-10-18 02:38:34 +0000
+++ lava_dispatcher/actions/lava-test.py	2011-10-20 12:15:38 +0000
@@ -84,10 +84,10 @@ 
 
 class cmd_lava_test_run(BaseAction):
 
-    def test_name(self, test_name, timeout=-1):
+    def test_name(self, test_name, test_options = "", timeout=-1):
         return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name
     
-    def run(self, test_name, timeout=-1):
+    def run(self, test_name, test_options = "", timeout=-1):
         logging.info("Executing lava_test_run %s command" % test_name)
         #Make sure in test image now
         client = self.client
@@ -95,8 +95,12 @@ 
         client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)
         client.export_display()
         bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
-        cmd = ('lava-test run %s -o %s/%s.bundle' % (
-                test_name, self.context.lava_result_dir, bundle_name))
+
+        if test_options != "":
+            test_options = "-t '%s'" % test_options
+            
+        cmd = ('lava-test run %s %s -o %s/%s.bundle' % (
+                test_name, test_options, self.context.lava_result_dir, bundle_name))
         try:
             rc = client.run_cmd_tester(cmd, timeout=timeout)
         except: