Merge lp:~le-chi-thu/lava-dispatcher/out-of-tree-tests into lp:lava-dispatcher

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
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+72034@code.launchpad.net
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+{
6+ "job_name": "foo",
7+ "target": "panda01",
8+ "timeout": 18000,
9+ "actions": [
10+ {
11+ "command": "deploy_linaro_image",
12+ "parameters":
13+ {
14+ "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+ "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+ }
17+ },
18+ {
19+ "command": "add_apt_repository",
20+ "parameters":
21+ {
22+ "arg": ["ppa:linaro-graphics-wg/ppa"]
23+ }
24+ },
25+ {
26+ "command": "lava_test_install",
27+ "parameters":
28+ {
29+ "tests": ["glcompbench"],
30+ "oot_test_container": "bzr+http//:bazaar.launchpad.net/~linaro-graphics-wg/+junk/linaro-graphics-wg-tests/#egg=linaro-graphics-wg-tests"
31+ }
32+ },
33+ {
34+ "command": "boot_linaro_image"
35+ },
36+ {
37+ "command": "lava_test_run",
38+ "parameters":
39+ {
40+ "test_name": "glcompbench"
41+ }
42+ },
43+ {
44+ "command": "submit_results",
45+ "parameters":
46+ {
47+ "server": "http://validation.linaro.org/launch-control",
48+ "stream": "/anonymous/panda01-tesing/"
49+ }
50+ }
51+ ]
52+}
53
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+{
59+ "job_name": "foo",
60+ "target": "panda01",
61+ "timeout": 18000,
62+ "actions": [
63+ {
64+ "command": "deploy_linaro_image",
65+ "parameters":
66+ {
67+ "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+ "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+ }
70+ },
71+ {
72+ "command": "lava_test_install",
73+ "parameters":
74+ {
75+ "tests": ["linaro.pmwg"],
76+ "oot_test_def_urls": ["http://bazaar.launchpad.net/~linaro-validation/lava-test/trunk/download/head:/powermanagementtests-20110628125042-dnw8hkhbce7pqi0y-2/power-management-tests.json"]
77+ }
78+ },
79+ {
80+ "command": "boot_linaro_image"
81+ },
82+ {
83+ "command": "lava_test_run",
84+ "parameters":
85+ {
86+ "test_name": "linaro.pmwg"
87+ }
88+ },
89+ {
90+ "command": "submit_results",
91+ "parameters":
92+ {
93+ "server": "http://validation.linaro.org/launch-control",
94+ "stream": "/anonymous/panda01-testing/"
95+ }
96+ }
97+ ]
98+}
99
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 from lava_dispatcher.client import OperationFailed
105 from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR
106
107+def _setup_testrootfs(client):
108+ #Make sure in master image
109+ #, or exception can be caught and do boot_master_image()
110+ try:
111+ client.in_master_shell()
112+ except:
113+ client.boot_master_image()
114+
115+ client.run_shell_command(
116+ 'mkdir -p /mnt/root',
117+ response=MASTER_STR)
118+ client.run_shell_command(
119+ 'mount /dev/disk/by-label/testrootfs /mnt/root',
120+ response=MASTER_STR)
121+ client.run_shell_command(
122+ 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak',
123+ response=MASTER_STR)
124+ client.run_shell_command(
125+ 'cp -L /etc/resolv.conf /mnt/root/etc',
126+ response=MASTER_STR)
127+ #eliminate warning: Can not write log, openpty() failed
128+ # (/dev/pts not mounted?), does not work
129+ client.run_shell_command(
130+ 'mount --rbind /dev /mnt/root/dev',
131+ response=MASTER_STR)
132+
133+def _teardown_testrootfs(client):
134+ client.run_shell_command(
135+ 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf',
136+ response=MASTER_STR)
137+ cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'
138+ '| sort -r | xargs umount')
139+ client.run_shell_command(
140+ cmd,
141+ response=MASTER_STR)
142+ client.run_shell_command(
143+ 'umount /mnt/root',
144+ response=MASTER_STR)
145+
146+def _install_lava_test(client):
147+ #install bazaar in tester image
148+ client.run_shell_command(
149+ 'chroot /mnt/root apt-get update',
150+ response=MASTER_STR)
151+ #Install necessary packages for build lava-test
152+ cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt '
153+ 'python-setuptools python-simplejson lsb-release')
154+ client.run_shell_command(
155+ cmd,
156+ response=MASTER_STR, timeout=2400)
157+ client.run_shell_command(
158+ 'chroot /mnt/root bzr branch lp:lava-test',
159+ response=MASTER_STR)
160+ client.run_shell_command(
161+ 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"',
162+ response=MASTER_STR)
163+
164+ #Test if lava-test installed
165+ try:
166+ client.run_shell_command(
167+ 'chroot /mnt/root lava-test help',
168+ response="list-test", timeout=10)
169+ except:
170+ tb = traceback.format_exc()
171+ client.sio.write(tb)
172+ _teardown_testrootfs(client)
173+ raise OperationFailed("lava-test deployment failed")
174
175 class cmd_lava_test_run(BaseAction):
176 def run(self, test_name, timeout=-1):
177@@ -47,75 +114,45 @@
178 """
179 lava-test deployment to test image rootfs by chroot
180 """
181- def run(self, tests, timeout=2400):
182+ def run(self, tests, oot_test_container = None,oot_test_def_urls = None, timeout=2400):
183 client = self.client
184- #Make sure in master image
185- #, or exception can be caught and do boot_master_image()
186- try:
187- client.in_master_shell()
188- except:
189- client.boot_master_image()
190-
191- #install bazaar in tester image
192- client.run_shell_command(
193- 'mkdir -p /mnt/root',
194- response=MASTER_STR)
195- client.run_shell_command(
196- 'mount /dev/disk/by-label/testrootfs /mnt/root',
197- response=MASTER_STR)
198- client.run_shell_command(
199- 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak',
200- response=MASTER_STR)
201- client.run_shell_command(
202- 'cp -L /etc/resolv.conf /mnt/root/etc',
203- response=MASTER_STR)
204- #eliminate warning: Can not write log, openpty() failed
205- # (/dev/pts not mounted?), does not work
206- client.run_shell_command(
207- 'mount --rbind /dev /mnt/root/dev',
208- response=MASTER_STR)
209- client.run_shell_command(
210- 'chroot /mnt/root apt-get update',
211- response=MASTER_STR)
212- #Install necessary packages for build lava-test
213- cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt '
214- 'python-setuptools python-simplejson lsb-release')
215- client.run_shell_command(
216- cmd,
217- response=MASTER_STR, timeout=2400)
218- client.run_shell_command(
219- 'chroot /mnt/root bzr branch lp:lava-test',
220- response=MASTER_STR)
221- client.run_shell_command(
222- 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"',
223- response=MASTER_STR)
224-
225- #Test if lava-test installed
226- try:
227- client.run_shell_command(
228- 'chroot /mnt/root lava-test help',
229- response="list-tests", timeout=10)
230- except:
231- tb = traceback.format_exc()
232- client.sio.write(tb)
233- raise OperationFailed("lava-test deployment failed")
234+
235+ _setup_testrootfs(client)
236+ _install_lava_test(client)
237+
238+ if oot_test_container:
239+ client.run_shell_command("chroot /mnt/root apt-get -y install python-pip", response=MASTER_STR)
240+ client.run_shell_command("chroot /mnt/root pip -e " + oot_test_container, response=MASTER_STR)
241+
242+ if oot_test_def_urls:
243+ for test_def_url in oot_test_def_urls:
244+ client.run_shell_command('chroot /mnt/root lava-test register-test ' + test_def_url, response=MASTER_STR)
245
246 for test in tests:
247 client.run_shell_command(
248 'chroot /mnt/root lava-test install %s' % test,
249 response=MASTER_STR)
250- #clean up
251- client.run_shell_command(
252- 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf',
253- response=MASTER_STR)
254- client.run_shell_command(
255- 'rm -rf /mnt/root/lava-test',
256- response=MASTER_STR)
257- cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'
258- '| sort -r | xargs umount')
259- client.run_shell_command(
260- cmd,
261- response=MASTER_STR)
262- client.run_shell_command(
263- 'umount /mnt/root',
264- response=MASTER_STR)
265+
266+ client.run_shell_command('rm -rf /mnt/root/lava-test', response=MASTER_STR)
267+
268+ _teardown_testrootfs(client)
269+
270+class cmd_add_apt_repository(BaseAction):
271+ """
272+ add apt repository to test image rootfs by chroot
273+ arg could be 'deb uri distribution [component1] [component2][...]' or ppm:<ppa_name>
274+ """
275+ def run(self, arg):
276+ client = self.client
277+ _setup_testrootfs(client)
278+
279+ #install add-apt-repository
280+ client.run_shell_command('chroot /mnt/root apt-get -y install python-software-properties',response=MASTER_STR)
281+
282+ #add ppa
283+ client.run_shell_command('chroot /mnt/root add-apt-repository ' + arg[0], response=MASTER_STR)
284+ client.run_shell_command('chroot /mnt/root apt-get update', response=MASTER_STR)
285+
286+ _teardown_testrootfs(client)
287+
288+

Subscribers

People subscribed via source and target branches