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
1=== added file 'doc/test_with_testoptions.json'
2--- doc/test_with_testoptions.json 1970-01-01 00:00:00 +0000
3+++ doc/test_with_testoptions.json 2011-10-20 12:18:17 +0000
4@@ -0,0 +1,25 @@
5+{
6+ "job_name": "foo",
7+ "target": "panda01",
8+ "timeout": 18000,
9+ "actions": [
10+ {
11+ "command": "lava_test_install",
12+ "parameters":
13+ {
14+ "tests": ["peacekeeper"]
15+ }
16+ },
17+ {
18+ "command": "boot_linaro_image"
19+ },
20+ {
21+ "command": "lava_test_run",
22+ "parameters":
23+ {
24+ "test_name": "peacekeeper",
25+ "test_options": "firefox"
26+ }
27+ }
28+ ]
29+}
30
31=== modified file 'lava_dispatcher/actions/lava-test.py'
32--- lava_dispatcher/actions/lava-test.py 2011-10-18 02:38:34 +0000
33+++ lava_dispatcher/actions/lava-test.py 2011-10-20 12:18:17 +0000
34@@ -84,10 +84,10 @@
35
36 class cmd_lava_test_run(BaseAction):
37
38- def test_name(self, test_name, timeout=-1):
39+ def test_name(self, test_name, test_options = "", timeout=-1):
40 return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name
41
42- def run(self, test_name, timeout=-1):
43+ def run(self, test_name, test_options = "", timeout=-1):
44 logging.info("Executing lava_test_run %s command" % test_name)
45 #Make sure in test image now
46 client = self.client
47@@ -95,8 +95,12 @@
48 client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)
49 client.export_display()
50 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
51- cmd = ('lava-test run %s -o %s/%s.bundle' % (
52- test_name, self.context.lava_result_dir, bundle_name))
53+
54+ if test_options != "":
55+ test_options = "-t '%s'" % test_options
56+
57+ cmd = ('lava-test run %s %s -o %s/%s.bundle' % (
58+ test_name, test_options, self.context.lava_result_dir, bundle_name))
59 try:
60 rc = client.run_cmd_tester(cmd, timeout=timeout)
61 except:

Subscribers

People subscribed via source and target branches