Merge lp:~mwhudson/lava-dispatcher/config-clients-merge into lp:lava-dispatcher

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 105
Proposed branch: lp:~mwhudson/lava-dispatcher/config-clients-merge
Merge into: lp:lava-dispatcher
Diff against target: 1191 lines (+446/-296)
24 files modified
.bzrignore (+3/-0)
MANIFEST.in (+2/-0)
lava_dispatcher/__init__.py (+36/-6)
lava_dispatcher/actions/android_basic.py (+2/-2)
lava_dispatcher/actions/android_deploy.py (+7/-4)
lava_dispatcher/actions/deploy.py (+10/-8)
lava_dispatcher/actions/launch_control.py (+39/-39)
lava_dispatcher/actions/lava-test.py (+7/-9)
lava_dispatcher/android_client.py (+7/-10)
lava_dispatcher/android_config.py (+0/-65)
lava_dispatcher/android_util.py (+3/-4)
lava_dispatcher/client.py (+50/-28)
lava_dispatcher/config.py (+69/-110)
lava_dispatcher/default-config/lava-dispatcher/README (+41/-0)
lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf (+50/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf (+20/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf (+10/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf (+9/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf (+19/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf (+12/-0)
lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf (+19/-0)
lava_dispatcher/tests/test_config.py (+9/-5)
lava_dispatcher/utils.py (+13/-6)
setup.py (+9/-0)
To merge this branch: bzr merge lp:~mwhudson/lava-dispatcher/config-clients-merge
Reviewer Review Type Date Requested Status
Paul Larson (community) Approve
Spring Zhang (community) Needs Fixing
Review via email: mp+74712@code.launchpad.net

Description of the change

Finally, ready enough for a review! I need to update some things in the doc/ directory, hopefully I'll get to that later today.

Reviewers should start by looking at the lava_scheduler/default-config directory. Is that what you would like the config files to look like? If not, please yell :-)

I'm more or less happy with the rest of the code. The config.py changes are rather hackish, but heck, they work.

I will prepare branches adding the qemu and ssh clients when I've managed to get them to work :-)

To post a comment you must log in.
Revision history for this message
Spring Zhang (qzhang) wrote :

156 - data_path = download_with_cache(data_url, tarball_dir)
157 + boot_path = download_with_cache(boot_url, tarball_dir, lava_cachedir)
But download_with_cache API seems no change.

review: Needs Fixing
Revision history for this message
Spring Zhang (qzhang) wrote :

> 156 - data_path = download_with_cache(data_url, tarball_dir)
> 157 + boot_path = download_with_cache(boot_url, tarball_dir,
> lava_cachedir)
> But download_with_cache API seems no change.
Sorry for mistake, it changes.

Revision history for this message
Paul Larson (pwlars) wrote :

Minor nitpick, let's rename "serial" as a client type to "conmux". I think that's more accurate, and opens the possibility of other serial clients in the future if we ever decide to dispense with conmux for some other solution.

Revision history for this message
Paul Larson (pwlars) wrote :

We should probably include an example device config file, or at least put a full example (since it's short) including hostname in the README

Revision history for this message
Paul Larson (pwlars) wrote :

Otherwise, looking good. Let's merge it so that we don't have this big merge looming over us still, and I know spring has some things he wants to merge too. Then we can start testing it and tweak it as needed with plenty of time to spare before the release :) Thanks for pulling this together!

Revision history for this message
Paul Larson (pwlars) :
review: Approve
Revision history for this message
Spring Zhang (qzhang) wrote :

i'll test it in my bug fixing branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-04-07 01:21:51 +0000
3+++ .bzrignore 2011-09-09 01:07:35 +0000
4@@ -3,3 +3,6 @@
5 ./.virtualenv
6 ./bin
7 ./lava.egg-info
8+./dist
9+./lava_dispatcher.egg-info
10+./build
11
12=== added file 'MANIFEST.in'
13--- MANIFEST.in 1970-01-01 00:00:00 +0000
14+++ MANIFEST.in 2011-09-09 01:07:35 +0000
15@@ -0,0 +1,2 @@
16+include README
17+recursive-include lava_dispatcher/default-config *.conf
18\ No newline at end of file
19
20=== modified file 'lava_dispatcher/__init__.py'
21--- lava_dispatcher/__init__.py 2011-09-08 22:12:27 +0000
22+++ lava_dispatcher/__init__.py 2011-09-09 01:07:35 +0000
23@@ -27,16 +27,19 @@
24 import pexpect
25
26 from lava_dispatcher.actions import get_all_cmds
27+from lava_dispatcher.config import get_config, get_device_config
28 from lava_dispatcher.client import LavaClient, CriticalError, GeneralError
29 from lava_dispatcher.android_client import LavaAndroidClient
30
31-__version__ = "0.2.2"
32+__version__ = "0.3a1"
33
34 class LavaTestJob(object):
35 def __init__(self, job_json, oob_file):
36 self.job_status = 'pass'
37 self.load_job_data(job_json)
38- self.context = LavaContext(self.target, self.image_type, oob_file)
39+ dispatcher_config = get_config("lava-dispatcher")
40+ self.context = LavaContext(
41+ self.target, self.image_type, dispatcher_config, oob_file)
42
43 def load_job_data(self, job_json):
44 self.job_data = json.loads(job_json)
45@@ -76,6 +79,7 @@
46 else:
47 status = 'pass'
48 finally:
49+ err_msg = ""
50 if status == 'fail':
51 err_msg = "Lava failed at action %s with error: %s\n" %\
52 (cmd['command'], err)
53@@ -102,11 +106,17 @@
54
55
56 class LavaContext(object):
57- def __init__(self, target, image_type, oob_file):
58- if image_type != "android":
59- self._client = LavaClient(target)
60+ def __init__(self, target, image_type, dispatcher_config, oob_file):
61+ self.config = dispatcher_config
62+ device_config = get_device_config(target)
63+ if device_config.get('client_type') != 'serial':
64+ raise RuntimeError(
65+ "this version of lava-dispatcher only supports serial "
66+ "clients, not %r" % device_config.get('client_type'))
67+ if image_type == "android":
68+ self._client = LavaAndroidClient(self, device_config)
69 else:
70- self._client = LavaAndroidClient(target)
71+ self._client = LavaClient(self, device_config)
72 self.test_data = LavaTestData()
73 self.oob_file = oob_file
74
75@@ -114,6 +124,26 @@
76 def client(self):
77 return self._client
78
79+ @property
80+ def lava_server_ip(self):
81+ return self.config.get("LAVA_SERVER_IP")
82+
83+ @property
84+ def lava_image_tmpdir(self):
85+ return self.config.get("LAVA_IMAGE_TMPDIR")
86+
87+ @property
88+ def lava_image_url(self):
89+ return self.config.get("LAVA_IMAGE_URL")
90+
91+ @property
92+ def lava_result_dir(self):
93+ return self.config.get("LAVA_RESULT_DIR")
94+
95+ @property
96+ def lava_cachedir(self):
97+ return self.config.get("LAVA_CACHEDIR")
98+
99
100 class LavaTestData(object):
101 def __init__(self, test_id='lava'):
102
103=== modified file 'lava_dispatcher/actions/android_basic.py'
104--- lava_dispatcher/actions/android_basic.py 2011-09-02 03:00:59 +0000
105+++ lava_dispatcher/actions/android_basic.py 2011-09-09 01:07:35 +0000
106@@ -60,7 +60,7 @@
107 test_case_result['result'] = "fail"
108
109 results['test_results'].append(test_case_result)
110- savebundlefile("monkey", results, timestring)
111+ savebundlefile("monkey", results, timestring, self.context.lava_result_dir)
112 self.client.proc.sendline("")
113
114
115@@ -146,5 +146,5 @@
116 test_case_result['result'] = "fail"
117
118 results['test_results'].append(test_case_result)
119- savebundlefile("basic", results, timestring)
120+ savebundlefile("basic", results, timestring, self.context.lava_result_dir)
121 self.client.proc.sendline("")
122
123=== modified file 'lava_dispatcher/actions/android_deploy.py'
124--- lava_dispatcher/actions/android_deploy.py 2011-09-05 21:52:35 +0000
125+++ lava_dispatcher/actions/android_deploy.py 2011-09-09 01:07:35 +0000
126@@ -20,7 +20,6 @@
127 # along with this program; if not, see <http://www.gnu.org/licenses>.
128
129 from lava_dispatcher.actions import BaseAction
130-from lava_dispatcher.config import LAVA_IMAGE_TMPDIR, LAVA_IMAGE_URL
131 import os
132 import sys
133 import shutil
134@@ -31,6 +30,8 @@
135
136 class cmd_deploy_linaro_android_image(BaseAction):
137 def run(self, boot, system, data, use_cache=True):
138+ LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
139+ LAVA_IMAGE_URL = self.context.lava_image_url
140 client = self.client
141 print "deploying Android on %s" % client.hostname
142 print " boot: %s" % boot
143@@ -85,14 +86,16 @@
144 :param data_url: url of the Linaro Android data tarball to download
145 :param use_cache: whether or not to use the cached copy (if it exists)
146 """
147+ lava_cachedir = self.context.lava_cachedir
148+ LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
149 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
150 tarball_dir = self.tarball_dir
151 os.chmod(tarball_dir, 0755)
152
153 if use_cache:
154- boot_path = download_with_cache(boot_url, tarball_dir)
155- system_path = download_with_cache(system_url, tarball_dir)
156- data_path = download_with_cache(data_url, tarball_dir)
157+ boot_path = download_with_cache(boot_url, tarball_dir, lava_cachedir)
158+ system_path = download_with_cache(system_url, tarball_dir, lava_cachedir)
159+ data_path = download_with_cache(data_url, tarball_dir, lava_cachedir)
160 else:
161 boot_path = download(boot_url, tarball_dir)
162 system_path = download(system_url, tarball_dir)
163
164=== modified file 'lava_dispatcher/actions/deploy.py'
165--- lava_dispatcher/actions/deploy.py 2011-09-08 04:23:59 +0000
166+++ lava_dispatcher/actions/deploy.py 2011-09-09 01:07:35 +0000
167@@ -26,13 +26,14 @@
168 from tempfile import mkdtemp
169
170 from lava_dispatcher.actions import BaseAction
171-from lava_dispatcher.config import LAVA_IMAGE_TMPDIR, LAVA_IMAGE_URL
172 from lava_dispatcher.utils import download, download_with_cache
173 from lava_dispatcher.client import CriticalError
174
175
176 class cmd_deploy_linaro_image(BaseAction):
177 def run(self, hwpack, rootfs, use_cache=True):
178+ LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
179+ LAVA_IMAGE_URL = self.context.lava_image_url
180 client = self.client
181 print "deploying on %s" % client.hostname
182 print " hwpack: %s" % hwpack
183@@ -112,30 +113,31 @@
184 :param hwpack_url: url of the Linaro hwpack to download
185 :param rootfs_url: url of the Linaro image to download
186 """
187+ lava_cachedir = self.context.lava_cachedir
188+ LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
189 client = self.client
190 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
191 tarball_dir = self.tarball_dir
192 os.chmod(tarball_dir, 0755)
193 if use_cache:
194- hwpack_path = download_with_cache(hwpack_url, tarball_dir)
195- rootfs_path = download_with_cache(rootfs_url, tarball_dir)
196+ hwpack_path = download_with_cache(hwpack_url, tarball_dir, lava_cachedir)
197+ rootfs_path = download_with_cache(rootfs_url, tarball_dir, lava_cachedir)
198 else:
199 hwpack_path = download(hwpack_url, tarball_dir)
200 rootfs_path = download(rootfs_url, tarball_dir)
201
202 image_file = os.path.join(tarball_dir, "lava.img")
203- board = client.board
204 cmd = ("sudo linaro-media-create --hwpack-force-yes --dev %s "
205 "--image_file %s --binary %s --hwpack %s --image_size 3G" %
206- (board.type, image_file, rootfs_path, hwpack_path))
207+ (client.device_type, image_file, rootfs_path, hwpack_path))
208 rc, output = getstatusoutput(cmd)
209 if rc:
210 shutil.rmtree(tarball_dir)
211 tb = traceback.format_exc()
212 client.sio.write(tb)
213 raise RuntimeError("linaro-media-create failed: %s" % output)
214- boot_offset = self._get_partition_offset(image_file, board.boot_part)
215- root_offset = self._get_partition_offset(image_file, board.root_part)
216+ boot_offset = self._get_partition_offset(image_file, client.boot_part)
217+ root_offset = self._get_partition_offset(image_file, client.root_part)
218 boot_tgz = os.path.join(tarball_dir, "boot.tgz")
219 root_tgz = os.path.join(tarball_dir, "root.tgz")
220 try:
221@@ -159,7 +161,7 @@
222 client.run_cmd_master('mount /dev/disk/by-label/testrootfs /mnt/root')
223 client.run_cmd_master(
224 'wget -qO- %s |tar --numeric-owner -C /mnt/root -xzf -' % rootfs,
225- timeout = 3600)
226+ timeout=3600)
227 client.run_cmd_master('echo linaro > /mnt/root/etc/hostname')
228 #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true
229 #prevents a serious problem where packages getting installed that
230
231=== modified file 'lava_dispatcher/actions/launch_control.py' (properties changed: +x to -x)
232--- lava_dispatcher/actions/launch_control.py 2011-09-06 09:35:13 +0000
233+++ lava_dispatcher/actions/launch_control.py 2011-09-09 01:07:35 +0000
234@@ -25,8 +25,6 @@
235 import shutil
236 import tarfile
237 from lava_dispatcher.actions import BaseAction
238-from lava_dispatcher.config import LAVA_RESULT_DIR
239-from lava_dispatcher.config import LAVA_IMAGE_TMPDIR
240 from lava_dispatcher.client import NetworkError
241 from lava_dispatcher.utils import download
242 from tempfile import mkdtemp
243@@ -40,9 +38,9 @@
244 allow_none=True, use_datetime=True)
245
246 #Upload bundle files to dashboard
247- bundle_list = os.listdir("/tmp/%s" % LAVA_RESULT_DIR)
248+ bundle_list = os.listdir("/tmp/%s" % self.context.lava_result_dir)
249 for bundle_name in bundle_list:
250- bundle = "/tmp/%s/%s" % (LAVA_RESULT_DIR, bundle_name)
251+ bundle = "/tmp/%s/%s" % (self.context.lava_result_dir, bundle_name)
252 f = open(bundle)
253 content = f.read()
254 f.close()
255@@ -53,6 +51,7 @@
256 print "xmlrpclib.Fault occurred"
257 print "Fault code: %d" % err.faultCode
258 print "Fault string: %s" % err.faultString
259+
260 # After uploading, remove the bundle file at the host side
261 os.remove(bundle)
262
263@@ -79,49 +78,50 @@
264 client.run_cmd_master('mkdir -p /mnt/root')
265 client.run_cmd_master(
266 'mount /dev/disk/by-label/%s /mnt/root' % result_disk)
267- client.run_cmd_master('mkdir -p /tmp/%s' % LAVA_RESULT_DIR)
268+ client.run_cmd_master('mkdir -p /tmp/%s' % self.context.lava_result_dir)
269 client.run_cmd_master(
270- 'cp /mnt/root/%s/*.bundle /tmp/%s' % (LAVA_RESULT_DIR,
271- LAVA_RESULT_DIR))
272+ 'cp /mnt/root/%s/*.bundle /tmp/%s' % (self.context.lava_result_dir,
273+ self.context.lava_result_dir))
274 client.run_cmd_master('umount /mnt/root')
275
276 #Create tarball of all results
277 client.run_cmd_master('cd /tmp')
278 client.run_cmd_master(
279- 'tar czf /tmp/lava_results.tgz -C /tmp/%s .' % LAVA_RESULT_DIR)
280+ 'tar czf /tmp/lava_results.tgz -C /tmp/%s .' % self.context.lava_result_dir)
281
282 master_ip = client.get_master_ip()
283- if master_ip != None:
284- # Set 80 as server port
285- client.run_cmd_master('python -m SimpleHTTPServer 80 &> /dev/null &')
286- time.sleep(3)
287-
288- result_tarball = "http://%s/lava_results.tgz" % master_ip
289- tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
290- os.chmod(tarball_dir, 0755)
291-
292- # download test result with a retry mechanism
293- # set retry timeout to 2mins
294- now = time.time()
295- timeout = 120
296- while time.time() < now+timeout:
297- try:
298- result_path = download(result_tarball, tarball_dir)
299- except:
300- if time.time() >= now+timeout:
301- raise
302-
303- client.run_cmd_master('kill %1')
304-
305- tar = tarfile.open(result_path)
306- for tarinfo in tar:
307- if os.path.splitext(tarinfo.name)[1] == ".bundle":
308- f = tar.extractfile(tarinfo)
309- content = f.read()
310- f.close()
311- self.all_bundles.append(json.loads(content))
312- tar.close()
313- shutil.rmtree(tarball_dir)
314+ if master_ip == None:
315+ raise NetworkError("Getting master image IP address failed")
316+ # Set 80 as server port
317+ client.run_cmd_master('python -m SimpleHTTPServer 80 &> /dev/null &')
318+ time.sleep(3)
319+
320+ result_tarball = "http://%s/lava_results.tgz" % master_ip
321+ tarball_dir = mkdtemp(dir=self.context.lava_image_tmpdir)
322+ os.chmod(tarball_dir, 0755)
323+
324+ # download test result with a retry mechanism
325+ # set retry timeout to 2mins
326+ now = time.time()
327+ timeout = 120
328+ while time.time() < now+timeout:
329+ try:
330+ result_path = download(result_tarball, tarball_dir)
331+ except:
332+ if time.time() >= now+timeout:
333+ raise
334+
335+ client.run_cmd_master('kill %1')
336+
337+ tar = tarfile.open(result_path)
338+ for tarinfo in tar:
339+ if os.path.splitext(tarinfo.name)[1] == ".bundle":
340+ f = tar.extractfile(tarinfo)
341+ content = f.read()
342+ f.close()
343+ self.all_bundles.append(json.loads(content))
344+ tar.close()
345+ shutil.rmtree(tarball_dir)
346
347 #flush the serial log
348 client.run_shell_command("")
349
350=== modified file 'lava_dispatcher/actions/lava-test.py' (properties changed: +x to -x)
351--- lava_dispatcher/actions/lava-test.py 2011-09-08 04:23:59 +0000
352+++ lava_dispatcher/actions/lava-test.py 2011-09-09 01:07:35 +0000
353@@ -24,7 +24,7 @@
354 import traceback
355 from lava_dispatcher.actions import BaseAction
356 from lava_dispatcher.client import OperationFailed
357-from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR
358+
359
360
361 def _setup_testrootfs(client):
362@@ -50,10 +50,9 @@
363 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf')
364 cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'
365 '| sort -r | xargs umount')
366- client.run_cmd_master(
367- cmd)
368- client.run_cmd_master(
369- 'umount /mnt/root')
370+ client.run_cmd_master(cmd)
371+ client.run_cmd_master('umount /mnt/root')
372+
373
374
375 def _install_lava_test(client):
376@@ -73,11 +72,10 @@
377 client.run_shell_command(
378 'chroot /mnt/root lava-test help',
379 response="list-test", timeout=10)
380- client.proc.expect(MASTER_STR, timeout=10)
381+ client.proc.expect(client.master_str, timeout=10)
382 except:
383 tb = traceback.format_exc()
384 client.sio.write(tb)
385- _teardown_testrootfs(client)
386 raise OperationFailed("lava-test deployment failed")
387
388
389@@ -86,12 +84,12 @@
390 #Make sure in test image now
391 client = self.client
392 client.in_test_shell()
393- client.run_cmd_tester('mkdir -p %s' % LAVA_RESULT_DIR)
394+ client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)
395 client.export_display()
396 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
397 client.run_cmd_tester(
398 'lava-test run %s -o %s/%s.bundle' % (
399- test_name, LAVA_RESULT_DIR, bundle_name),
400+ test_name, self.context.lava_result_dir, bundle_name),
401 timeout=timeout)
402
403
404
405=== modified file 'lava_dispatcher/android_client.py'
406--- lava_dispatcher/android_client.py 2011-09-08 04:23:59 +0000
407+++ lava_dispatcher/android_client.py 2011-09-09 01:07:35 +0000
408@@ -20,12 +20,9 @@
409 import pexpect
410 import sys
411 from lava_dispatcher.client import LavaClient, OperationFailed
412-from lava_dispatcher.android_config import BOARDS, TESTER_STR
413+from utils import string_to_list
414
415 class LavaAndroidClient(LavaClient):
416- def __init__(self, hostname):
417- super(LavaAndroidClient, self).__init__(hostname)
418- self.board = BOARDS[hostname]
419
420 def run_adb_shell_command(self, dev_id, cmd, response, timeout=-1):
421 adb_cmd = "adb -s %s shell %s" % (dev_id, cmd)
422@@ -42,7 +39,7 @@
423 """ Check that we are in a shell on the test image
424 """
425 self.proc.sendline("")
426- id = self.proc.expect([TESTER_STR , pexpect.TIMEOUT])
427+ id = self.proc.expect([self.tester_str , pexpect.TIMEOUT])
428 if id == 1:
429 raise OperationFailed
430
431@@ -55,11 +52,11 @@
432 except:
433 self.hard_reboot()
434 self.enter_uboot()
435- uboot_cmds = self.board.uboot_cmds
436- self.proc.sendline(uboot_cmds[0])
437- for line in range(1, len(uboot_cmds)):
438+ boot_cmds = string_to_list(self.config.get('boot_cmds_android'))
439+ self.proc.sendline(boot_cmds[0])
440+ for line in range(1, len(boot_cmds)):
441 self.proc.expect("#")
442- self.proc.sendline(uboot_cmds[line])
443+ self.proc.sendline(boot_cmds[line])
444 self.in_test_shell()
445 self.proc.sendline("export PS1=\"root@linaro: \"")
446
447@@ -106,7 +103,7 @@
448
449 def check_adb_status(self):
450 # XXX: IP could be assigned in other way in the validation farm
451- network_interface = self.board.default_network_interface
452+ network_interface = self.default_network_interface
453 try:
454 self.run_cmd_tester(
455 'netcfg %s dhcp' % network_interface, timeout=60)
456
457=== removed file 'lava_dispatcher/android_config.py'
458--- lava_dispatcher/android_config.py 2011-08-16 00:15:08 +0000
459+++ lava_dispatcher/android_config.py 1970-01-01 00:00:00 +0000
460@@ -1,65 +0,0 @@
461-# Copyright (C) 2011 Linaro Limited
462-#
463-# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
464-#
465-# This file is part of LAVA Dispatcher.
466-#
467-# LAVA Dispatcher is free software; you can redistribute it and/or modify
468-# it under the terms of the GNU General Public License as published by
469-# the Free Software Foundation; either version 2 of the License, or
470-# (at your option) any later version.
471-#
472-# LAVA Dispatcher is distributed in the hope that it will be useful,
473-# but WITHOUT ANY WARRANTY; without even the implied warranty of
474-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
475-# GNU General Public License for more details.
476-#
477-# You should have received a copy of the GNU General Public License
478-# along with this program; if not, see <http://www.gnu.org/licenses>.
479-
480-from lava_dispatcher.config import Board
481-
482-class BeagleBoard(Board):
483- uboot_cmds = ["mmc init",
484- "mmc part 0",
485- "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage;"
486- "fatload mmc 0:3 0x81600000 uInitrd;"
487- "bootm 0x80000000 0x81600000'",
488- "setenv bootargs 'console=tty0 console=ttyO2,115200n8 "
489- "rootwait rw earlyprintk fixrtc nocompcache "
490- "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60 "
491- "init=/init androidboot.console=ttyO2'",
492- "boot"]
493- type = "beagle"
494-
495-
496-class PandaBoard(Board):
497- uboot_cmds = ["mmc init",
498- "mmc part 0",
499- "setenv bootcmd 'fatload mmc 0:3 0x80200000 uImage;"
500- "fatload mmc 0:3 0x81600000 uInitrd;"
501- "bootm 0x80200000 0x81600000'",
502- "setenv bootargs 'console=tty0 console=ttyO2,115200n8 "
503- "rootwait rw earlyprintk fixrtc nocompcache vram=32M "
504- "omapfb.vram=0:8M mem=456M@0x80000000 mem=512M@0xA0000000 "
505- "omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60 "
506- "init=/init androidboot.console=ttyO2'",
507- "boot"]
508- type = "panda"
509-
510-
511-#Here, it still needs to maintain a map from boardid to board, for there is only
512-#boardid in jobfile.json
513-BOARDS = {
514- "beagle01": BeagleBoard,
515- "beagle02": BeagleBoard,
516- "beagle03": BeagleBoard,
517- "beagle04": BeagleBoard,
518- "panda01": PandaBoard,
519- "panda02": PandaBoard,
520- "panda03": PandaBoard,
521- "panda04": PandaBoard,
522- }
523-
524-#Test image recognization string
525-TESTER_STR = "root@linaro:"
526
527=== modified file 'lava_dispatcher/android_util.py'
528--- lava_dispatcher/android_util.py 2011-06-27 04:55:08 +0000
529+++ lava_dispatcher/android_util.py 2011-09-09 01:07:35 +0000
530@@ -22,11 +22,10 @@
531 from datetime import datetime
532 import json
533 import subprocess
534-from lava_dispatcher.config import LAVA_RESULT_DIR
535 import time
536
537 # TODO: Result saving could be replaced by linaro_dashboard_bundle probably.
538-def savebundlefile(testname, results, starttime):
539+def savebundlefile(testname, results, starttime, lava_result_dir):
540 """
541 Save results as .bundle file under /tmp/LAVA_RESULT_DIR/
542 """
543@@ -42,9 +41,9 @@
544 testdata['test_runs'] = test_runs
545 testdata['test_runs'][0].update(results)
546 bundle = testdata
547- subprocess.call(["mkdir", "-p", "/tmp/%s" % LAVA_RESULT_DIR])
548+ subprocess.call(["mkdir", "-p", "/tmp/%s" % lava_result_dir])
549 # The file name should be unique to be distinguishable from others
550- filename = "/tmp/%s/" % LAVA_RESULT_DIR + testname + \
551+ filename = "/tmp/%s/" % lava_result_dir + testname + \
552 str(time.mktime(datetime.utcnow().timetuple())) + ".bundle"
553 with open(filename, "wt") as stream:
554 json.dump(bundle, stream)
555
556=== modified file 'lava_dispatcher/client.py'
557--- lava_dispatcher/client.py 2011-09-08 04:23:59 +0000
558+++ lava_dispatcher/client.py 2011-09-09 01:07:35 +0000
559@@ -22,35 +22,56 @@
560 import sys
561 import time
562 from cStringIO import StringIO
563-
564-from lava_dispatcher.config import (
565- BOARDS,
566- LAVA_SERVER_IP,
567- MASTER_STR,
568- TESTER_STR,
569- )
570-
571+from utils import string_to_list
572
573 class LavaClient(object):
574- def __init__(self, hostname):
575- self._master_str = MASTER_STR
576- self._tester_str = TESTER_STR
577- cmd = "conmux-console %s" % hostname
578+ def __init__(self, context, config):
579+ self.context = context
580+ self.config = config
581+ cmd = "conmux-console %s" % self.hostname
582 self.sio = SerialIO(sys.stdout)
583 self.proc = pexpect.spawn(cmd, timeout=3600, logfile=self.sio)
584 #serial can be slow, races do funny things if you don't increase delay
585 self.proc.delaybeforesend=1
586- self.hostname = hostname
587- # will eventually come from the database
588- self.board = BOARDS[hostname]
589+
590+ def device_option(self, option_name):
591+ return self.config.get(option_name)
592+
593+ def device_option_int(self, option_name):
594+ return self.config.getint(option_name)
595+
596+ @property
597+ def hostname(self):
598+ return self.device_option("hostname")
599+
600+ @property
601+ def tester_str(self):
602+ return self.device_option("TESTER_STR")
603
604 @property
605 def master_str(self):
606- return self._master_str
607-
608- @property
609- def tester_str(self):
610- return self._tester_str
611+ return self.device_option("MASTER_STR")
612+
613+ @property
614+ def boot_cmds(self):
615+ uboot_str = self.device_option("boot_cmds")
616+ return string_to_list(uboot_str)
617+
618+ @property
619+ def device_type(self):
620+ return self.device_option("device_type")
621+
622+ @property
623+ def boot_part(self):
624+ return self.device_option_int("boot_part")
625+
626+ @property
627+ def root_part(self):
628+ return self.device_option_int("root_part")
629+
630+ @property
631+ def default_network_interface(self):
632+ return self.device_option("default_network_interface")
633
634 def in_master_shell(self):
635 """ Check that we are in a shell on the master image
636@@ -91,16 +112,16 @@
637 except:
638 self.hard_reboot()
639 self.enter_uboot()
640- uboot_cmds = self.board.uboot_cmds
641- self.proc.sendline(uboot_cmds[0])
642- for line in range(1, len(uboot_cmds)):
643- if self.board.type in ["mx51evk", "mx53loco"]:
644+ boot_cmds = self.boot_cmds
645+ self.proc.sendline(boot_cmds[0])
646+ for line in range(1, len(boot_cmds)):
647+ if self.device_type in ["mx51evk", "mx53loco"]:
648 self.proc.expect(">", timeout=300)
649- elif self.board.type == "snowball_sd":
650+ elif self.device_type == "snowball_sd":
651 self.proc.expect("\$", timeout=300)
652 else:
653 self.proc.expect("#", timeout=300)
654- self.proc.sendline(uboot_cmds[line])
655+ self.proc.sendline(boot_cmds[line])
656 self.in_test_shell()
657
658 def enter_uboot(self):
659@@ -131,7 +152,8 @@
660 self.run_shell_command(cmd, self.tester_str, timeout)
661
662 def check_network_up(self):
663- self.proc.sendline("LC_ALL=C ping -W4 -c1 %s" % LAVA_SERVER_IP)
664+ lava_server_ip = self.context.lava_server_ip
665+ self.proc.sendline("LC_ALL=C ping -W4 -c1 %s" % lava_server_ip)
666 id = self.proc.expect(["1 received", "0 received",
667 "Network is unreachable"], timeout=5)
668 self.proc.expect(self.master_str)
669@@ -154,7 +176,7 @@
670 #pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
671 pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)"
672 cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"
673- "awk '{print $1}'" % self.board.default_network_interface)
674+ "awk '{print $1}'" % self.default_network_interface)
675 self.proc.sendline(cmd)
676 #if running from ipython, it needs another Enter, don't know why:
677 #self.proc.sendline("")
678
679=== modified file 'lava_dispatcher/config.py'
680--- lava_dispatcher/config.py 2011-08-16 00:15:08 +0000
681+++ lava_dispatcher/config.py 2011-09-09 01:07:35 +0000
682@@ -18,113 +18,72 @@
683 # along
684 # with this program; if not, see <http://www.gnu.org/licenses>.
685
686-"""
687-This is an ugly hack, the uboot commands for a given board type and the board
688-type of a test machine need to come from the device registry. This is an
689-easy way to look it up for now though, just to show the rest of the code
690-around it
691-"""
692-
693-class Board:
694- uboot_cmds = None
695- type = None
696- # boot partition number, counting from 1
697- boot_part = 1
698- # root partition number, counting from 1
699- root_part = 2
700- default_network_interface = "eth0"
701-
702-class BeagleBoard(Board):
703- uboot_cmds = ["mmc init",
704- "mmc part 0",
705- "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "
706- "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
707- "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "
708- "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "
709- "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
710- "boot"]
711- type = "beagle"
712-
713-class PandaBoard(Board):
714- uboot_cmds = ["mmc init",
715- "mmc part 0",
716- "setenv bootcmd 'fatload mmc 0:3 0x80200000 uImage; fatload mmc "
717- "0:3 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",
718- "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "
719- "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "
720- "vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000'",
721- "boot"]
722- type = "panda"
723-
724-class Snowball(Board):
725- uboot_cmds = ["mmc init",
726- "mmc rescan 1",
727- "setenv bootcmd 'fat load mmc 1:3 0x00100000 /uImage;"
728- "bootm 0x00100000'",
729- "setenv bootargs 'console=tty0 console=ttyAMA2,115200n8 "
730- "root=LABEL=testrootfs rootwait ro earlyprintk rootdelay=1 "
731- "fixrtc nocompcache mem=96M@0 mem_modem=32M@96M mem=44M@128M "
732- "pmem=22M@172M mem=30M@194M mem_mali=32M@224M pmem_hwb=54M@256M "
733- "hwmem=48M@302M mem=152M@360M'",
734- "boot"]
735- type = "snowball_sd"
736-
737-class Mx51evkBoard(Board):
738- boot_part = 2
739- root_part = 3
740- uboot_cmds = ["mmc init",
741- "mmc part 0",
742- "setenv bootcmd 'fatload mmc 0:5 0x90000000 uImage; fatload mmc 0:5 "
743- "0x92000000 uInitrd; fatload mmc 0:5 0x91ff0000 board.dtb; bootm "
744- "0x90000000 0x92000000 0x91ff0000'",
745- "setenv bootargs ' console=tty0 console=ttymxc0,115200n8 "
746- "root=LABEL=testrootfs rootwait ro'",
747- "boot"]
748- type = "mx51evk"
749-
750-class Mx53locoBoard(Board):
751- boot_part = 2
752- root_part = 3
753- uboot_cmds = ["mmc init",
754- "mmc part 0",
755- "setenv bootcmd 'fatload mmc 0:5 0x70800000 uImage; fatload mmc "
756- "0:5 0x71800000 uInitrd; bootm 0x70800000 0x71800000'",
757- "setenv bootargs ' console=tty0 console=ttymxc0,115200n8 "
758- "root=LABEL=testrootfs rootwait ro'",
759- "boot"]
760- type = "mx53loco"
761-
762-#Here, it still needs to maintain a map from boardid to board, for there is
763-#only boardid in jobfile.json
764-BOARDS = {
765- "panda01": PandaBoard,
766- "panda02": PandaBoard,
767- "panda03": PandaBoard,
768- "panda04": PandaBoard,
769- "beaglexm01": BeagleBoard,
770- "beaglexm02": BeagleBoard,
771- "beaglexm03": BeagleBoard,
772- "beaglexm04": BeagleBoard,
773- "mx51evk01": Mx51evkBoard,
774- "mx53loco01": Mx53locoBoard,
775- "snowball01": Snowball,
776- "snowball02": Snowball,
777- "snowball03": Snowball,
778- "snowball04": Snowball,
779- }
780-
781-#Main LAVA server IP in the boards farm
782-LAVA_SERVER_IP = "192.168.1.10"
783-#Location for hosting rootfs/boot tarballs extracted from images
784-LAVA_IMAGE_TMPDIR = "/linaro/images/tmp"
785-#URL where LAVA_IMAGE_TMPDIR can be accessed remotely
786-LAVA_IMAGE_URL = "http://%s/images/tmp" % LAVA_SERVER_IP
787-#Default test result storage path
788-LAVA_RESULT_DIR = "/lava/results"
789-#Location for caching downloaded artifacts such as hwpacks and images
790-LAVA_CACHEDIR = "/linaro/images/cache"
791-
792-#Master image recognization string
793-MASTER_STR = "root@master:"
794-#Test image recognization string
795-TESTER_STR = "root@linaro:"
796+from ConfigParser import ConfigParser
797+import os
798+import StringIO
799+
800+
801+default_config_path = os.path.join(
802+ os.path.dirname(__file__), 'default-config')
803+
804+
805+def load_config_paths(name):
806+ for directory in [os.path.expanduser("~/.config"),
807+ "/etc/xdg", default_config_path]:
808+ path = os.path.join(directory, name)
809+ if os.path.isdir(path):
810+ yield path
811+
812+
813+def _read_into(path, cp):
814+ s = StringIO.StringIO()
815+ s.write('[DEFAULT]\n')
816+ s.write(open(path).read())
817+ s.seek(0)
818+ cp.readfp(s)
819+
820+
821+def _get_config(name, cp=None):
822+ """Read a config file named name + '.conf'.
823+
824+ This checks and loads files from the source tree, site wide location and
825+ home directory -- in that order, so home dir settings override site
826+ settings which override source settings.
827+ """
828+ config_files = []
829+ for directory in load_config_paths('lava-dispatcher'):
830+ path = os.path.join(directory, '%s.conf' % name)
831+ if os.path.exists(path):
832+ config_files.append(path)
833+ if not config_files:
834+ raise Exception("no config files named %r found" % (name + ".conf"))
835+ config_files.reverse()
836+ if cp is None:
837+ cp = ConfigParser()
838+ print "About to read %s" % str(config_files)
839+ for path in config_files:
840+ _read_into(path, cp)
841+ return cp
842+
843+
844+class ConfigWrapper(object):
845+ def __init__(self, cp):
846+ self.cp = cp
847+ def get(self, key):
848+ return self.cp.get("DEFAULT", key)
849+ def getint(self, key):
850+ return self.cp.getint("DEFAULT", key)
851+
852+
853+def get_config(name):
854+ return ConfigWrapper(_get_config(name))
855+
856+
857+def get_device_config(name):
858+ device_config = _get_config("devices/%s" % name)
859+ cp = _get_config("device-defaults")
860+ _get_config(
861+ "device-types/%s" % device_config.get('DEFAULT', 'device_type'), cp)
862+ _get_config("devices/%s" % name, cp)
863+ cp.set("DEFAULT", "hostname", name)
864+ return ConfigWrapper(cp)
865
866=== added directory 'lava_dispatcher/default-config'
867=== added directory 'lava_dispatcher/default-config/lava-dispatcher'
868=== added file 'lava_dispatcher/default-config/lava-dispatcher/README'
869--- lava_dispatcher/default-config/lava-dispatcher/README 1970-01-01 00:00:00 +0000
870+++ lava_dispatcher/default-config/lava-dispatcher/README 2011-09-09 01:07:35 +0000
871@@ -0,0 +1,41 @@
872+Configuration files for lava-dispatcher
873+=======================================
874+
875+lava-dispatcher looks for files in:
876+
877+ * Alongside the installation/source tree for the default values
878+ (i.e. this directory).
879+
880+ * /etc/xdg/lava-dispatcher for system-wide settings.
881+
882+ * ~/.config/lava-dispatcher for user settings.
883+
884+Each config directory can contain two files and two directories:
885+
886+ * lava-dispatcher.conf
887+
888+ This file defines global settings of the dispatcher. You will
889+ almost certainly need to customize LAVA_SERVER_IP for your install.
890+
891+ * device-defaults.conf
892+
893+ This file defines default values for all devices. You probably
894+ won't need to customize it.
895+
896+ * device-types/
897+
898+ This directory contains a config file for each device type. You
899+ probably won't need to customize the settings for device types that
900+ are already supported by lava-dispatcher, but if you are working on
901+ supporting a new class of device, you will need to add a file here.
902+
903+ Note that the device-type name must match the --dev argument to
904+ linaro-media-create.
905+
906+ * devices/
907+
908+ This directory contains a file per device that can be targeted by
909+ lava-dispatcher. For the most part this file just needs to contain
910+ a line "device_type = <device type>", although other settings can
911+ be included here. You will definitely need to tell lava-dispatcher
912+ about the devices you have!
913
914=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
915--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 1970-01-01 00:00:00 +0000
916+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2011-09-09 01:07:35 +0000
917@@ -0,0 +1,50 @@
918+# The default device settings.
919+
920+# All device settings default to these values unless they are
921+# overwritten by the specific device type file
922+# (device-types/${TYPE}.conf) or the specific device file
923+# (devices/${DEVICE}.conf).
924+
925+# The client_type. Only 'serial' (meaning we communicate with the
926+# device over a serial line via conmux) is supported today but 'qemu'
927+# and 'ssh' are coming.
928+client_type = serial
929+
930+# The bootloader commands to boot the device into the test image (we
931+# assume that the device boots into the master image without bootloader
932+# intervention).
933+#
934+# XXX should be called # boot_test_image_commands ?
935+boot_cmds =
936+
937+# The bootloader commands to boot the device into an android-based test
938+# image.
939+#
940+# XXX should be called # boot_android_test_image_commands ?
941+boot_cmds_android =
942+
943+# The device type. Settings in device-types/${TYPE}.conf override
944+# settings in this file, but are overridden by the
945+# devices/${DEVICE}.conf file.
946+type =
947+
948+# The network interface that comes up by default
949+default_network_interface = eth0
950+
951+# boot partition number, counting from 1
952+#
953+# This is used to divide up the image produced by linaro-media-create
954+# into sections to write onto the device.
955+boot_part = 1
956+
957+# root partition number, counting from 1
958+#
959+# This is used to divide up the image produced by linaro-media-create
960+# into sections to write onto the device.
961+root_part = 2
962+
963+# Master image recognization string
964+MASTER_STR = root@master:
965+
966+# Test image recognization string
967+TESTER_STR = root@linaro:
968
969=== added directory 'lava_dispatcher/default-config/lava-dispatcher/device-types'
970=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf'
971--- lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf 1970-01-01 00:00:00 +0000
972+++ lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf 2011-09-09 01:07:35 +0000
973@@ -0,0 +1,20 @@
974+boot_cmds = mmc init,
975+ mmc part 0,
976+ setenv bootcmd "'fatload mmc 0:3 0x80000000 uImage;
977+ fatload mmc 0:3 0x81600000 uInitrd;
978+ bootm 0x80000000 0x81600000'",
979+ setenv bootargs "' console=tty0 console=ttyO2,115200n8
980+ root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache
981+ vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
982+ boot
983+
984+boot_cmds_android = mmc init,
985+ mmc part 0,
986+ setenv bootcmd "'fatload mmc 0:3 0x80000000 uImage;
987+ fatload mmc 0:3 0x81600000 uInitrd;
988+ bootm 0x80000000 0x81600000'",
989+ setenv bootargs "'console=tty0 console=ttyO2,115200n8
990+ rootwait rw earlyprintk fixrtc nocompcache
991+ vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60
992+ init=/init androidboot.console=ttyO2'",
993+ boot
994
995=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf'
996--- lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf 1970-01-01 00:00:00 +0000
997+++ lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf 2011-09-09 01:07:35 +0000
998@@ -0,0 +1,10 @@
999+boot_part = 2
1000+root_part = 3
1001+boot_cmds = mmc init,
1002+ mmc part 0,
1003+ setenv bootcmd "'fatload mmc 0:5 0x90000000 uImage; fatload mmc 0:5
1004+ 0x92000000 uInitrd; fatload mmc 0:5 0x91ff0000 board.dtb; bootm
1005+ 0x90000000 0x92000000 0x91ff0000'",
1006+ setenv bootargs "' console=tty0 console=ttymxc0,115200n8
1007+ root=LABEL=testrootfs rootwait ro'",
1008+ boot
1009
1010=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf'
1011--- lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf 1970-01-01 00:00:00 +0000
1012+++ lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf 2011-09-09 01:07:35 +0000
1013@@ -0,0 +1,9 @@
1014+boot_part = 2
1015+root_part = 3
1016+boot_cmds = mmc init,
1017+ mmc part 0,
1018+ setenv bootcmd "'fatload mmc 0:5 0x70800000 uImage; fatload mmc
1019+ 0:5 0x71800000 uInitrd; bootm 0x70800000 0x71800000'",
1020+ setenv bootargs "' console=tty0 console=ttymxc0,115200n8
1021+ root=LABEL=testrootfs rootwait ro'",
1022+ boot
1023
1024=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf'
1025--- lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 1970-01-01 00:00:00 +0000
1026+++ lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 2011-09-09 01:07:35 +0000
1027@@ -0,0 +1,19 @@
1028+boot_cmds = mmc init,
1029+ mmc part 0,
1030+ setenv bootcmd "'fatload mmc 0:3 0x80200000 uImage; fatload mmc
1031+ 0:3 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",
1032+ setenv bootargs "' console=tty0 console=ttyO2,115200n8
1033+ root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache
1034+ vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000'",
1035+ boot
1036+boot_cmds_android = mmc init,
1037+ mmc part 0,
1038+ setenv bootcmd "'fatload mmc 0:3 0x80200000 uImage;
1039+ fatload mmc 0:3 0x81600000 uInitrd;
1040+ bootm 0x80200000 0x81600000'",
1041+ setenv bootargs "'console=tty0 console=ttyO2,115200n8
1042+ rootwait rw earlyprintk fixrtc nocompcache vram=32M
1043+ omapfb.vram=0:8M mem=456M@0x80000000 mem=512M@0xA0000000
1044+ omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60
1045+ init=/init androidboot.console=ttyO2'",
1046+ boot
1047
1048=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf'
1049--- lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf 1970-01-01 00:00:00 +0000
1050+++ lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf 2011-09-09 01:07:35 +0000
1051@@ -0,0 +1,12 @@
1052+boot_cmds = mmc init,
1053+ mmc rescan 1,
1054+ setenv bootcmd "'fat load mmc 1:3 0x00100000 /uImage;
1055+ bootm 0x00100000'",
1056+ setenv bootargs "'console=tty0 console=ttyAMA2,115200n8
1057+ root=LABEL=testrootfs rootwait ro earlyprintk rootdelay=1
1058+ fixrtc nocompcache mem=96M@0 mem_modem=32M@96M mem=44M@128M
1059+ pmem=22M@172M mem=30M@194M mem_mali=32M@224M pmem_hwb=54M@256M
1060+ hwmem=48M@302M mem=152M@360M'",
1061+ boot
1062+
1063+#boot_cmds_android = TBD
1064\ No newline at end of file
1065
1066=== added directory 'lava_dispatcher/default-config/lava-dispatcher/devices'
1067=== added file 'lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf'
1068--- lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf 1970-01-01 00:00:00 +0000
1069+++ lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf 2011-09-09 01:07:35 +0000
1070@@ -0,0 +1,19 @@
1071+# General lava-dispatcher settings.
1072+
1073+# Main LAVA server IP in the lab.
1074+#
1075+# This is the IP the device downloads the image parts from.
1076+LAVA_SERVER_IP = 192.168.1.10
1077+
1078+# Location for rootfs/boot tarballs extracted from images
1079+LAVA_IMAGE_TMPDIR = /linaro/images/tmp
1080+
1081+# URL where LAVA_IMAGE_TMPDIR can be accessed remotely
1082+LAVA_IMAGE_URL = http://%(LAVA_SERVER_IP)s/images/tmp
1083+
1084+# Location on the device for storing test results.
1085+LAVA_RESULT_DIR = /lava/results
1086+
1087+# Location for caching downloaded artifacts such as hwpacks and images
1088+LAVA_CACHEDIR = /linaro/images/cache
1089+
1090
1091=== modified file 'lava_dispatcher/tests/test_config.py'
1092--- lava_dispatcher/tests/test_config.py 2011-06-27 04:55:08 +0000
1093+++ lava_dispatcher/tests/test_config.py 2011-09-09 01:07:35 +0000
1094@@ -19,12 +19,15 @@
1095
1096 from unittest import TestCase
1097
1098-from lava_dispatcher.config import BOARDS, LAVA_SERVER_IP
1099+from lava_dispatcher.config import get_config, get_device_config
1100+from lava_dispatcher.utils import string_to_list
1101
1102 class TestConfigData(TestCase):
1103 def test_beagle01_uboot_cmds(self):
1104+ beagle01_config = get_device_config("beaglexm01")
1105 expected = [
1106 "mmc init",
1107+ "mmc part 0",
1108 "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "
1109 "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
1110 "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "
1111@@ -32,11 +35,12 @@
1112 "nocompcache vram=12M omapfb.debug=y "
1113 "omapfb.mode=dvi:1280x720MR-16@60'",
1114 "boot"]
1115- brd = BOARDS["beagle01"]
1116- uboot_cmds = brd.uboot_cmds
1117- self.assertEquals(expected, uboot_cmds)
1118+ uboot_cmds = beagle01_config.get("boot_cmds")
1119+ self.assertEquals(expected, string_to_list(uboot_cmds))
1120
1121 def test_server_ip(self):
1122+ server_config = get_config("lava-dispatcher")
1123 expected = "192.168.1.10"
1124- self.assertEqual(expected, LAVA_SERVER_IP)
1125+ lava_server_ip = server_config.get("LAVA_SERVER_IP")
1126+ self.assertEqual(expected, lava_server_ip)
1127
1128
1129=== modified file 'lava_dispatcher/utils.py'
1130--- lava_dispatcher/utils.py 2011-08-18 20:38:38 +0000
1131+++ lava_dispatcher/utils.py 2011-09-09 01:07:35 +0000
1132@@ -22,8 +22,7 @@
1133 import shutil
1134 import urllib2
1135 import urlparse
1136-
1137-from lava_dispatcher.config import LAVA_CACHEDIR
1138+from shlex import shlex
1139
1140 def download(url, path=""):
1141 urlpath = urlparse.urlsplit(url).path
1142@@ -41,8 +40,8 @@
1143 raise RuntimeError("Could not retrieve %s" % url)
1144 return filename
1145
1146-def download_with_cache(url, path=""):
1147- cache_loc = url_to_cache(url)
1148+def download_with_cache(url, path="", cachedir=""):
1149+ cache_loc = url_to_cache(url, cachedir)
1150 if os.path.exists(cache_loc):
1151 filename = os.path.basename(cache_loc)
1152 file_location = os.path.join(path, filename)
1153@@ -61,8 +60,16 @@
1154 #so ignore
1155 return file_location
1156
1157-def url_to_cache(url):
1158+def url_to_cache(url, cachedir):
1159 url_parts = urlparse.urlsplit(url)
1160- path = os.path.join(LAVA_CACHEDIR, url_parts.netloc,
1161+ path = os.path.join(cachedir, url_parts.netloc,
1162 url_parts.path.lstrip(os.sep))
1163 return path
1164+
1165+def string_to_list(string):
1166+ splitter = shlex(string, posix=True)
1167+ splitter.whitespace = ","
1168+ splitter.whitespace_split = True
1169+ newlines_to_spaces = lambda x: x.replace('\n', ' ')
1170+ strip_newlines = lambda x: newlines_to_spaces(x).strip(' ')
1171+ return map(strip_newlines, list(splitter))
1172
1173=== modified file 'setup.py'
1174--- setup.py 2011-07-21 16:55:47 +0000
1175+++ setup.py 2011-09-09 01:07:35 +0000
1176@@ -12,6 +12,15 @@
1177 author='Linaro Validation Team',
1178 author_email='linaro-dev@lists.linaro.org',
1179 packages=find_packages(),
1180+ package_data= {
1181+ 'lava_dispatcher': [
1182+ 'default-config/lava-dispatcher/lava-dispatcher.conf',
1183+ 'default-config/lava-dispatcher/lava-dispatcher.conf',
1184+ 'default-config/lava-dispatcher/device-defaults.conf',
1185+ 'default-config/lava-dispatcher/device-types/*.conf',
1186+ 'default-config/lava-dispatcher/devices/*.conf',
1187+ ],
1188+ },
1189 scripts = [
1190 'lava-dispatch'
1191 ],

Subscribers

People subscribed via source and target branches