Merge lp:~le-chi-thu/lava-dispatcher/out-of-tree-tests into lp:lava-dispatcher
- out-of-tree-tests
- Merge into trunk
Proposed by
Le Chi Thu
Status: | Merged |
---|---|
Merged at revision: | 89 |
Proposed branch: | lp:~le-chi-thu/lava-dispatcher/out-of-tree-tests |
Merge into: | lp:lava-dispatcher |
Diff against target: |
288 lines (+192/-66) 3 files modified
doc/lava-out-of-tree-test-1.json (+48/-0) doc/lava-out-of-tree-test-2.json (+41/-0) lava_dispatcher/actions/lava-test.py (+103/-66) |
To merge this branch: | bzr merge lp:~le-chi-thu/lava-dispatcher/out-of-tree-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Linaro Validation Team | Pending | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'doc/lava-out-of-tree-test-1.json' | |||
2 | --- doc/lava-out-of-tree-test-1.json 1970-01-01 00:00:00 +0000 | |||
3 | +++ doc/lava-out-of-tree-test-1.json 2011-08-18 13:10:28 +0000 | |||
4 | @@ -0,0 +1,48 @@ | |||
5 | 1 | { | ||
6 | 2 | "job_name": "foo", | ||
7 | 3 | "target": "panda01", | ||
8 | 4 | "timeout": 18000, | ||
9 | 5 | "actions": [ | ||
10 | 6 | { | ||
11 | 7 | "command": "deploy_linaro_image", | ||
12 | 8 | "parameters": | ||
13 | 9 | { | ||
14 | 10 | "rootfs": "http://snapshots.linaro.org/11.05-daily/linaro-ubuntu-desktop/20110814/0/images/tar/linaro-n-ubuntu-desktop-tar-20110814-0.tar.gz", | ||
15 | 11 | "hwpack": "http://snapshots.linaro.org/11.05-daily/linaro-hwpacks/panda/20110814/0/images/hwpack/hwpack_linaro-panda_20110814-0_armel_supported.tar.gz" | ||
16 | 12 | } | ||
17 | 13 | }, | ||
18 | 14 | { | ||
19 | 15 | "command": "add_apt_repository", | ||
20 | 16 | "parameters": | ||
21 | 17 | { | ||
22 | 18 | "arg": ["ppa:linaro-graphics-wg/ppa"] | ||
23 | 19 | } | ||
24 | 20 | }, | ||
25 | 21 | { | ||
26 | 22 | "command": "lava_test_install", | ||
27 | 23 | "parameters": | ||
28 | 24 | { | ||
29 | 25 | "tests": ["glcompbench"], | ||
30 | 26 | "oot_test_container": "bzr+http//:bazaar.launchpad.net/~linaro-graphics-wg/+junk/linaro-graphics-wg-tests/#egg=linaro-graphics-wg-tests" | ||
31 | 27 | } | ||
32 | 28 | }, | ||
33 | 29 | { | ||
34 | 30 | "command": "boot_linaro_image" | ||
35 | 31 | }, | ||
36 | 32 | { | ||
37 | 33 | "command": "lava_test_run", | ||
38 | 34 | "parameters": | ||
39 | 35 | { | ||
40 | 36 | "test_name": "glcompbench" | ||
41 | 37 | } | ||
42 | 38 | }, | ||
43 | 39 | { | ||
44 | 40 | "command": "submit_results", | ||
45 | 41 | "parameters": | ||
46 | 42 | { | ||
47 | 43 | "server": "http://validation.linaro.org/launch-control", | ||
48 | 44 | "stream": "/anonymous/panda01-tesing/" | ||
49 | 45 | } | ||
50 | 46 | } | ||
51 | 47 | ] | ||
52 | 48 | } | ||
53 | 0 | 49 | ||
54 | === added file 'doc/lava-out-of-tree-test-2.json' | |||
55 | --- doc/lava-out-of-tree-test-2.json 1970-01-01 00:00:00 +0000 | |||
56 | +++ doc/lava-out-of-tree-test-2.json 2011-08-18 13:10:28 +0000 | |||
57 | @@ -0,0 +1,41 @@ | |||
58 | 1 | { | ||
59 | 2 | "job_name": "foo", | ||
60 | 3 | "target": "panda01", | ||
61 | 4 | "timeout": 18000, | ||
62 | 5 | "actions": [ | ||
63 | 6 | { | ||
64 | 7 | "command": "deploy_linaro_image", | ||
65 | 8 | "parameters": | ||
66 | 9 | { | ||
67 | 10 | "rootfs": "http://snapshots.linaro.org/11.05-daily/linaro-ubuntu-desktop/20110814/0/images/tar/linaro-n-ubuntu-desktop-tar-20110814-0.tar.gz", | ||
68 | 11 | "hwpack": "http://snapshots.linaro.org/11.05-daily/linaro-hwpacks/panda/20110814/0/images/hwpack/hwpack_linaro-panda_20110814-0_armel_supported.tar.gz" | ||
69 | 12 | } | ||
70 | 13 | }, | ||
71 | 14 | { | ||
72 | 15 | "command": "lava_test_install", | ||
73 | 16 | "parameters": | ||
74 | 17 | { | ||
75 | 18 | "tests": ["linaro.pmwg"], | ||
76 | 19 | "oot_test_def_urls": ["http://bazaar.launchpad.net/~linaro-validation/lava-test/trunk/download/head:/powermanagementtests-20110628125042-dnw8hkhbce7pqi0y-2/power-management-tests.json"] | ||
77 | 20 | } | ||
78 | 21 | }, | ||
79 | 22 | { | ||
80 | 23 | "command": "boot_linaro_image" | ||
81 | 24 | }, | ||
82 | 25 | { | ||
83 | 26 | "command": "lava_test_run", | ||
84 | 27 | "parameters": | ||
85 | 28 | { | ||
86 | 29 | "test_name": "linaro.pmwg" | ||
87 | 30 | } | ||
88 | 31 | }, | ||
89 | 32 | { | ||
90 | 33 | "command": "submit_results", | ||
91 | 34 | "parameters": | ||
92 | 35 | { | ||
93 | 36 | "server": "http://validation.linaro.org/launch-control", | ||
94 | 37 | "stream": "/anonymous/panda01-testing/" | ||
95 | 38 | } | ||
96 | 39 | } | ||
97 | 40 | ] | ||
98 | 41 | } | ||
99 | 0 | 42 | ||
100 | === modified file 'lava_dispatcher/actions/lava-test.py' | |||
101 | --- lava_dispatcher/actions/lava-test.py 2011-08-04 07:19:53 +0000 | |||
102 | +++ lava_dispatcher/actions/lava-test.py 2011-08-18 13:10:28 +0000 | |||
103 | @@ -27,6 +27,73 @@ | |||
104 | 27 | from lava_dispatcher.client import OperationFailed | 27 | from lava_dispatcher.client import OperationFailed |
105 | 28 | from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR | 28 | from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR |
106 | 29 | 29 | ||
107 | 30 | def _setup_testrootfs(client): | ||
108 | 31 | #Make sure in master image | ||
109 | 32 | #, or exception can be caught and do boot_master_image() | ||
110 | 33 | try: | ||
111 | 34 | client.in_master_shell() | ||
112 | 35 | except: | ||
113 | 36 | client.boot_master_image() | ||
114 | 37 | |||
115 | 38 | client.run_shell_command( | ||
116 | 39 | 'mkdir -p /mnt/root', | ||
117 | 40 | response=MASTER_STR) | ||
118 | 41 | client.run_shell_command( | ||
119 | 42 | 'mount /dev/disk/by-label/testrootfs /mnt/root', | ||
120 | 43 | response=MASTER_STR) | ||
121 | 44 | client.run_shell_command( | ||
122 | 45 | 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak', | ||
123 | 46 | response=MASTER_STR) | ||
124 | 47 | client.run_shell_command( | ||
125 | 48 | 'cp -L /etc/resolv.conf /mnt/root/etc', | ||
126 | 49 | response=MASTER_STR) | ||
127 | 50 | #eliminate warning: Can not write log, openpty() failed | ||
128 | 51 | # (/dev/pts not mounted?), does not work | ||
129 | 52 | client.run_shell_command( | ||
130 | 53 | 'mount --rbind /dev /mnt/root/dev', | ||
131 | 54 | response=MASTER_STR) | ||
132 | 55 | |||
133 | 56 | def _teardown_testrootfs(client): | ||
134 | 57 | client.run_shell_command( | ||
135 | 58 | 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf', | ||
136 | 59 | response=MASTER_STR) | ||
137 | 60 | cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"' | ||
138 | 61 | '| sort -r | xargs umount') | ||
139 | 62 | client.run_shell_command( | ||
140 | 63 | cmd, | ||
141 | 64 | response=MASTER_STR) | ||
142 | 65 | client.run_shell_command( | ||
143 | 66 | 'umount /mnt/root', | ||
144 | 67 | response=MASTER_STR) | ||
145 | 68 | |||
146 | 69 | def _install_lava_test(client): | ||
147 | 70 | #install bazaar in tester image | ||
148 | 71 | client.run_shell_command( | ||
149 | 72 | 'chroot /mnt/root apt-get update', | ||
150 | 73 | response=MASTER_STR) | ||
151 | 74 | #Install necessary packages for build lava-test | ||
152 | 75 | cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt ' | ||
153 | 76 | 'python-setuptools python-simplejson lsb-release') | ||
154 | 77 | client.run_shell_command( | ||
155 | 78 | cmd, | ||
156 | 79 | response=MASTER_STR, timeout=2400) | ||
157 | 80 | client.run_shell_command( | ||
158 | 81 | 'chroot /mnt/root bzr branch lp:lava-test', | ||
159 | 82 | response=MASTER_STR) | ||
160 | 83 | client.run_shell_command( | ||
161 | 84 | 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"', | ||
162 | 85 | response=MASTER_STR) | ||
163 | 86 | |||
164 | 87 | #Test if lava-test installed | ||
165 | 88 | try: | ||
166 | 89 | client.run_shell_command( | ||
167 | 90 | 'chroot /mnt/root lava-test help', | ||
168 | 91 | response="list-test", timeout=10) | ||
169 | 92 | except: | ||
170 | 93 | tb = traceback.format_exc() | ||
171 | 94 | client.sio.write(tb) | ||
172 | 95 | _teardown_testrootfs(client) | ||
173 | 96 | raise OperationFailed("lava-test deployment failed") | ||
174 | 30 | 97 | ||
175 | 31 | class cmd_lava_test_run(BaseAction): | 98 | class cmd_lava_test_run(BaseAction): |
176 | 32 | def run(self, test_name, timeout=-1): | 99 | def run(self, test_name, timeout=-1): |
177 | @@ -47,75 +114,45 @@ | |||
178 | 47 | """ | 114 | """ |
179 | 48 | lava-test deployment to test image rootfs by chroot | 115 | lava-test deployment to test image rootfs by chroot |
180 | 49 | """ | 116 | """ |
182 | 50 | def run(self, tests, timeout=2400): | 117 | def run(self, tests, oot_test_container = None,oot_test_def_urls = None, timeout=2400): |
183 | 51 | client = self.client | 118 | client = self.client |
234 | 52 | #Make sure in master image | 119 | |
235 | 53 | #, or exception can be caught and do boot_master_image() | 120 | _setup_testrootfs(client) |
236 | 54 | try: | 121 | _install_lava_test(client) |
237 | 55 | client.in_master_shell() | 122 | |
238 | 56 | except: | 123 | if oot_test_container: |
239 | 57 | client.boot_master_image() | 124 | client.run_shell_command("chroot /mnt/root apt-get -y install python-pip", response=MASTER_STR) |
240 | 58 | 125 | client.run_shell_command("chroot /mnt/root pip -e " + oot_test_container, response=MASTER_STR) | |
241 | 59 | #install bazaar in tester image | 126 | |
242 | 60 | client.run_shell_command( | 127 | if oot_test_def_urls: |
243 | 61 | 'mkdir -p /mnt/root', | 128 | for test_def_url in oot_test_def_urls: |
244 | 62 | response=MASTER_STR) | 129 | client.run_shell_command('chroot /mnt/root lava-test register-test ' + test_def_url, response=MASTER_STR) |
195 | 63 | client.run_shell_command( | ||
196 | 64 | 'mount /dev/disk/by-label/testrootfs /mnt/root', | ||
197 | 65 | response=MASTER_STR) | ||
198 | 66 | client.run_shell_command( | ||
199 | 67 | 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak', | ||
200 | 68 | response=MASTER_STR) | ||
201 | 69 | client.run_shell_command( | ||
202 | 70 | 'cp -L /etc/resolv.conf /mnt/root/etc', | ||
203 | 71 | response=MASTER_STR) | ||
204 | 72 | #eliminate warning: Can not write log, openpty() failed | ||
205 | 73 | # (/dev/pts not mounted?), does not work | ||
206 | 74 | client.run_shell_command( | ||
207 | 75 | 'mount --rbind /dev /mnt/root/dev', | ||
208 | 76 | response=MASTER_STR) | ||
209 | 77 | client.run_shell_command( | ||
210 | 78 | 'chroot /mnt/root apt-get update', | ||
211 | 79 | response=MASTER_STR) | ||
212 | 80 | #Install necessary packages for build lava-test | ||
213 | 81 | cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt ' | ||
214 | 82 | 'python-setuptools python-simplejson lsb-release') | ||
215 | 83 | client.run_shell_command( | ||
216 | 84 | cmd, | ||
217 | 85 | response=MASTER_STR, timeout=2400) | ||
218 | 86 | client.run_shell_command( | ||
219 | 87 | 'chroot /mnt/root bzr branch lp:lava-test', | ||
220 | 88 | response=MASTER_STR) | ||
221 | 89 | client.run_shell_command( | ||
222 | 90 | 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"', | ||
223 | 91 | response=MASTER_STR) | ||
224 | 92 | |||
225 | 93 | #Test if lava-test installed | ||
226 | 94 | try: | ||
227 | 95 | client.run_shell_command( | ||
228 | 96 | 'chroot /mnt/root lava-test help', | ||
229 | 97 | response="list-tests", timeout=10) | ||
230 | 98 | except: | ||
231 | 99 | tb = traceback.format_exc() | ||
232 | 100 | client.sio.write(tb) | ||
233 | 101 | raise OperationFailed("lava-test deployment failed") | ||
245 | 102 | 130 | ||
246 | 103 | for test in tests: | 131 | for test in tests: |
247 | 104 | client.run_shell_command( | 132 | client.run_shell_command( |
248 | 105 | 'chroot /mnt/root lava-test install %s' % test, | 133 | 'chroot /mnt/root lava-test install %s' % test, |
249 | 106 | response=MASTER_STR) | 134 | response=MASTER_STR) |
265 | 107 | #clean up | 135 | |
266 | 108 | client.run_shell_command( | 136 | client.run_shell_command('rm -rf /mnt/root/lava-test', response=MASTER_STR) |
267 | 109 | 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf', | 137 | |
268 | 110 | response=MASTER_STR) | 138 | _teardown_testrootfs(client) |
269 | 111 | client.run_shell_command( | 139 | |
270 | 112 | 'rm -rf /mnt/root/lava-test', | 140 | class cmd_add_apt_repository(BaseAction): |
271 | 113 | response=MASTER_STR) | 141 | """ |
272 | 114 | cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"' | 142 | add apt repository to test image rootfs by chroot |
273 | 115 | '| sort -r | xargs umount') | 143 | arg could be 'deb uri distribution [component1] [component2][...]' or ppm:<ppa_name> |
274 | 116 | client.run_shell_command( | 144 | """ |
275 | 117 | cmd, | 145 | def run(self, arg): |
276 | 118 | response=MASTER_STR) | 146 | client = self.client |
277 | 119 | client.run_shell_command( | 147 | _setup_testrootfs(client) |
278 | 120 | 'umount /mnt/root', | 148 | |
279 | 121 | response=MASTER_STR) | 149 | #install add-apt-repository |
280 | 150 | client.run_shell_command('chroot /mnt/root apt-get -y install python-software-properties',response=MASTER_STR) | ||
281 | 151 | |||
282 | 152 | #add ppa | ||
283 | 153 | client.run_shell_command('chroot /mnt/root add-apt-repository ' + arg[0], response=MASTER_STR) | ||
284 | 154 | client.run_shell_command('chroot /mnt/root apt-get update', response=MASTER_STR) | ||
285 | 155 | |||
286 | 156 | _teardown_testrootfs(client) | ||
287 | 157 | |||
288 | 158 |