=== modified file 'lava_dispatcher/actions/lava_test_shell.py'
@@ -40,6 +40,7 @@
LAVA_TEST_ANDROID = '%s/lava-test-runner-android' % LAVA_TEST_DIR
LAVA_TEST_UBUNTU = '%s/lava-test-runner-ubuntu' % LAVA_TEST_DIR
LAVA_TEST_UPSTART = '%s/lava-test-runner.conf' % LAVA_TEST_DIR
+LAVA_TEST_INITD = '%s/lava-test-runner.init.d' % LAVA_TEST_DIR
LAVA_TEST_SHELL = '%s/lava-test-shell' % LAVA_TEST_DIR
Target.android_deployment_data['lava_test_runner'] = LAVA_TEST_ANDROID
@@ -47,12 +48,18 @@
Target.android_deployment_data['lava_test_sh_cmd'] = '/system/bin/mksh'
Target.android_deployment_data['lava_test_dir'] = '/system/lava'
Target.android_deployment_data['lava_test_results_part_attr'] = 'data_part_android_org'
+
Target.ubuntu_deployment_data['lava_test_runner'] = LAVA_TEST_UBUNTU
Target.ubuntu_deployment_data['lava_test_shell'] = LAVA_TEST_SHELL
Target.ubuntu_deployment_data['lava_test_sh_cmd'] = '/bin/sh'
Target.ubuntu_deployment_data['lava_test_dir'] = '/lava'
Target.ubuntu_deployment_data['lava_test_results_part_attr'] = 'root_part'
+Target.oe_deployment_data['lava_test_runner'] = LAVA_TEST_UBUNTU
+Target.oe_deployment_data['lava_test_shell'] = LAVA_TEST_SHELL
+Target.oe_deployment_data['lava_test_sh_cmd'] = '/bin/sh'
+Target.oe_deployment_data['lava_test_dir'] = '/lava'
+Target.oe_deployment_data['lava_test_results_part_attr'] = 'root_part'
def _configure_ubuntu_startup(etcdir):
logging.info('adding ubuntu upstart job')
@@ -62,6 +69,16 @@
_configure_ubuntu_startup
+def _configure_oe_startup(etcdir):
+ logging.info('adding init.d script')
+ shutil.copy(LAVA_TEST_INITD, '%s/init.d/lava-test-runner' % etcdir)
+ shutil.copy(LAVA_TEST_INITD, '%s/rc5.d/S50lava-test-runner' % etcdir)
+ shutil.copy(LAVA_TEST_INITD, '%s/rc6.d/K50lava-test-runner' % etcdir)
+
+Target.oe_deployment_data['lava_test_configure_startup'] = \
+ _configure_oe_startup
+
+
def _configure_android_startup(etcdir):
logging.info('hacking android start up job')
with open('%s/mkshrc' % etcdir, 'a') as f:
=== modified file 'lava_dispatcher/config.py'
@@ -67,6 +67,7 @@
simulator_binary = schema.StringOption()
license_server = schema.StringOption()
+ fastmodel_type = schema.StringOption()
class OptionDescriptor(object):
def __init__(self, name):
=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf'
@@ -1,6 +1,9 @@
client_type=fastmodel
simulator_binary = /opt/arm/RTSM_A15x14-A7x14_VE/bin/RTSM_VE_Cortex-A15x4-A7x4
+# The type of the fastmodel (ve or foundation)
+fastmodel_type = ve
+
# The license server must also be specified. eg:
#license_server = 8224@192.168.1.10
=== modified file 'lava_dispatcher/device/fastmodel.py'
@@ -54,27 +54,41 @@
ANDROID_WALLPAPER = 'system/wallpaper_info.xml'
SYS_PARTITION = 2
DATA_PARTITION = 5
+ FM_VE = 0
+ FM_FOUNDATION = 1
+ FASTMODELS = {'ve': FM_VE, 'foundation': FM_FOUNDATION}
+ AXF_IMAGES = {FM_VE: 'img.axf', FM_FOUNDATION: 'img-foundation.axf'}
- BOOT_OPTIONS = {
+ BOOT_OPTIONS_VE = {
'motherboard.smsc_91c111.enabled': '1',
'motherboard.hostbridge.userNetworking': '1',
'coretile.cache_state_modelled': '0',
'coretile.cluster0.cpu0.semihosting-enable': '1',
}
- # a list of allowable values for BOOT_OPTIONS
+ # a list of allowable values for BOOT_OPTIONS_VE
BOOT_VALS = ['0', '1']
def __init__(self, context, config):
super(FastModelTarget, self).__init__(context, config)
self._sim_binary = config.simulator_binary
- lic_server = config.license_server
- if not self._sim_binary or not lic_server:
- raise RuntimeError("The device type config for this device "
- "requires settings for 'simulator_binary' and 'license_server'"
- )
-
- os.putenv('ARMLMD_LICENSE_FILE', lic_server)
+ if not self._sim_binary:
+ raise RuntimeError("Missing config option for simulator binary")
+
+ try:
+ self._fastmodel_type = self.FASTMODELS[config.fastmodel_type]
+ except KeyError:
+ raise RuntimeError("The fastmodel type for this device is invalid,"
+ " please use 've' or 'foundation'")
+
+ if self._fastmodel_type == self.FM_VE:
+ lic_server = config.license_server
+ if not lic_server:
+ raise RuntimeError("The VE FastModel requires the config "
+ "option 'license_server'")
+
+ os.putenv('ARMLMD_LICENSE_FILE', lic_server)
+
self._sim_proc = None
def _customize_android(self):
@@ -124,15 +138,16 @@
generate_fastmodel_image(hwpack, rootfs, odir)
self._sd_image = '%s/sd.img' % odir
- self._axf = '%s/img.axf' % odir
+ self._axf = '%s/%s' % (odir, self.AXF_IMAGES[self._fastmodel_type])
- self._customize_ubuntu(self._sd_image)
+ self._customize_linux(self._sd_image)
def deploy_linaro_prebuilt(self, image):
self._sd_image = download_image(image, self.context)
- self._copy_axf(self.config.root_part, 'boot/img.axf')
+ self._copy_axf(self.config.root_part,
+ 'boot/%s' % self.AXF_IMAGES[self._fastmodel_type])
- self._customize_ubuntu(self._sd_image)
+ self._customize_linux(self._sd_image)
@contextlib.contextmanager
def file_system(self, partition, directory):
@@ -157,13 +172,13 @@
os.chown(self._axf, st.st_uid, st.st_gid)
os.chown(self._sd_image, st.st_uid, st.st_gid)
- def _boot_options(self):
- options = dict(self.BOOT_OPTIONS)
+ def _boot_options_ve(self):
+ options = dict(self.BOOT_OPTIONS_VE)
for option in self.boot_options:
keyval = option.split('=')
if len(keyval) != 2:
logging.warn("Invalid boot option format: %s" % option)
- elif keyval[0] not in self.BOOT_OPTIONS:
+ elif keyval[0] not in self.BOOT_OPTIONS_VE:
logging.warn("Invalid boot option: %s" % keyval[0])
elif keyval[1] not in self.BOOT_VALS:
logging.warn("Invalid boot option value: %s" % option)
@@ -173,11 +188,15 @@
return ' '.join(['-C %s=%s' % (k, v) for k, v in options.iteritems()])
def _get_sim_cmd(self):
- options = self._boot_options()
- return ("%s -a coretile.cluster0.*=%s "
- "-C motherboard.mmc.p_mmc_file=%s "
- "-C motherboard.hostbridge.userNetPorts='5555=5555' %s") % (
- self._sim_binary, self._axf, self._sd_image, options)
+ if self._fastmodel_type == self.FM_VE:
+ options = self._boot_options_ve()
+ return ("%s -a coretile.cluster0.*=%s "
+ "-C motherboard.mmc.p_mmc_file=%s "
+ "-C motherboard.hostbridge.userNetPorts='5555=5555' %s") % (
+ self._sim_binary, self._axf, self._sd_image, options)
+ elif self._fastmodel_type == self.FM_FOUNDATION:
+ return ("%s --image=%s --block-device=%s --network=nat") % (
+ self._sim_binary, self._axf, self._sd_image)
def _power_off(self, proc):
if proc is not None:
=== modified file 'lava_dispatcher/device/master.py'
@@ -160,7 +160,7 @@
runner.run('mkfs.vfat /dev/disk/by-label/testboot -n testboot')
def _generate_tarballs(self, image_file):
- self._customize_ubuntu(image_file)
+ self._customize_linux(image_file)
boot_tgz = os.path.join(self.scratch_dir, "boot.tgz")
root_tgz = os.path.join(self.scratch_dir, "root.tgz")
try:
=== modified file 'lava_dispatcher/device/qemu.py'
@@ -46,11 +46,11 @@
def deploy_linaro(self, hwpack=None, rootfs=None):
odir = self.scratch_dir
self._sd_image = generate_image(self, hwpack, rootfs, odir)
- self._customize_ubuntu(self._sd_image)
+ self._customize_linux(self._sd_image)
def deploy_linaro_prebuilt(self, image):
self._sd_image = download_image(image, self.context)
- self._customize_ubuntu(self._sd_image)
+ self._customize_linux(self._sd_image)
@contextlib.contextmanager
def file_system(self, partition, directory):
=== modified file 'lava_dispatcher/device/target.py'
@@ -20,6 +20,7 @@
import contextlib
import logging
+import os
import sys
from lava_dispatcher.client.lmc_utils import (
@@ -56,6 +57,11 @@
'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",
'TESTER_PS1_INCLUDES_RC': True,
}
+ oe_deployment_data = {
+ 'TESTER_PS1': "linaro-test [rc=$(echo \$?)]# ",
+ 'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",
+ 'TESTER_PS1_INCLUDES_RC': True,
+ }
def __init__(self, context, device_config):
self.context = context
@@ -142,12 +148,26 @@
def get_test_data_attachments(self):
return []
- def _customize_ubuntu(self, image):
+ def _customize_ubuntu(self, rootdir):
self.deployment_data = Target.ubuntu_deployment_data
+ with open('%s/root/.bashrc' % rootdir, 'a') as f:
+ f.write('export PS1="%s"\n' % self.deployment_data['TESTER_PS1'])
+
+ def _customize_oe(self, rootdir):
+ self.deployment_data = Target.oe_deployment_data
+ with open('%s/etc/profile' % rootdir, 'a') as f:
+ f.write('export PS1="%s"\n' % self.deployment_data['TESTER_PS1'])
+
+ def _customize_linux(self, image):
root_part = self.config.root_part
with image_partition_mounted(image, root_part) as mnt:
- with open('%s/root/.bashrc' % mnt, 'a') as f:
- f.write('export PS1="%s"\n' % self.deployment_data['TESTER_PS1'])
+ if os.path.exists('%s/etc/debian_version' % mnt):
+ self._customize_ubuntu(mnt)
+ else:
+ # assume an OE based image. This is actually pretty safe
+ # because we are doing pretty standard linux stuff, just
+ # just no upstart or dash assumptions
+ self._customize_oe(mnt)
class SerialIO(file):
=== modified file 'setup.py'
@@ -32,6 +32,7 @@
'lava_test_shell/lava-test-runner-android',
'lava_test_shell/lava-test-runner-ubuntu',
'lava_test_shell/lava-test-runner.conf',
+ 'lava_test_shell/lava-test-runner.init.d',
'lava_test_shell/lava-test-shell',
])
],