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
=== modified file '.bzrignore'
--- .bzrignore 2011-04-07 01:21:51 +0000
+++ .bzrignore 2011-09-09 01:07:35 +0000
@@ -3,3 +3,6 @@
3./.virtualenv3./.virtualenv
4./bin4./bin
5./lava.egg-info5./lava.egg-info
6./dist
7./lava_dispatcher.egg-info
8./build
69
=== added file 'MANIFEST.in'
--- MANIFEST.in 1970-01-01 00:00:00 +0000
+++ MANIFEST.in 2011-09-09 01:07:35 +0000
@@ -0,0 +1,2 @@
1include README
2recursive-include lava_dispatcher/default-config *.conf
0\ No newline at end of file3\ No newline at end of file
14
=== modified file 'lava_dispatcher/__init__.py'
--- lava_dispatcher/__init__.py 2011-09-08 22:12:27 +0000
+++ lava_dispatcher/__init__.py 2011-09-09 01:07:35 +0000
@@ -27,16 +27,19 @@
27import pexpect27import pexpect
2828
29from lava_dispatcher.actions import get_all_cmds29from lava_dispatcher.actions import get_all_cmds
30from lava_dispatcher.config import get_config, get_device_config
30from lava_dispatcher.client import LavaClient, CriticalError, GeneralError31from lava_dispatcher.client import LavaClient, CriticalError, GeneralError
31from lava_dispatcher.android_client import LavaAndroidClient32from lava_dispatcher.android_client import LavaAndroidClient
3233
33__version__ = "0.2.2"34__version__ = "0.3a1"
3435
35class LavaTestJob(object):36class LavaTestJob(object):
36 def __init__(self, job_json, oob_file):37 def __init__(self, job_json, oob_file):
37 self.job_status = 'pass'38 self.job_status = 'pass'
38 self.load_job_data(job_json)39 self.load_job_data(job_json)
39 self.context = LavaContext(self.target, self.image_type, oob_file)40 dispatcher_config = get_config("lava-dispatcher")
41 self.context = LavaContext(
42 self.target, self.image_type, dispatcher_config, oob_file)
4043
41 def load_job_data(self, job_json):44 def load_job_data(self, job_json):
42 self.job_data = json.loads(job_json)45 self.job_data = json.loads(job_json)
@@ -76,6 +79,7 @@
76 else:79 else:
77 status = 'pass'80 status = 'pass'
78 finally:81 finally:
82 err_msg = ""
79 if status == 'fail':83 if status == 'fail':
80 err_msg = "Lava failed at action %s with error: %s\n" %\84 err_msg = "Lava failed at action %s with error: %s\n" %\
81 (cmd['command'], err)85 (cmd['command'], err)
@@ -102,11 +106,17 @@
102106
103107
104class LavaContext(object):108class LavaContext(object):
105 def __init__(self, target, image_type, oob_file):109 def __init__(self, target, image_type, dispatcher_config, oob_file):
106 if image_type != "android":110 self.config = dispatcher_config
107 self._client = LavaClient(target)111 device_config = get_device_config(target)
112 if device_config.get('client_type') != 'serial':
113 raise RuntimeError(
114 "this version of lava-dispatcher only supports serial "
115 "clients, not %r" % device_config.get('client_type'))
116 if image_type == "android":
117 self._client = LavaAndroidClient(self, device_config)
108 else:118 else:
109 self._client = LavaAndroidClient(target)119 self._client = LavaClient(self, device_config)
110 self.test_data = LavaTestData()120 self.test_data = LavaTestData()
111 self.oob_file = oob_file121 self.oob_file = oob_file
112122
@@ -114,6 +124,26 @@
114 def client(self):124 def client(self):
115 return self._client125 return self._client
116126
127 @property
128 def lava_server_ip(self):
129 return self.config.get("LAVA_SERVER_IP")
130
131 @property
132 def lava_image_tmpdir(self):
133 return self.config.get("LAVA_IMAGE_TMPDIR")
134
135 @property
136 def lava_image_url(self):
137 return self.config.get("LAVA_IMAGE_URL")
138
139 @property
140 def lava_result_dir(self):
141 return self.config.get("LAVA_RESULT_DIR")
142
143 @property
144 def lava_cachedir(self):
145 return self.config.get("LAVA_CACHEDIR")
146
117147
118class LavaTestData(object):148class LavaTestData(object):
119 def __init__(self, test_id='lava'):149 def __init__(self, test_id='lava'):
120150
=== modified file 'lava_dispatcher/actions/android_basic.py'
--- lava_dispatcher/actions/android_basic.py 2011-09-02 03:00:59 +0000
+++ lava_dispatcher/actions/android_basic.py 2011-09-09 01:07:35 +0000
@@ -60,7 +60,7 @@
60 test_case_result['result'] = "fail"60 test_case_result['result'] = "fail"
6161
62 results['test_results'].append(test_case_result)62 results['test_results'].append(test_case_result)
63 savebundlefile("monkey", results, timestring)63 savebundlefile("monkey", results, timestring, self.context.lava_result_dir)
64 self.client.proc.sendline("")64 self.client.proc.sendline("")
6565
6666
@@ -146,5 +146,5 @@
146 test_case_result['result'] = "fail"146 test_case_result['result'] = "fail"
147147
148 results['test_results'].append(test_case_result)148 results['test_results'].append(test_case_result)
149 savebundlefile("basic", results, timestring)149 savebundlefile("basic", results, timestring, self.context.lava_result_dir)
150 self.client.proc.sendline("")150 self.client.proc.sendline("")
151151
=== modified file 'lava_dispatcher/actions/android_deploy.py'
--- lava_dispatcher/actions/android_deploy.py 2011-09-05 21:52:35 +0000
+++ lava_dispatcher/actions/android_deploy.py 2011-09-09 01:07:35 +0000
@@ -20,7 +20,6 @@
20# along with this program; if not, see <http://www.gnu.org/licenses>.20# along with this program; if not, see <http://www.gnu.org/licenses>.
2121
22from lava_dispatcher.actions import BaseAction22from lava_dispatcher.actions import BaseAction
23from lava_dispatcher.config import LAVA_IMAGE_TMPDIR, LAVA_IMAGE_URL
24import os23import os
25import sys24import sys
26import shutil25import shutil
@@ -31,6 +30,8 @@
3130
32class cmd_deploy_linaro_android_image(BaseAction):31class cmd_deploy_linaro_android_image(BaseAction):
33 def run(self, boot, system, data, use_cache=True):32 def run(self, boot, system, data, use_cache=True):
33 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
34 LAVA_IMAGE_URL = self.context.lava_image_url
34 client = self.client35 client = self.client
35 print "deploying Android on %s" % client.hostname36 print "deploying Android on %s" % client.hostname
36 print " boot: %s" % boot37 print " boot: %s" % boot
@@ -85,14 +86,16 @@
85 :param data_url: url of the Linaro Android data tarball to download86 :param data_url: url of the Linaro Android data tarball to download
86 :param use_cache: whether or not to use the cached copy (if it exists)87 :param use_cache: whether or not to use the cached copy (if it exists)
87 """88 """
89 lava_cachedir = self.context.lava_cachedir
90 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
88 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)91 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
89 tarball_dir = self.tarball_dir92 tarball_dir = self.tarball_dir
90 os.chmod(tarball_dir, 0755)93 os.chmod(tarball_dir, 0755)
9194
92 if use_cache:95 if use_cache:
93 boot_path = download_with_cache(boot_url, tarball_dir)96 boot_path = download_with_cache(boot_url, tarball_dir, lava_cachedir)
94 system_path = download_with_cache(system_url, tarball_dir)97 system_path = download_with_cache(system_url, tarball_dir, lava_cachedir)
95 data_path = download_with_cache(data_url, tarball_dir)98 data_path = download_with_cache(data_url, tarball_dir, lava_cachedir)
96 else:99 else:
97 boot_path = download(boot_url, tarball_dir)100 boot_path = download(boot_url, tarball_dir)
98 system_path = download(system_url, tarball_dir)101 system_path = download(system_url, tarball_dir)
99102
=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py 2011-09-08 04:23:59 +0000
+++ lava_dispatcher/actions/deploy.py 2011-09-09 01:07:35 +0000
@@ -26,13 +26,14 @@
26from tempfile import mkdtemp26from tempfile import mkdtemp
2727
28from lava_dispatcher.actions import BaseAction28from lava_dispatcher.actions import BaseAction
29from lava_dispatcher.config import LAVA_IMAGE_TMPDIR, LAVA_IMAGE_URL
30from lava_dispatcher.utils import download, download_with_cache29from lava_dispatcher.utils import download, download_with_cache
31from lava_dispatcher.client import CriticalError30from lava_dispatcher.client import CriticalError
3231
3332
34class cmd_deploy_linaro_image(BaseAction):33class cmd_deploy_linaro_image(BaseAction):
35 def run(self, hwpack, rootfs, use_cache=True):34 def run(self, hwpack, rootfs, use_cache=True):
35 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
36 LAVA_IMAGE_URL = self.context.lava_image_url
36 client = self.client37 client = self.client
37 print "deploying on %s" % client.hostname38 print "deploying on %s" % client.hostname
38 print " hwpack: %s" % hwpack39 print " hwpack: %s" % hwpack
@@ -112,30 +113,31 @@
112 :param hwpack_url: url of the Linaro hwpack to download113 :param hwpack_url: url of the Linaro hwpack to download
113 :param rootfs_url: url of the Linaro image to download114 :param rootfs_url: url of the Linaro image to download
114 """115 """
116 lava_cachedir = self.context.lava_cachedir
117 LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
115 client = self.client118 client = self.client
116 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)119 self.tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
117 tarball_dir = self.tarball_dir120 tarball_dir = self.tarball_dir
118 os.chmod(tarball_dir, 0755)121 os.chmod(tarball_dir, 0755)
119 if use_cache:122 if use_cache:
120 hwpack_path = download_with_cache(hwpack_url, tarball_dir)123 hwpack_path = download_with_cache(hwpack_url, tarball_dir, lava_cachedir)
121 rootfs_path = download_with_cache(rootfs_url, tarball_dir)124 rootfs_path = download_with_cache(rootfs_url, tarball_dir, lava_cachedir)
122 else:125 else:
123 hwpack_path = download(hwpack_url, tarball_dir)126 hwpack_path = download(hwpack_url, tarball_dir)
124 rootfs_path = download(rootfs_url, tarball_dir)127 rootfs_path = download(rootfs_url, tarball_dir)
125128
126 image_file = os.path.join(tarball_dir, "lava.img")129 image_file = os.path.join(tarball_dir, "lava.img")
127 board = client.board
128 cmd = ("sudo linaro-media-create --hwpack-force-yes --dev %s "130 cmd = ("sudo linaro-media-create --hwpack-force-yes --dev %s "
129 "--image_file %s --binary %s --hwpack %s --image_size 3G" %131 "--image_file %s --binary %s --hwpack %s --image_size 3G" %
130 (board.type, image_file, rootfs_path, hwpack_path))132 (client.device_type, image_file, rootfs_path, hwpack_path))
131 rc, output = getstatusoutput(cmd)133 rc, output = getstatusoutput(cmd)
132 if rc:134 if rc:
133 shutil.rmtree(tarball_dir)135 shutil.rmtree(tarball_dir)
134 tb = traceback.format_exc()136 tb = traceback.format_exc()
135 client.sio.write(tb)137 client.sio.write(tb)
136 raise RuntimeError("linaro-media-create failed: %s" % output)138 raise RuntimeError("linaro-media-create failed: %s" % output)
137 boot_offset = self._get_partition_offset(image_file, board.boot_part)139 boot_offset = self._get_partition_offset(image_file, client.boot_part)
138 root_offset = self._get_partition_offset(image_file, board.root_part)140 root_offset = self._get_partition_offset(image_file, client.root_part)
139 boot_tgz = os.path.join(tarball_dir, "boot.tgz")141 boot_tgz = os.path.join(tarball_dir, "boot.tgz")
140 root_tgz = os.path.join(tarball_dir, "root.tgz")142 root_tgz = os.path.join(tarball_dir, "root.tgz")
141 try:143 try:
@@ -159,7 +161,7 @@
159 client.run_cmd_master('mount /dev/disk/by-label/testrootfs /mnt/root')161 client.run_cmd_master('mount /dev/disk/by-label/testrootfs /mnt/root')
160 client.run_cmd_master(162 client.run_cmd_master(
161 'wget -qO- %s |tar --numeric-owner -C /mnt/root -xzf -' % rootfs,163 'wget -qO- %s |tar --numeric-owner -C /mnt/root -xzf -' % rootfs,
162 timeout = 3600)164 timeout=3600)
163 client.run_cmd_master('echo linaro > /mnt/root/etc/hostname')165 client.run_cmd_master('echo linaro > /mnt/root/etc/hostname')
164 #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true166 #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true
165 #prevents a serious problem where packages getting installed that167 #prevents a serious problem where packages getting installed that
166168
=== modified file 'lava_dispatcher/actions/launch_control.py' (properties changed: +x to -x)
--- lava_dispatcher/actions/launch_control.py 2011-09-06 09:35:13 +0000
+++ lava_dispatcher/actions/launch_control.py 2011-09-09 01:07:35 +0000
@@ -25,8 +25,6 @@
25import shutil25import shutil
26import tarfile26import tarfile
27from lava_dispatcher.actions import BaseAction27from lava_dispatcher.actions import BaseAction
28from lava_dispatcher.config import LAVA_RESULT_DIR
29from lava_dispatcher.config import LAVA_IMAGE_TMPDIR
30from lava_dispatcher.client import NetworkError28from lava_dispatcher.client import NetworkError
31from lava_dispatcher.utils import download29from lava_dispatcher.utils import download
32from tempfile import mkdtemp30from tempfile import mkdtemp
@@ -40,9 +38,9 @@
40 allow_none=True, use_datetime=True)38 allow_none=True, use_datetime=True)
4139
42 #Upload bundle files to dashboard40 #Upload bundle files to dashboard
43 bundle_list = os.listdir("/tmp/%s" % LAVA_RESULT_DIR)41 bundle_list = os.listdir("/tmp/%s" % self.context.lava_result_dir)
44 for bundle_name in bundle_list:42 for bundle_name in bundle_list:
45 bundle = "/tmp/%s/%s" % (LAVA_RESULT_DIR, bundle_name)43 bundle = "/tmp/%s/%s" % (self.context.lava_result_dir, bundle_name)
46 f = open(bundle)44 f = open(bundle)
47 content = f.read()45 content = f.read()
48 f.close()46 f.close()
@@ -53,6 +51,7 @@
53 print "xmlrpclib.Fault occurred"51 print "xmlrpclib.Fault occurred"
54 print "Fault code: %d" % err.faultCode52 print "Fault code: %d" % err.faultCode
55 print "Fault string: %s" % err.faultString53 print "Fault string: %s" % err.faultString
54
56 # After uploading, remove the bundle file at the host side55 # After uploading, remove the bundle file at the host side
57 os.remove(bundle)56 os.remove(bundle)
5857
@@ -79,49 +78,50 @@
79 client.run_cmd_master('mkdir -p /mnt/root')78 client.run_cmd_master('mkdir -p /mnt/root')
80 client.run_cmd_master(79 client.run_cmd_master(
81 'mount /dev/disk/by-label/%s /mnt/root' % result_disk)80 'mount /dev/disk/by-label/%s /mnt/root' % result_disk)
82 client.run_cmd_master('mkdir -p /tmp/%s' % LAVA_RESULT_DIR)81 client.run_cmd_master('mkdir -p /tmp/%s' % self.context.lava_result_dir)
83 client.run_cmd_master(82 client.run_cmd_master(
84 'cp /mnt/root/%s/*.bundle /tmp/%s' % (LAVA_RESULT_DIR,83 'cp /mnt/root/%s/*.bundle /tmp/%s' % (self.context.lava_result_dir,
85 LAVA_RESULT_DIR))84 self.context.lava_result_dir))
86 client.run_cmd_master('umount /mnt/root')85 client.run_cmd_master('umount /mnt/root')
8786
88 #Create tarball of all results87 #Create tarball of all results
89 client.run_cmd_master('cd /tmp')88 client.run_cmd_master('cd /tmp')
90 client.run_cmd_master(89 client.run_cmd_master(
91 'tar czf /tmp/lava_results.tgz -C /tmp/%s .' % LAVA_RESULT_DIR)90 'tar czf /tmp/lava_results.tgz -C /tmp/%s .' % self.context.lava_result_dir)
9291
93 master_ip = client.get_master_ip()92 master_ip = client.get_master_ip()
94 if master_ip != None:93 if master_ip == None:
95 # Set 80 as server port94 raise NetworkError("Getting master image IP address failed")
96 client.run_cmd_master('python -m SimpleHTTPServer 80 &> /dev/null &')95 # Set 80 as server port
97 time.sleep(3)96 client.run_cmd_master('python -m SimpleHTTPServer 80 &> /dev/null &')
9897 time.sleep(3)
99 result_tarball = "http://%s/lava_results.tgz" % master_ip98
100 tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)99 result_tarball = "http://%s/lava_results.tgz" % master_ip
101 os.chmod(tarball_dir, 0755)100 tarball_dir = mkdtemp(dir=self.context.lava_image_tmpdir)
102101 os.chmod(tarball_dir, 0755)
103 # download test result with a retry mechanism102
104 # set retry timeout to 2mins103 # download test result with a retry mechanism
105 now = time.time()104 # set retry timeout to 2mins
106 timeout = 120105 now = time.time()
107 while time.time() < now+timeout:106 timeout = 120
108 try:107 while time.time() < now+timeout:
109 result_path = download(result_tarball, tarball_dir)108 try:
110 except:109 result_path = download(result_tarball, tarball_dir)
111 if time.time() >= now+timeout:110 except:
112 raise111 if time.time() >= now+timeout:
113112 raise
114 client.run_cmd_master('kill %1')113
115114 client.run_cmd_master('kill %1')
116 tar = tarfile.open(result_path)115
117 for tarinfo in tar:116 tar = tarfile.open(result_path)
118 if os.path.splitext(tarinfo.name)[1] == ".bundle":117 for tarinfo in tar:
119 f = tar.extractfile(tarinfo)118 if os.path.splitext(tarinfo.name)[1] == ".bundle":
120 content = f.read()119 f = tar.extractfile(tarinfo)
121 f.close()120 content = f.read()
122 self.all_bundles.append(json.loads(content))121 f.close()
123 tar.close()122 self.all_bundles.append(json.loads(content))
124 shutil.rmtree(tarball_dir)123 tar.close()
124 shutil.rmtree(tarball_dir)
125125
126 #flush the serial log126 #flush the serial log
127 client.run_shell_command("")127 client.run_shell_command("")
128128
=== modified file 'lava_dispatcher/actions/lava-test.py' (properties changed: +x to -x)
--- lava_dispatcher/actions/lava-test.py 2011-09-08 04:23:59 +0000
+++ lava_dispatcher/actions/lava-test.py 2011-09-09 01:07:35 +0000
@@ -24,7 +24,7 @@
24import traceback24import traceback
25from lava_dispatcher.actions import BaseAction25from lava_dispatcher.actions import BaseAction
26from lava_dispatcher.client import OperationFailed26from lava_dispatcher.client import OperationFailed
27from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR27
2828
2929
30def _setup_testrootfs(client):30def _setup_testrootfs(client):
@@ -50,10 +50,9 @@
50 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf')50 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf')
51 cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'51 cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"'
52 '| sort -r | xargs umount')52 '| sort -r | xargs umount')
53 client.run_cmd_master(53 client.run_cmd_master(cmd)
54 cmd)54 client.run_cmd_master('umount /mnt/root')
55 client.run_cmd_master(55
56 'umount /mnt/root')
5756
5857
59def _install_lava_test(client):58def _install_lava_test(client):
@@ -73,11 +72,10 @@
73 client.run_shell_command(72 client.run_shell_command(
74 'chroot /mnt/root lava-test help',73 'chroot /mnt/root lava-test help',
75 response="list-test", timeout=10)74 response="list-test", timeout=10)
76 client.proc.expect(MASTER_STR, timeout=10)75 client.proc.expect(client.master_str, timeout=10)
77 except:76 except:
78 tb = traceback.format_exc()77 tb = traceback.format_exc()
79 client.sio.write(tb)78 client.sio.write(tb)
80 _teardown_testrootfs(client)
81 raise OperationFailed("lava-test deployment failed")79 raise OperationFailed("lava-test deployment failed")
8280
8381
@@ -86,12 +84,12 @@
86 #Make sure in test image now84 #Make sure in test image now
87 client = self.client85 client = self.client
88 client.in_test_shell()86 client.in_test_shell()
89 client.run_cmd_tester('mkdir -p %s' % LAVA_RESULT_DIR)87 client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir)
90 client.export_display()88 client.export_display()
91 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")89 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
92 client.run_cmd_tester(90 client.run_cmd_tester(
93 'lava-test run %s -o %s/%s.bundle' % (91 'lava-test run %s -o %s/%s.bundle' % (
94 test_name, LAVA_RESULT_DIR, bundle_name),92 test_name, self.context.lava_result_dir, bundle_name),
95 timeout=timeout)93 timeout=timeout)
9694
9795
9896
=== modified file 'lava_dispatcher/android_client.py'
--- lava_dispatcher/android_client.py 2011-09-08 04:23:59 +0000
+++ lava_dispatcher/android_client.py 2011-09-09 01:07:35 +0000
@@ -20,12 +20,9 @@
20import pexpect20import pexpect
21import sys21import sys
22from lava_dispatcher.client import LavaClient, OperationFailed22from lava_dispatcher.client import LavaClient, OperationFailed
23from lava_dispatcher.android_config import BOARDS, TESTER_STR23from utils import string_to_list
2424
25class LavaAndroidClient(LavaClient):25class LavaAndroidClient(LavaClient):
26 def __init__(self, hostname):
27 super(LavaAndroidClient, self).__init__(hostname)
28 self.board = BOARDS[hostname]
2926
30 def run_adb_shell_command(self, dev_id, cmd, response, timeout=-1):27 def run_adb_shell_command(self, dev_id, cmd, response, timeout=-1):
31 adb_cmd = "adb -s %s shell %s" % (dev_id, cmd)28 adb_cmd = "adb -s %s shell %s" % (dev_id, cmd)
@@ -42,7 +39,7 @@
42 """ Check that we are in a shell on the test image39 """ Check that we are in a shell on the test image
43 """40 """
44 self.proc.sendline("")41 self.proc.sendline("")
45 id = self.proc.expect([TESTER_STR , pexpect.TIMEOUT])42 id = self.proc.expect([self.tester_str , pexpect.TIMEOUT])
46 if id == 1:43 if id == 1:
47 raise OperationFailed44 raise OperationFailed
4845
@@ -55,11 +52,11 @@
55 except:52 except:
56 self.hard_reboot()53 self.hard_reboot()
57 self.enter_uboot()54 self.enter_uboot()
58 uboot_cmds = self.board.uboot_cmds55 boot_cmds = string_to_list(self.config.get('boot_cmds_android'))
59 self.proc.sendline(uboot_cmds[0])56 self.proc.sendline(boot_cmds[0])
60 for line in range(1, len(uboot_cmds)):57 for line in range(1, len(boot_cmds)):
61 self.proc.expect("#")58 self.proc.expect("#")
62 self.proc.sendline(uboot_cmds[line])59 self.proc.sendline(boot_cmds[line])
63 self.in_test_shell()60 self.in_test_shell()
64 self.proc.sendline("export PS1=\"root@linaro: \"")61 self.proc.sendline("export PS1=\"root@linaro: \"")
6562
@@ -106,7 +103,7 @@
106103
107 def check_adb_status(self):104 def check_adb_status(self):
108 # XXX: IP could be assigned in other way in the validation farm105 # XXX: IP could be assigned in other way in the validation farm
109 network_interface = self.board.default_network_interface 106 network_interface = self.default_network_interface
110 try:107 try:
111 self.run_cmd_tester(108 self.run_cmd_tester(
112 'netcfg %s dhcp' % network_interface, timeout=60)109 'netcfg %s dhcp' % network_interface, timeout=60)
113110
=== removed file 'lava_dispatcher/android_config.py'
--- lava_dispatcher/android_config.py 2011-08-16 00:15:08 +0000
+++ lava_dispatcher/android_config.py 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
1# Copyright (C) 2011 Linaro Limited
2#
3# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
4#
5# This file is part of LAVA Dispatcher.
6#
7# LAVA Dispatcher is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# LAVA Dispatcher is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, see <http://www.gnu.org/licenses>.
19
20from lava_dispatcher.config import Board
21
22class BeagleBoard(Board):
23 uboot_cmds = ["mmc init",
24 "mmc part 0",
25 "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage;"
26 "fatload mmc 0:3 0x81600000 uInitrd;"
27 "bootm 0x80000000 0x81600000'",
28 "setenv bootargs 'console=tty0 console=ttyO2,115200n8 "
29 "rootwait rw earlyprintk fixrtc nocompcache "
30 "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60 "
31 "init=/init androidboot.console=ttyO2'",
32 "boot"]
33 type = "beagle"
34
35
36class PandaBoard(Board):
37 uboot_cmds = ["mmc init",
38 "mmc part 0",
39 "setenv bootcmd 'fatload mmc 0:3 0x80200000 uImage;"
40 "fatload mmc 0:3 0x81600000 uInitrd;"
41 "bootm 0x80200000 0x81600000'",
42 "setenv bootargs 'console=tty0 console=ttyO2,115200n8 "
43 "rootwait rw earlyprintk fixrtc nocompcache vram=32M "
44 "omapfb.vram=0:8M mem=456M@0x80000000 mem=512M@0xA0000000 "
45 "omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60 "
46 "init=/init androidboot.console=ttyO2'",
47 "boot"]
48 type = "panda"
49
50
51#Here, it still needs to maintain a map from boardid to board, for there is only
52#boardid in jobfile.json
53BOARDS = {
54 "beagle01": BeagleBoard,
55 "beagle02": BeagleBoard,
56 "beagle03": BeagleBoard,
57 "beagle04": BeagleBoard,
58 "panda01": PandaBoard,
59 "panda02": PandaBoard,
60 "panda03": PandaBoard,
61 "panda04": PandaBoard,
62 }
63
64#Test image recognization string
65TESTER_STR = "root@linaro:"
660
=== modified file 'lava_dispatcher/android_util.py'
--- lava_dispatcher/android_util.py 2011-06-27 04:55:08 +0000
+++ lava_dispatcher/android_util.py 2011-09-09 01:07:35 +0000
@@ -22,11 +22,10 @@
22from datetime import datetime22from datetime import datetime
23import json23import json
24import subprocess24import subprocess
25from lava_dispatcher.config import LAVA_RESULT_DIR
26import time25import time
2726
28# TODO: Result saving could be replaced by linaro_dashboard_bundle probably.27# TODO: Result saving could be replaced by linaro_dashboard_bundle probably.
29def savebundlefile(testname, results, starttime):28def savebundlefile(testname, results, starttime, lava_result_dir):
30 """29 """
31 Save results as .bundle file under /tmp/LAVA_RESULT_DIR/30 Save results as .bundle file under /tmp/LAVA_RESULT_DIR/
32 """31 """
@@ -42,9 +41,9 @@
42 testdata['test_runs'] = test_runs41 testdata['test_runs'] = test_runs
43 testdata['test_runs'][0].update(results)42 testdata['test_runs'][0].update(results)
44 bundle = testdata43 bundle = testdata
45 subprocess.call(["mkdir", "-p", "/tmp/%s" % LAVA_RESULT_DIR])44 subprocess.call(["mkdir", "-p", "/tmp/%s" % lava_result_dir])
46 # The file name should be unique to be distinguishable from others45 # The file name should be unique to be distinguishable from others
47 filename = "/tmp/%s/" % LAVA_RESULT_DIR + testname + \46 filename = "/tmp/%s/" % lava_result_dir + testname + \
48 str(time.mktime(datetime.utcnow().timetuple())) + ".bundle"47 str(time.mktime(datetime.utcnow().timetuple())) + ".bundle"
49 with open(filename, "wt") as stream:48 with open(filename, "wt") as stream:
50 json.dump(bundle, stream)49 json.dump(bundle, stream)
5150
=== modified file 'lava_dispatcher/client.py'
--- lava_dispatcher/client.py 2011-09-08 04:23:59 +0000
+++ lava_dispatcher/client.py 2011-09-09 01:07:35 +0000
@@ -22,35 +22,56 @@
22import sys22import sys
23import time23import time
24from cStringIO import StringIO24from cStringIO import StringIO
2525from utils import string_to_list
26from lava_dispatcher.config import (
27 BOARDS,
28 LAVA_SERVER_IP,
29 MASTER_STR,
30 TESTER_STR,
31 )
32
3326
34class LavaClient(object):27class LavaClient(object):
35 def __init__(self, hostname):28 def __init__(self, context, config):
36 self._master_str = MASTER_STR29 self.context = context
37 self._tester_str = TESTER_STR30 self.config = config
38 cmd = "conmux-console %s" % hostname31 cmd = "conmux-console %s" % self.hostname
39 self.sio = SerialIO(sys.stdout)32 self.sio = SerialIO(sys.stdout)
40 self.proc = pexpect.spawn(cmd, timeout=3600, logfile=self.sio)33 self.proc = pexpect.spawn(cmd, timeout=3600, logfile=self.sio)
41 #serial can be slow, races do funny things if you don't increase delay34 #serial can be slow, races do funny things if you don't increase delay
42 self.proc.delaybeforesend=135 self.proc.delaybeforesend=1
43 self.hostname = hostname36
44 # will eventually come from the database37 def device_option(self, option_name):
45 self.board = BOARDS[hostname]38 return self.config.get(option_name)
39
40 def device_option_int(self, option_name):
41 return self.config.getint(option_name)
42
43 @property
44 def hostname(self):
45 return self.device_option("hostname")
46
47 @property
48 def tester_str(self):
49 return self.device_option("TESTER_STR")
4650
47 @property51 @property
48 def master_str(self):52 def master_str(self):
49 return self._master_str53 return self.device_option("MASTER_STR")
5054
51 @property55 @property
52 def tester_str(self):56 def boot_cmds(self):
53 return self._tester_str57 uboot_str = self.device_option("boot_cmds")
58 return string_to_list(uboot_str)
59
60 @property
61 def device_type(self):
62 return self.device_option("device_type")
63
64 @property
65 def boot_part(self):
66 return self.device_option_int("boot_part")
67
68 @property
69 def root_part(self):
70 return self.device_option_int("root_part")
71
72 @property
73 def default_network_interface(self):
74 return self.device_option("default_network_interface")
5475
55 def in_master_shell(self):76 def in_master_shell(self):
56 """ Check that we are in a shell on the master image77 """ Check that we are in a shell on the master image
@@ -91,16 +112,16 @@
91 except:112 except:
92 self.hard_reboot()113 self.hard_reboot()
93 self.enter_uboot()114 self.enter_uboot()
94 uboot_cmds = self.board.uboot_cmds115 boot_cmds = self.boot_cmds
95 self.proc.sendline(uboot_cmds[0])116 self.proc.sendline(boot_cmds[0])
96 for line in range(1, len(uboot_cmds)):117 for line in range(1, len(boot_cmds)):
97 if self.board.type in ["mx51evk", "mx53loco"]:118 if self.device_type in ["mx51evk", "mx53loco"]:
98 self.proc.expect(">", timeout=300)119 self.proc.expect(">", timeout=300)
99 elif self.board.type == "snowball_sd":120 elif self.device_type == "snowball_sd":
100 self.proc.expect("\$", timeout=300)121 self.proc.expect("\$", timeout=300)
101 else:122 else:
102 self.proc.expect("#", timeout=300)123 self.proc.expect("#", timeout=300)
103 self.proc.sendline(uboot_cmds[line])124 self.proc.sendline(boot_cmds[line])
104 self.in_test_shell()125 self.in_test_shell()
105126
106 def enter_uboot(self):127 def enter_uboot(self):
@@ -131,7 +152,8 @@
131 self.run_shell_command(cmd, self.tester_str, timeout)152 self.run_shell_command(cmd, self.tester_str, timeout)
132153
133 def check_network_up(self):154 def check_network_up(self):
134 self.proc.sendline("LC_ALL=C ping -W4 -c1 %s" % LAVA_SERVER_IP)155 lava_server_ip = self.context.lava_server_ip
156 self.proc.sendline("LC_ALL=C ping -W4 -c1 %s" % lava_server_ip)
135 id = self.proc.expect(["1 received", "0 received",157 id = self.proc.expect(["1 received", "0 received",
136 "Network is unreachable"], timeout=5)158 "Network is unreachable"], timeout=5)
137 self.proc.expect(self.master_str)159 self.proc.expect(self.master_str)
@@ -154,7 +176,7 @@
154 #pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"176 #pattern1 = ".*\n(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
155 pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)"177 pattern1 = "(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)"
156 cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"178 cmd = ("ifconfig %s | grep 'inet addr' | awk -F: '{print $2}' |"
157 "awk '{print $1}'" % self.board.default_network_interface)179 "awk '{print $1}'" % self.default_network_interface)
158 self.proc.sendline(cmd)180 self.proc.sendline(cmd)
159 #if running from ipython, it needs another Enter, don't know why:181 #if running from ipython, it needs another Enter, don't know why:
160 #self.proc.sendline("")182 #self.proc.sendline("")
161183
=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py 2011-08-16 00:15:08 +0000
+++ lava_dispatcher/config.py 2011-09-09 01:07:35 +0000
@@ -18,113 +18,72 @@
18# along18# along
19# with this program; if not, see <http://www.gnu.org/licenses>.19# with this program; if not, see <http://www.gnu.org/licenses>.
2020
21"""21from ConfigParser import ConfigParser
22This is an ugly hack, the uboot commands for a given board type and the board22import os
23type of a test machine need to come from the device registry. This is an23import StringIO
24easy way to look it up for now though, just to show the rest of the code24
25around it25
26"""26default_config_path = os.path.join(
2727 os.path.dirname(__file__), 'default-config')
28class Board:28
29 uboot_cmds = None29
30 type = None30def load_config_paths(name):
31 # boot partition number, counting from 131 for directory in [os.path.expanduser("~/.config"),
32 boot_part = 132 "/etc/xdg", default_config_path]:
33 # root partition number, counting from 133 path = os.path.join(directory, name)
34 root_part = 234 if os.path.isdir(path):
35 default_network_interface = "eth0"35 yield path
3636
37class BeagleBoard(Board):37
38 uboot_cmds = ["mmc init",38def _read_into(path, cp):
39 "mmc part 0",39 s = StringIO.StringIO()
40 "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "40 s.write('[DEFAULT]\n')
41 "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",41 s.write(open(path).read())
42 "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "42 s.seek(0)
43 "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "43 cp.readfp(s)
44 "vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",44
45 "boot"]45
46 type = "beagle"46def _get_config(name, cp=None):
4747 """Read a config file named name + '.conf'.
48class PandaBoard(Board):48
49 uboot_cmds = ["mmc init",49 This checks and loads files from the source tree, site wide location and
50 "mmc part 0",50 home directory -- in that order, so home dir settings override site
51 "setenv bootcmd 'fatload mmc 0:3 0x80200000 uImage; fatload mmc "51 settings which override source settings.
52 "0:3 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",52 """
53 "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "53 config_files = []
54 "root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache "54 for directory in load_config_paths('lava-dispatcher'):
55 "vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000'",55 path = os.path.join(directory, '%s.conf' % name)
56 "boot"]56 if os.path.exists(path):
57 type = "panda"57 config_files.append(path)
5858 if not config_files:
59class Snowball(Board):59 raise Exception("no config files named %r found" % (name + ".conf"))
60 uboot_cmds = ["mmc init",60 config_files.reverse()
61 "mmc rescan 1",61 if cp is None:
62 "setenv bootcmd 'fat load mmc 1:3 0x00100000 /uImage;"62 cp = ConfigParser()
63 "bootm 0x00100000'",63 print "About to read %s" % str(config_files)
64 "setenv bootargs 'console=tty0 console=ttyAMA2,115200n8 "64 for path in config_files:
65 "root=LABEL=testrootfs rootwait ro earlyprintk rootdelay=1 "65 _read_into(path, cp)
66 "fixrtc nocompcache mem=96M@0 mem_modem=32M@96M mem=44M@128M "66 return cp
67 "pmem=22M@172M mem=30M@194M mem_mali=32M@224M pmem_hwb=54M@256M "67
68 "hwmem=48M@302M mem=152M@360M'",68
69 "boot"]69class ConfigWrapper(object):
70 type = "snowball_sd"70 def __init__(self, cp):
7171 self.cp = cp
72class Mx51evkBoard(Board):72 def get(self, key):
73 boot_part = 273 return self.cp.get("DEFAULT", key)
74 root_part = 374 def getint(self, key):
75 uboot_cmds = ["mmc init",75 return self.cp.getint("DEFAULT", key)
76 "mmc part 0",76
77 "setenv bootcmd 'fatload mmc 0:5 0x90000000 uImage; fatload mmc 0:5 "77
78 "0x92000000 uInitrd; fatload mmc 0:5 0x91ff0000 board.dtb; bootm "78def get_config(name):
79 "0x90000000 0x92000000 0x91ff0000'",79 return ConfigWrapper(_get_config(name))
80 "setenv bootargs ' console=tty0 console=ttymxc0,115200n8 "80
81 "root=LABEL=testrootfs rootwait ro'",81
82 "boot"]82def get_device_config(name):
83 type = "mx51evk"83 device_config = _get_config("devices/%s" % name)
8484 cp = _get_config("device-defaults")
85class Mx53locoBoard(Board):85 _get_config(
86 boot_part = 286 "device-types/%s" % device_config.get('DEFAULT', 'device_type'), cp)
87 root_part = 387 _get_config("devices/%s" % name, cp)
88 uboot_cmds = ["mmc init",88 cp.set("DEFAULT", "hostname", name)
89 "mmc part 0",89 return ConfigWrapper(cp)
90 "setenv bootcmd 'fatload mmc 0:5 0x70800000 uImage; fatload mmc "
91 "0:5 0x71800000 uInitrd; bootm 0x70800000 0x71800000'",
92 "setenv bootargs ' console=tty0 console=ttymxc0,115200n8 "
93 "root=LABEL=testrootfs rootwait ro'",
94 "boot"]
95 type = "mx53loco"
96
97#Here, it still needs to maintain a map from boardid to board, for there is
98#only boardid in jobfile.json
99BOARDS = {
100 "panda01": PandaBoard,
101 "panda02": PandaBoard,
102 "panda03": PandaBoard,
103 "panda04": PandaBoard,
104 "beaglexm01": BeagleBoard,
105 "beaglexm02": BeagleBoard,
106 "beaglexm03": BeagleBoard,
107 "beaglexm04": BeagleBoard,
108 "mx51evk01": Mx51evkBoard,
109 "mx53loco01": Mx53locoBoard,
110 "snowball01": Snowball,
111 "snowball02": Snowball,
112 "snowball03": Snowball,
113 "snowball04": Snowball,
114 }
115
116#Main LAVA server IP in the boards farm
117LAVA_SERVER_IP = "192.168.1.10"
118#Location for hosting rootfs/boot tarballs extracted from images
119LAVA_IMAGE_TMPDIR = "/linaro/images/tmp"
120#URL where LAVA_IMAGE_TMPDIR can be accessed remotely
121LAVA_IMAGE_URL = "http://%s/images/tmp" % LAVA_SERVER_IP
122#Default test result storage path
123LAVA_RESULT_DIR = "/lava/results"
124#Location for caching downloaded artifacts such as hwpacks and images
125LAVA_CACHEDIR = "/linaro/images/cache"
126
127#Master image recognization string
128MASTER_STR = "root@master:"
129#Test image recognization string
130TESTER_STR = "root@linaro:"
13190
=== added directory 'lava_dispatcher/default-config'
=== added directory 'lava_dispatcher/default-config/lava-dispatcher'
=== added file 'lava_dispatcher/default-config/lava-dispatcher/README'
--- lava_dispatcher/default-config/lava-dispatcher/README 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/README 2011-09-09 01:07:35 +0000
@@ -0,0 +1,41 @@
1Configuration files for lava-dispatcher
2=======================================
3
4lava-dispatcher looks for files in:
5
6 * Alongside the installation/source tree for the default values
7 (i.e. this directory).
8
9 * /etc/xdg/lava-dispatcher for system-wide settings.
10
11 * ~/.config/lava-dispatcher for user settings.
12
13Each config directory can contain two files and two directories:
14
15 * lava-dispatcher.conf
16
17 This file defines global settings of the dispatcher. You will
18 almost certainly need to customize LAVA_SERVER_IP for your install.
19
20 * device-defaults.conf
21
22 This file defines default values for all devices. You probably
23 won't need to customize it.
24
25 * device-types/
26
27 This directory contains a config file for each device type. You
28 probably won't need to customize the settings for device types that
29 are already supported by lava-dispatcher, but if you are working on
30 supporting a new class of device, you will need to add a file here.
31
32 Note that the device-type name must match the --dev argument to
33 linaro-media-create.
34
35 * devices/
36
37 This directory contains a file per device that can be targeted by
38 lava-dispatcher. For the most part this file just needs to contain
39 a line "device_type = <device type>", although other settings can
40 be included here. You will definitely need to tell lava-dispatcher
41 about the devices you have!
042
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,50 @@
1# The default device settings.
2
3# All device settings default to these values unless they are
4# overwritten by the specific device type file
5# (device-types/${TYPE}.conf) or the specific device file
6# (devices/${DEVICE}.conf).
7
8# The client_type. Only 'serial' (meaning we communicate with the
9# device over a serial line via conmux) is supported today but 'qemu'
10# and 'ssh' are coming.
11client_type = serial
12
13# The bootloader commands to boot the device into the test image (we
14# assume that the device boots into the master image without bootloader
15# intervention).
16#
17# XXX should be called # boot_test_image_commands ?
18boot_cmds =
19
20# The bootloader commands to boot the device into an android-based test
21# image.
22#
23# XXX should be called # boot_android_test_image_commands ?
24boot_cmds_android =
25
26# The device type. Settings in device-types/${TYPE}.conf override
27# settings in this file, but are overridden by the
28# devices/${DEVICE}.conf file.
29type =
30
31# The network interface that comes up by default
32default_network_interface = eth0
33
34# boot partition number, counting from 1
35#
36# This is used to divide up the image produced by linaro-media-create
37# into sections to write onto the device.
38boot_part = 1
39
40# root partition number, counting from 1
41#
42# This is used to divide up the image produced by linaro-media-create
43# into sections to write onto the device.
44root_part = 2
45
46# Master image recognization string
47MASTER_STR = root@master:
48
49# Test image recognization string
50TESTER_STR = root@linaro:
051
=== added directory 'lava_dispatcher/default-config/lava-dispatcher/device-types'
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/beagle-xm.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,20 @@
1boot_cmds = mmc init,
2 mmc part 0,
3 setenv bootcmd "'fatload mmc 0:3 0x80000000 uImage;
4 fatload mmc 0:3 0x81600000 uInitrd;
5 bootm 0x80000000 0x81600000'",
6 setenv bootargs "' console=tty0 console=ttyO2,115200n8
7 root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache
8 vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60'",
9 boot
10
11boot_cmds_android = mmc init,
12 mmc part 0,
13 setenv bootcmd "'fatload mmc 0:3 0x80000000 uImage;
14 fatload mmc 0:3 0x81600000 uInitrd;
15 bootm 0x80000000 0x81600000'",
16 setenv bootargs "'console=tty0 console=ttyO2,115200n8
17 rootwait rw earlyprintk fixrtc nocompcache
18 vram=12M omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60
19 init=/init androidboot.console=ttyO2'",
20 boot
021
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/mx51evk.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,10 @@
1boot_part = 2
2root_part = 3
3boot_cmds = mmc init,
4 mmc part 0,
5 setenv bootcmd "'fatload mmc 0:5 0x90000000 uImage; fatload mmc 0:5
6 0x92000000 uInitrd; fatload mmc 0:5 0x91ff0000 board.dtb; bootm
7 0x90000000 0x92000000 0x91ff0000'",
8 setenv bootargs "' console=tty0 console=ttymxc0,115200n8
9 root=LABEL=testrootfs rootwait ro'",
10 boot
011
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,9 @@
1boot_part = 2
2root_part = 3
3boot_cmds = mmc init,
4 mmc part 0,
5 setenv bootcmd "'fatload mmc 0:5 0x70800000 uImage; fatload mmc
6 0:5 0x71800000 uInitrd; bootm 0x70800000 0x71800000'",
7 setenv bootargs "' console=tty0 console=ttymxc0,115200n8
8 root=LABEL=testrootfs rootwait ro'",
9 boot
010
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,19 @@
1boot_cmds = mmc init,
2 mmc part 0,
3 setenv bootcmd "'fatload mmc 0:3 0x80200000 uImage; fatload mmc
4 0:3 0x81600000 uInitrd; bootm 0x80200000 0x81600000'",
5 setenv bootargs "' console=tty0 console=ttyO2,115200n8
6 root=LABEL=testrootfs rootwait ro earlyprintk fixrtc nocompcache
7 vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000'",
8 boot
9boot_cmds_android = mmc init,
10 mmc part 0,
11 setenv bootcmd "'fatload mmc 0:3 0x80200000 uImage;
12 fatload mmc 0:3 0x81600000 uInitrd;
13 bootm 0x80200000 0x81600000'",
14 setenv bootargs "'console=tty0 console=ttyO2,115200n8
15 rootwait rw earlyprintk fixrtc nocompcache vram=32M
16 omapfb.vram=0:8M mem=456M@0x80000000 mem=512M@0xA0000000
17 omapfb.debug=y omapfb.mode=dvi:1280x720MR-16@60
18 init=/init androidboot.console=ttyO2'",
19 boot
020
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/snowball.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,12 @@
1boot_cmds = mmc init,
2 mmc rescan 1,
3 setenv bootcmd "'fat load mmc 1:3 0x00100000 /uImage;
4 bootm 0x00100000'",
5 setenv bootargs "'console=tty0 console=ttyAMA2,115200n8
6 root=LABEL=testrootfs rootwait ro earlyprintk rootdelay=1
7 fixrtc nocompcache mem=96M@0 mem_modem=32M@96M mem=44M@128M
8 pmem=22M@172M mem=30M@194M mem_mali=32M@224M pmem_hwb=54M@256M
9 hwmem=48M@302M mem=152M@360M'",
10 boot
11
12#boot_cmds_android = TBD
0\ No newline at end of file13\ No newline at end of file
114
=== added directory 'lava_dispatcher/default-config/lava-dispatcher/devices'
=== added file 'lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf'
--- lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf 1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/lava-dispatcher.conf 2011-09-09 01:07:35 +0000
@@ -0,0 +1,19 @@
1# General lava-dispatcher settings.
2
3# Main LAVA server IP in the lab.
4#
5# This is the IP the device downloads the image parts from.
6LAVA_SERVER_IP = 192.168.1.10
7
8# Location for rootfs/boot tarballs extracted from images
9LAVA_IMAGE_TMPDIR = /linaro/images/tmp
10
11# URL where LAVA_IMAGE_TMPDIR can be accessed remotely
12LAVA_IMAGE_URL = http://%(LAVA_SERVER_IP)s/images/tmp
13
14# Location on the device for storing test results.
15LAVA_RESULT_DIR = /lava/results
16
17# Location for caching downloaded artifacts such as hwpacks and images
18LAVA_CACHEDIR = /linaro/images/cache
19
020
=== modified file 'lava_dispatcher/tests/test_config.py'
--- lava_dispatcher/tests/test_config.py 2011-06-27 04:55:08 +0000
+++ lava_dispatcher/tests/test_config.py 2011-09-09 01:07:35 +0000
@@ -19,12 +19,15 @@
1919
20from unittest import TestCase20from unittest import TestCase
2121
22from lava_dispatcher.config import BOARDS, LAVA_SERVER_IP22from lava_dispatcher.config import get_config, get_device_config
23from lava_dispatcher.utils import string_to_list
2324
24class TestConfigData(TestCase):25class TestConfigData(TestCase):
25 def test_beagle01_uboot_cmds(self):26 def test_beagle01_uboot_cmds(self):
27 beagle01_config = get_device_config("beaglexm01")
26 expected = [28 expected = [
27 "mmc init",29 "mmc init",
30 "mmc part 0",
28 "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "31 "setenv bootcmd 'fatload mmc 0:3 0x80000000 uImage; fatload mmc "
29 "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",32 "0:3 0x81600000 uInitrd; bootm 0x80000000 0x81600000'",
30 "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "33 "setenv bootargs ' console=tty0 console=ttyO2,115200n8 "
@@ -32,11 +35,12 @@
32 "nocompcache vram=12M omapfb.debug=y "35 "nocompcache vram=12M omapfb.debug=y "
33 "omapfb.mode=dvi:1280x720MR-16@60'",36 "omapfb.mode=dvi:1280x720MR-16@60'",
34 "boot"]37 "boot"]
35 brd = BOARDS["beagle01"]38 uboot_cmds = beagle01_config.get("boot_cmds")
36 uboot_cmds = brd.uboot_cmds39 self.assertEquals(expected, string_to_list(uboot_cmds))
37 self.assertEquals(expected, uboot_cmds)
3840
39 def test_server_ip(self):41 def test_server_ip(self):
42 server_config = get_config("lava-dispatcher")
40 expected = "192.168.1.10"43 expected = "192.168.1.10"
41 self.assertEqual(expected, LAVA_SERVER_IP)44 lava_server_ip = server_config.get("LAVA_SERVER_IP")
45 self.assertEqual(expected, lava_server_ip)
4246
4347
=== modified file 'lava_dispatcher/utils.py'
--- lava_dispatcher/utils.py 2011-08-18 20:38:38 +0000
+++ lava_dispatcher/utils.py 2011-09-09 01:07:35 +0000
@@ -22,8 +22,7 @@
22import shutil22import shutil
23import urllib223import urllib2
24import urlparse24import urlparse
2525from shlex import shlex
26from lava_dispatcher.config import LAVA_CACHEDIR
2726
28def download(url, path=""):27def download(url, path=""):
29 urlpath = urlparse.urlsplit(url).path28 urlpath = urlparse.urlsplit(url).path
@@ -41,8 +40,8 @@
41 raise RuntimeError("Could not retrieve %s" % url)40 raise RuntimeError("Could not retrieve %s" % url)
42 return filename41 return filename
4342
44def download_with_cache(url, path=""):43def download_with_cache(url, path="", cachedir=""):
45 cache_loc = url_to_cache(url)44 cache_loc = url_to_cache(url, cachedir)
46 if os.path.exists(cache_loc):45 if os.path.exists(cache_loc):
47 filename = os.path.basename(cache_loc)46 filename = os.path.basename(cache_loc)
48 file_location = os.path.join(path, filename)47 file_location = os.path.join(path, filename)
@@ -61,8 +60,16 @@
61 #so ignore60 #so ignore
62 return file_location61 return file_location
6362
64def url_to_cache(url):63def url_to_cache(url, cachedir):
65 url_parts = urlparse.urlsplit(url)64 url_parts = urlparse.urlsplit(url)
66 path = os.path.join(LAVA_CACHEDIR, url_parts.netloc,65 path = os.path.join(cachedir, url_parts.netloc,
67 url_parts.path.lstrip(os.sep))66 url_parts.path.lstrip(os.sep))
68 return path67 return path
68
69def string_to_list(string):
70 splitter = shlex(string, posix=True)
71 splitter.whitespace = ","
72 splitter.whitespace_split = True
73 newlines_to_spaces = lambda x: x.replace('\n', ' ')
74 strip_newlines = lambda x: newlines_to_spaces(x).strip(' ')
75 return map(strip_newlines, list(splitter))
6976
=== modified file 'setup.py'
--- setup.py 2011-07-21 16:55:47 +0000
+++ setup.py 2011-09-09 01:07:35 +0000
@@ -12,6 +12,15 @@
12 author='Linaro Validation Team',12 author='Linaro Validation Team',
13 author_email='linaro-dev@lists.linaro.org',13 author_email='linaro-dev@lists.linaro.org',
14 packages=find_packages(),14 packages=find_packages(),
15 package_data= {
16 'lava_dispatcher': [
17 'default-config/lava-dispatcher/lava-dispatcher.conf',
18 'default-config/lava-dispatcher/lava-dispatcher.conf',
19 'default-config/lava-dispatcher/device-defaults.conf',
20 'default-config/lava-dispatcher/device-types/*.conf',
21 'default-config/lava-dispatcher/devices/*.conf',
22 ],
23 },
15 scripts = [24 scripts = [
16 'lava-dispatch'25 'lava-dispatch'
17 ],26 ],

Subscribers

People subscribed via source and target branches