Merge lp:~le-chi-thu/lava-dispatcher/override-test-options into lp:lava-dispatcher

Proposed by Le Chi Thu
Status: Merged
Merged at revision: 144
Proposed branch: lp:~le-chi-thu/lava-dispatcher/override-test-options
Merge into: lp:lava-dispatcher
Diff against target: 61 lines (+33/-4)
2 files modified
doc/test_with_testoptions.json (+25/-0)
lava_dispatcher/actions/lava-test.py (+8/-4)
To merge this branch: bzr merge lp:~le-chi-thu/lava-dispatcher/override-test-options
Reviewer Review Type Date Requested Status
Spring Zhang (community) Approve
Review via email: mp+79784@code.launchpad.net

Description of the change

Added support for test_options in lava_test_run command.

   {
      "command": "lava_test_run",
      "parameters":
        {
          "test_name": "peacekeeper",
          "test_options": "firefox"
        }
    }

See the doc/test_with_testoptions.json as an example.

To post a comment you must log in.
Revision history for this message
Spring Zhang (qzhang) wrote :

Did you have a test? Notice the following code, I'm not sure if it could fail?
40 return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name

review: Approve
Revision history for this message
Le Chi Thu (le-chi-thu) wrote :

yes. I tested it and it works

/Chi Thu

On 19 October 2011 12:37, Spring Zhang <email address hidden> wrote:

> Review: Approve
>
> Did you have a test? Notice the following code, I'm not sure if it could
> fail?
> 40 return super(cmd_lava_test_run, self).test_name() + ' (%s)' %
> test_name
> --
>
> https://code.launchpad.net/~le-chi-thu/lava-dispatcher/override-test-options/+merge/79784
> You are the owner of lp:~le-chi-thu/lava-dispatcher/override-test-options.
>

Revision history for this message
Paul Larson (pwlars) wrote :

54 + if test_options != "":
55 + test_options = "-t " + test_options
I assume you will need to add quotes around the test_options, or else multiple options will not work right?

140. By Le Chi Thu <email address hidden> <email address hidden>

Added single quote -t options of lava-test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-20 12:18:17 +0000
@@ -0,0 +1,25 @@
1{
2 "job_name": "foo",
3 "target": "panda01",
4 "timeout": 18000,
5 "actions": [
6 {
7 "command": "lava_test_install",
8 "parameters":
9 {
10 "tests": ["peacekeeper"]
11 }
12 },
13 {
14 "command": "boot_linaro_image"
15 },
16 {
17 "command": "lava_test_run",
18 "parameters":
19 {
20 "test_name": "peacekeeper",
21 "test_options": "firefox"
22 }
23 }
24 ]
25}
026
=== 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:18:17 +0000
@@ -84,10 +84,10 @@
8484
85class cmd_lava_test_run(BaseAction):85class cmd_lava_test_run(BaseAction):
8686
87 def test_name(self, test_name, timeout=-1):87 def test_name(self, test_name, test_options = "", timeout=-1):
88 return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name88 return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name
89 89
90 def run(self, test_name, timeout=-1):90 def run(self, test_name, test_options = "", timeout=-1):
91 logging.info("Executing lava_test_run %s command" % test_name)91 logging.info("Executing lava_test_run %s command" % test_name)
92 #Make sure in test image now92 #Make sure in test image now
93 client = self.client93 client = self.client
@@ -95,8 +95,12 @@
95 client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)95 client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)
96 client.export_display()96 client.export_display()
97 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")97 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
98 cmd = ('lava-test run %s -o %s/%s.bundle' % (98
99 test_name, self.context.lava_result_dir, bundle_name))99 if test_options != "":
100 test_options = "-t '%s'" % test_options
101
102 cmd = ('lava-test run %s %s -o %s/%s.bundle' % (
103 test_name, test_options, self.context.lava_result_dir, bundle_name))
100 try:104 try:
101 rc = client.run_cmd_tester(cmd, timeout=timeout)105 rc = client.run_cmd_tester(cmd, timeout=timeout)
102 except:106 except:

Subscribers

People subscribed via source and target branches