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
=== added file 'doc/lava-out-of-tree-test-1.json'
--- doc/lava-out-of-tree-test-1.json 1970-01-01 00:00:00 +0000
+++ doc/lava-out-of-tree-test-1.json 2011-08-18 13:10:28 +0000
@@ -0,0 +1,48 @@
1{
2 "job_name": "foo",
3 "target": "panda01",
4 "timeout": 18000,
5 "actions": [
6 {
7 "command": "deploy_linaro_image",
8 "parameters":
9 {
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",
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"
12 }
13 },
14 {
15 "command": "add_apt_repository",
16 "parameters":
17 {
18 "arg": ["ppa:linaro-graphics-wg/ppa"]
19 }
20 },
21 {
22 "command": "lava_test_install",
23 "parameters":
24 {
25 "tests": ["glcompbench"],
26 "oot_test_container": "bzr+http//:bazaar.launchpad.net/~linaro-graphics-wg/+junk/linaro-graphics-wg-tests/#egg=linaro-graphics-wg-tests"
27 }
28 },
29 {
30 "command": "boot_linaro_image"
31 },
32 {
33 "command": "lava_test_run",
34 "parameters":
35 {
36 "test_name": "glcompbench"
37 }
38 },
39 {
40 "command": "submit_results",
41 "parameters":
42 {
43 "server": "http://validation.linaro.org/launch-control",
44 "stream": "/anonymous/panda01-tesing/"
45 }
46 }
47 ]
48}
049
=== added file 'doc/lava-out-of-tree-test-2.json'
--- doc/lava-out-of-tree-test-2.json 1970-01-01 00:00:00 +0000
+++ doc/lava-out-of-tree-test-2.json 2011-08-18 13:10:28 +0000
@@ -0,0 +1,41 @@
1{
2 "job_name": "foo",
3 "target": "panda01",
4 "timeout": 18000,
5 "actions": [
6 {
7 "command": "deploy_linaro_image",
8 "parameters":
9 {
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",
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"
12 }
13 },
14 {
15 "command": "lava_test_install",
16 "parameters":
17 {
18 "tests": ["linaro.pmwg"],
19 "oot_test_def_urls": ["http://bazaar.launchpad.net/~linaro-validation/lava-test/trunk/download/head:/powermanagementtests-20110628125042-dnw8hkhbce7pqi0y-2/power-management-tests.json"]
20 }
21 },
22 {
23 "command": "boot_linaro_image"
24 },
25 {
26 "command": "lava_test_run",
27 "parameters":
28 {
29 "test_name": "linaro.pmwg"
30 }
31 },
32 {
33 "command": "submit_results",
34 "parameters":
35 {
36 "server": "http://validation.linaro.org/launch-control",
37 "stream": "/anonymous/panda01-testing/"
38 }
39 }
40 ]
41}
042
=== modified file 'lava_dispatcher/actions/lava-test.py'
--- lava_dispatcher/actions/lava-test.py 2011-08-04 07:19:53 +0000
+++ lava_dispatcher/actions/lava-test.py 2011-08-18 13:10:28 +0000
@@ -27,6 +27,73 @@
27from lava_dispatcher.client import OperationFailed27from lava_dispatcher.client import OperationFailed
28from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR28from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR
2929
30def _setup_testrootfs(client):
31 #Make sure in master image
32 #, or exception can be caught and do boot_master_image()
33 try:
34 client.in_master_shell()
35 except:
36 client.boot_master_image()
37
38 client.run_shell_command(
39 'mkdir -p /mnt/root',
40 response=MASTER_STR)
41 client.run_shell_command(
42 'mount /dev/disk/by-label/testrootfs /mnt/root',
43 response=MASTER_STR)
44 client.run_shell_command(
45 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak',
46 response=MASTER_STR)
47 client.run_shell_command(
48 'cp -L /etc/resolv.conf /mnt/root/etc',
49 response=MASTER_STR)
50 #eliminate warning: Can not write log, openpty() failed
51 # (/dev/pts not mounted?), does not work
52 client.run_shell_command(
53 'mount --rbind /dev /mnt/root/dev',
54 response=MASTER_STR)
55
56def _teardown_testrootfs(client):
57 client.run_shell_command(
58 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf',
59 response=MASTER_STR)
60 cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'
61 '| sort -r | xargs umount')
62 client.run_shell_command(
63 cmd,
64 response=MASTER_STR)
65 client.run_shell_command(
66 'umount /mnt/root',
67 response=MASTER_STR)
68
69def _install_lava_test(client):
70 #install bazaar in tester image
71 client.run_shell_command(
72 'chroot /mnt/root apt-get update',
73 response=MASTER_STR)
74 #Install necessary packages for build lava-test
75 cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt '
76 'python-setuptools python-simplejson lsb-release')
77 client.run_shell_command(
78 cmd,
79 response=MASTER_STR, timeout=2400)
80 client.run_shell_command(
81 'chroot /mnt/root bzr branch lp:lava-test',
82 response=MASTER_STR)
83 client.run_shell_command(
84 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"',
85 response=MASTER_STR)
86
87 #Test if lava-test installed
88 try:
89 client.run_shell_command(
90 'chroot /mnt/root lava-test help',
91 response="list-test", timeout=10)
92 except:
93 tb = traceback.format_exc()
94 client.sio.write(tb)
95 _teardown_testrootfs(client)
96 raise OperationFailed("lava-test deployment failed")
3097
31class cmd_lava_test_run(BaseAction):98class cmd_lava_test_run(BaseAction):
32 def run(self, test_name, timeout=-1):99 def run(self, test_name, timeout=-1):
@@ -47,75 +114,45 @@
47 """114 """
48 lava-test deployment to test image rootfs by chroot115 lava-test deployment to test image rootfs by chroot
49 """116 """
50 def run(self, tests, timeout=2400):117 def run(self, tests, oot_test_container = None,oot_test_def_urls = None, timeout=2400):
51 client = self.client118 client = self.client
52 #Make sure in master image119
53 #, or exception can be caught and do boot_master_image()120 _setup_testrootfs(client)
54 try:121 _install_lava_test(client)
55 client.in_master_shell()122
56 except:123 if oot_test_container:
57 client.boot_master_image()124 client.run_shell_command("chroot /mnt/root apt-get -y install python-pip", response=MASTER_STR)
58125 client.run_shell_command("chroot /mnt/root pip -e " + oot_test_container, response=MASTER_STR)
59 #install bazaar in tester image126
60 client.run_shell_command(127 if oot_test_def_urls:
61 'mkdir -p /mnt/root',128 for test_def_url in oot_test_def_urls:
62 response=MASTER_STR)129 client.run_shell_command('chroot /mnt/root lava-test register-test ' + test_def_url, response=MASTER_STR)
63 client.run_shell_command(
64 'mount /dev/disk/by-label/testrootfs /mnt/root',
65 response=MASTER_STR)
66 client.run_shell_command(
67 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak',
68 response=MASTER_STR)
69 client.run_shell_command(
70 'cp -L /etc/resolv.conf /mnt/root/etc',
71 response=MASTER_STR)
72 #eliminate warning: Can not write log, openpty() failed
73 # (/dev/pts not mounted?), does not work
74 client.run_shell_command(
75 'mount --rbind /dev /mnt/root/dev',
76 response=MASTER_STR)
77 client.run_shell_command(
78 'chroot /mnt/root apt-get update',
79 response=MASTER_STR)
80 #Install necessary packages for build lava-test
81 cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt '
82 'python-setuptools python-simplejson lsb-release')
83 client.run_shell_command(
84 cmd,
85 response=MASTER_STR, timeout=2400)
86 client.run_shell_command(
87 'chroot /mnt/root bzr branch lp:lava-test',
88 response=MASTER_STR)
89 client.run_shell_command(
90 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"',
91 response=MASTER_STR)
92
93 #Test if lava-test installed
94 try:
95 client.run_shell_command(
96 'chroot /mnt/root lava-test help',
97 response="list-tests", timeout=10)
98 except:
99 tb = traceback.format_exc()
100 client.sio.write(tb)
101 raise OperationFailed("lava-test deployment failed")
102130
103 for test in tests:131 for test in tests:
104 client.run_shell_command(132 client.run_shell_command(
105 'chroot /mnt/root lava-test install %s' % test,133 'chroot /mnt/root lava-test install %s' % test,
106 response=MASTER_STR)134 response=MASTER_STR)
107 #clean up135
108 client.run_shell_command(136 client.run_shell_command('rm -rf /mnt/root/lava-test', response=MASTER_STR)
109 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf',137
110 response=MASTER_STR)138 _teardown_testrootfs(client)
111 client.run_shell_command(139
112 'rm -rf /mnt/root/lava-test',140class cmd_add_apt_repository(BaseAction):
113 response=MASTER_STR)141 """
114 cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'142 add apt repository to test image rootfs by chroot
115 '| sort -r | xargs umount')143 arg could be 'deb uri distribution [component1] [component2][...]' or ppm:<ppa_name>
116 client.run_shell_command(144 """
117 cmd,145 def run(self, arg):
118 response=MASTER_STR)146 client = self.client
119 client.run_shell_command(147 _setup_testrootfs(client)
120 'umount /mnt/root',148
121 response=MASTER_STR)149 #install add-apt-repository
150 client.run_shell_command('chroot /mnt/root apt-get -y install python-software-properties',response=MASTER_STR)
151
152 #add ppa
153 client.run_shell_command('chroot /mnt/root add-apt-repository ' + arg[0], response=MASTER_STR)
154 client.run_shell_command('chroot /mnt/root apt-get update', response=MASTER_STR)
155
156 _teardown_testrootfs(client)
157
158

Subscribers

People subscribed via source and target branches