Merge lp:~le-chi-thu/linaro-ci/add-testplan-support into lp:linaro-ci

Proposed by Le Chi Thu
Status: Merged
Merged at revision: 62
Proposed branch: lp:~le-chi-thu/linaro-ci/add-testplan-support
Merge into: lp:linaro-ci
Diff against target: 129 lines (+43/-34)
1 file modified
get_latest_ci_hwpack (+43/-34)
To merge this branch: bzr merge lp:~le-chi-thu/linaro-ci/add-testplan-support
Reviewer Review Type Date Requested Status
Deepti B. Kalakeri (community) Approve
Le Chi Thu (community) Needs Resubmitting
Review via email: mp+104743@code.launchpad.net

Description of the change

Add support to define test plan for lava.

the format is : LAVA_TEST_PLAN=<testcase>(<options>):<timeout>,...
options and timeout is optional.

Examples:
LAVA_TEST_PLAN=ltp,pwrmgmt
LAVA_TEST_PLAN=test_abc(option_abc):100

if the LAVA_TEST_PLAN is not define, the default will be "ltp,pwrmgmt". It mean the current jobs do not need to update.

To post a comment you must log in.
Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :
Download full text (4.9 KiB)

Thanks for the changes. Please see my comments inline.

On Fri, May 4, 2012 at 7:38 PM, Le Chi Thu <email address hidden> wrote:

> Le Chi Thu has proposed merging
> lp:~le-chi-thu/linaro-ci/add-testplan-support into lp:linaro-ci.
>
> Requested reviews:
> Deepti B. Kalakeri (deeptik)
>
> For more details, see:
>
> https://code.launchpad.net/~le-chi-thu/linaro-ci/add-testplan-support/+merge/104743<https://code.launchpad.net/%7Ele-chi-thu/linaro-ci/add-testplan-support/+merge/104743>
>
> Add support to define test plan for lava.
>
> the format is : LAVA_TEST_PLAN=<testcase>(<options>):<timeout>,...
> options and timeout is optional.
>
> Examples:
> LAVA_TEST_PLAN=ltp,pwrmgmt
> LAVA_TEST_PLAN=test_abc(option_abc):100
>

Could you give me an example of the options_abc ?

>
> if the LAVA_TEST_PLAN is not define, the default will be "ltp,pwrmgmt". It
> mean the current jobs do not need to update.
>

The default test that needs to be run should as well include
boot_linaro_image. Without booting the image how will you be able to run
the tests ?

> --
>
> https://code.launchpad.net/~le-chi-thu/linaro-ci/add-testplan-support/+merge/104743<https://code.launchpad.net/%7Ele-chi-thu/linaro-ci/add-testplan-support/+merge/104743>
> You are requested to review the proposed merge of
> lp:~le-chi-thu/linaro-ci/add-testplan-support into lp:linaro-ci.
>
> === modified file 'get_latest_ci_hwpack'
> --- get_latest_ci_hwpack 2012-04-04 12:14:43 +0000
> +++ get_latest_ci_hwpack 2012-05-04 14:07:20 +0000
> @@ -5,6 +5,7 @@
>
> Usage: ./gentemplate <target> <hwpack_type> <image_type>
> """
> +import re
>
> from find_latest import find_latest_hwpack, find_latest_rootfs,
> find_ci_latest
> import json
> @@ -15,8 +16,7 @@
> job_name = os.getenv("KERNEL_JOB_NAME", "unknown") + '_' + \
> os.getenv("HWPACK_BUILD_DATE", "unknown") + '_daily test'
>
> -
> -
> +testplan = os.getenv("LAVA_TEST_PLAN", "ltp,pwrmgmt")
>
> template = {
> "timeout": 20000,
> @@ -25,36 +25,6 @@
> "command": "deploy_linaro_image"
> },
> {
> - "command": "lava_test_install",
> - "parameters":
> - {
> - "tests": [
> - "ltp",
> - "pwrmgmt"
> - ],
> - "timeout": 4000
> - }
> - },
> - {
> - "command": "boot_linaro_image"
> - },
>

This should not be deleted, as we need to boot the image and then can we
run the tests.

> - {
> - "command": "lava_test_run",
> - "parameters":
> - {
> - "test_name": "ltp",
> - "timeout": 4800
> - }
> - },
> - {
> - "command": "lava_test_run",
> - "parameters":
> - {
> - "test_name": "pwrmgmt",
> - "timeout": 4800
> - }
> - },
> - {
> "command": "submit_results",
> "parameters": {
> "stream": os.getenv("BUNDLE_STREAM_NAME", "/anonymous/plars/"),
> @@ -71,6 +41,9 @@
> hwpack_dir_url=os.getenv("KERNEL_JOB_NAME", "unknown")
> hwpack_url_path = os.path.join(url, hwpack_parent_url)
> hwpack_url_path = os.path.join(hwpack_url_path, hwpack_dir_url)
> +
> +
> +
>

Please delete the blank lines, you can leave a single bla...

Read more...

Revision history for this message
Deepti B. Kalakeri (deeptik) :
review: Needs Fixing
Revision history for this message
Le Chi Thu (le-chi-thu) wrote :

ltp take options - see the $OPTIONS macro in the test definition file.
RUNSTEPS = ['cd build && sudo ./runltp $(OPTIONS)']
http://bazaar.launchpad.net/~linaro-validation/lava-test/trunk/view/head:/lava_test/test_definitions/ltp.py

Now the json file is correct generate.

review: Needs Resubmitting
62. By Le Chi Thu <email address hidden> <email address hidden>

Update after review 1

Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

Thanks for addressing the review, I have few more.

1) Please retain the boot_linaro_image stuff as it was before you made the
changes, since this block does not change, I would like to have it in the
dict itself.

2) I did not see the 80 columns rule being followed, for ex line no: 99
spans to 100 columns.

3) I guess you did not see the following comments in the previous review

(i)
"
>
re.compile("(?P<testcase>\w+)(\((?P<options>[^\)]+)\))?(:(?P<timeout>\d+))?")
>

The regex above should not match first part(:100) of the following
LAVA_TEST_PLAN=":100, test_bcd".
The above regex matches :100 as testcase which is invalid.
"

(ii)

> +
> + if r.group("options"):
> + lava_test_run_command["parameters"]["test_options"] =
> r.group("options")
> +
> + template['actions'].append(lava_test_run_command)
> +
>

It would be good if combined both the for loops into one for loop.

could you please address all of them and resubmit.

On Tue, May 8, 2012 at 5:53 PM, Le Chi Thu <email address hidden> wrote:

> Review: Resubmit
>
> ltp take options - see the $OPTIONS macro in the test definition file.
> RUNSTEPS = ['cd build && sudo ./runltp $(OPTIONS)']
>
> http://bazaar.launchpad.net/~linaro-validation/lava-test/trunk/view/head:/lava_test/test_definitions/ltp.py
>
> Now the json file is correct generate.
> --
>
> https://code.launchpad.net/~le-chi-thu/linaro-ci/add-testplan-support/+merge/104743<https://code.launchpad.net/%7Ele-chi-thu/linaro-ci/add-testplan-support/+merge/104743>
> You are reviewing the proposed merge of
> lp:~le-chi-thu/linaro-ci/add-testplan-support into lp:linaro-ci.
>

--
Thanks and Regards,
Deepti
Infrastructure Team Member, Linaro Platform Teams
Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

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

Fixed according to comments.

review: Needs Resubmitting
63. By Le Chi Thu <email address hidden> <email address hidden>

Updated after review 2

Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :
Download full text (3.5 KiB)

Your changes fail when we pass LAVA_TEST_PLAN="test_abc(option_abc):100, test_bcd":
python ./get_latest_ci_hwpack
Traceback (most recent call last):
  File "./get_latest_ci_hwpack", line 94, in <module>
    lava_test_install_command["parameters"]["tests"].append(r.group("testcase"))
AttributeError: 'NoneType' object has no attribute 'group'

The following changes fix the above problem and includes other changes like aligning to 80 columns rule.
=== modified file 'get_latest_ci_hwpack'
--- get_latest_ci_hwpack 2012-05-09 12:01:28 +0000
+++ get_latest_ci_hwpack 2012-05-14 08:49:26 +0000
@@ -16,7 +16,7 @@
 job_name = os.getenv("KERNEL_JOB_NAME", "unknown") + '_' + \
            os.getenv("HWPACK_BUILD_DATE", "unknown") + '_daily test'

-testplan = os.getenv("LAVA_TEST_PLAN", "ltp,pwrmgmt")
+testplan = os.getenv("LAVA_TEST_PLAN", "ltp, pwrmgmt")

 template = {
   "timeout": 20000,
@@ -66,50 +66,48 @@
 metadata['kernel.git_log_info'] = os.getenv("GIT_LOG", "unknown")
 metadata['hwpack.type'] = hwpacktype
 metadata['hwpack.date'] = hwpackdate
-
-
 rootfsdate, rootfsbuild = rootfs_id.split('.')
 metadata['rootfs.type'] = imagetype
 metadata['rootfs.date'] = rootfsdate
 metadata['rootfs.build'] = rootfsbuild
-
 template['actions'][0]['metadata'] = metadata

 testcases = testplan.split(',')
-
-regex = re.compile("(?P<testcase>^\w+)(\((?P<options>[^\)]+)\))?(:(?P<timeout>\d+))?")
-
-# lava_test_install command
-
+testcases = [tc.strip() for tc in testplan.split(',')]
+regex = re.compile("(?P<testcase>^\w+)(\((?P<options>[^\)]+)\))?"\
+ "(:(?P<timeout>\d+))?")
+
+# Dict for lava_test_install
 lava_test_install_command = {}
 lava_test_install_command["command"] = "lava_test_install"
 lava_test_install_command["parameters"] = { "tests" : [], "timeout" : 4000 }

-# where in the template dict we shall insert test commands
+# The positions in the template dict to insert test install/run commands
 install_cmd_pos = 1
 run_cmd_pos = 2

 for testcase in testcases:
     r = regex.search(testcase)
- lava_test_install_command["parameters"]["tests"].append(r.group("testcase"))
-
- # append lava_test_run commands
- timeout = 4800
- if r.group('timeout'):
- timeout = r.group('timeout')
-
- lava_test_run_command = {}
- lava_test_run_command["command"] = "lava_test_run"
- lava_test_run_command["parameters"] = { "test_name" : r.group('testcase'),
- "timeout" : timeout }
-
- if r.group("options"):
- lava_test_run_command["parameters"]["test_options"] = r.group("options")
-
- template['actions'].insert(run_cmd_pos, lava_test_run_command)
- run_cmd_pos = run_cmd_pos + 1
+ if r.group("testcase") != None:
+ lava_test_install_command["parameters"]["tests"].\
+ append(r.group("testcase"))
+
+ # append lava_test_run commands
+ timeout = 4800
+ if r.group('timeout'):
+ timeout = r.group('timeout')
+
+ lava_test_run_command = {}
+ lava_test_run_command["command"] = "lava_test_run"
+ lava_test_run_command["parameters"] = {"test_name" : r.group('testcase'),
+ ...

Read more...

review: Needs Fixing
64. By Le Chi Thu <email address hidden> <email address hidden>

Updated after review 3

Revision history for this message
Le Chi Thu (le-chi-thu) :
review: Needs Resubmitting
Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

The changes looks ok. Thanks a lot.

review: Needs Fixing
Revision history for this message
Deepti B. Kalakeri (deeptik) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'get_latest_ci_hwpack'
2--- get_latest_ci_hwpack 2012-04-04 12:14:43 +0000
3+++ get_latest_ci_hwpack 2012-05-14 10:48:21 +0000
4@@ -5,6 +5,7 @@
5
6 Usage: ./gentemplate <target> <hwpack_type> <image_type>
7 """
8+import re
9
10 from find_latest import find_latest_hwpack, find_latest_rootfs, find_ci_latest
11 import json
12@@ -15,8 +16,7 @@
13 job_name = os.getenv("KERNEL_JOB_NAME", "unknown") + '_' + \
14 os.getenv("HWPACK_BUILD_DATE", "unknown") + '_daily test'
15
16-
17-
18+testplan = os.getenv("LAVA_TEST_PLAN", "ltp, pwrmgmt")
19
20 template = {
21 "timeout": 20000,
22@@ -25,36 +25,9 @@
23 "command": "deploy_linaro_image"
24 },
25 {
26- "command": "lava_test_install",
27- "parameters":
28- {
29- "tests": [
30- "ltp",
31- "pwrmgmt"
32- ],
33- "timeout": 4000
34- }
35- },
36- {
37 "command": "boot_linaro_image"
38 },
39 {
40- "command": "lava_test_run",
41- "parameters":
42- {
43- "test_name": "ltp",
44- "timeout": 4800
45- }
46- },
47- {
48- "command": "lava_test_run",
49- "parameters":
50- {
51- "test_name": "pwrmgmt",
52- "timeout": 4800
53- }
54- },
55- {
56 "command": "submit_results",
57 "parameters": {
58 "stream": os.getenv("BUNDLE_STREAM_NAME", "/anonymous/plars/"),
59@@ -63,7 +36,7 @@
60 }
61 ],
62 "job_name": job_name,
63- "device_type": os.getenv("BOARD_TYPE", "unknown")
64+ "device_type": os.getenv("BOARD_TYPE", "unknown")
65 }
66
67 url=os.getenv("JOB_URL", "http://snapshots.linaro.org/kernel-hwpack/")
68@@ -71,7 +44,8 @@
69 hwpack_dir_url=os.getenv("KERNEL_JOB_NAME", "unknown")
70 hwpack_url_path = os.path.join(url, hwpack_parent_url)
71 hwpack_url_path = os.path.join(hwpack_url_path, hwpack_dir_url)
72-hwpack_url = find_ci_latest(hwpack_url_path)
73+
74+hwpack_url = find_ci_latest(hwpack_url_path)
75 rootfs_id, rootfs_url = find_latest_rootfs(imagetype)
76
77 deploy_params = { 'hwpack':hwpack_url, 'rootfs':rootfs_url }
78@@ -92,13 +66,48 @@
79 metadata['kernel.git_log_info'] = os.getenv("GIT_LOG", "unknown")
80 metadata['hwpack.type'] = hwpacktype
81 metadata['hwpack.date'] = hwpackdate
82-
83-
84 rootfsdate, rootfsbuild = rootfs_id.split('.')
85 metadata['rootfs.type'] = imagetype
86 metadata['rootfs.date'] = rootfsdate
87 metadata['rootfs.build'] = rootfsbuild
88-
89 template['actions'][0]['metadata'] = metadata
90
91+testcases = testplan.split(',')
92+testcases = [tc.strip() for tc in testplan.split(',')]
93+regex = re.compile("(?P<testcase>^\w+)(\((?P<options>[^\)]+)\))?"\
94+ "(:(?P<timeout>\d+))?")
95+
96+# Dict for lava_test_install
97+lava_test_install_command = {}
98+lava_test_install_command["command"] = "lava_test_install"
99+lava_test_install_command["parameters"] = { "tests" : [], "timeout" : 4000 }
100+
101+# The positions in the template dict to insert test install/run commands
102+install_cmd_pos = 1
103+run_cmd_pos = 2
104+
105+for testcase in testcases:
106+ r = regex.search(testcase)
107+ if r.group("testcase") != None:
108+ lava_test_install_command["parameters"]["tests"].\
109+ append(r.group("testcase"))
110+
111+ # append lava_test_run commands
112+ timeout = 4800
113+ if r.group('timeout'):
114+ timeout = r.group('timeout')
115+
116+ lava_test_run_command = {}
117+ lava_test_run_command["command"] = "lava_test_run"
118+ lava_test_run_command["parameters"] = {"test_name" : r.group('testcase'),
119+ "timeout" : timeout }
120+
121+ if r.group("options"):
122+ lava_test_run_command["parameters"]["test_options"] = r.group("options")
123+
124+ template['actions'].insert(run_cmd_pos, lava_test_run_command)
125+ run_cmd_pos = run_cmd_pos + 1
126+
127+# append the lava test install command
128+template['actions'].insert(install_cmd_pos, lava_test_install_command)
129 print json.dumps(template, indent=2)

Subscribers

People subscribed via source and target branches