From patchwork Wed Oct 17 22:42:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 12327 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 002591D5170 for ; Wed, 17 Oct 2012 22:42:15 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 6BB11A1954E for ; Wed, 17 Oct 2012 22:42:15 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so5686591iag.11 for ; Wed, 17 Oct 2012 15:42:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=nIMzdizMF/dJL6WpJT0hsG/E/zBhnySF3TcttfHXf/I=; b=pgq1ceQEEoBNb40OhSkYVZKcHAYJs4T3eMJ9+C6it+nAl4OrcTj4olcVQSFajZPksQ HzYQlFKYqS3lTqkhUV2JgO9Kyd8x8KSbn0sbU2O0UFqp4pVDGaoEv+1TG5jMf/pgYguP wMGneYta++ofS4M4RWgdR2EfIEuvOAgaPB90dlkAtZ2LmF1yGECzarSZu80+jBs2RP+u hImlU15+T6MQ2VbTq6tBDHtz6Gw22xw91qKS0UHzNwjdUyRfgUR8wbcUswzBraP4xsSw N2lfc9NGu5O+6Yh9mX1Yvkzw4Yf/OiusaKVX9aTfl9irhwsVdAi9a43Dw8SiYyhqwchu jtEw== Received: by 10.50.46.226 with SMTP id y2mr3014351igm.62.1350513734702; Wed, 17 Oct 2012 15:42:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp971749igt; Wed, 17 Oct 2012 15:42:13 -0700 (PDT) Received: by 10.180.90.201 with SMTP id by9mr6915542wib.5.1350513732570; Wed, 17 Oct 2012 15:42:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id v28si25646893weo.31.2012.10.17.15.42.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Oct 2012 15:42:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1TOcJW-0001Qc-SQ for ; Wed, 17 Oct 2012 22:42:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id CBC9BE012F for ; Wed, 17 Oct 2012 22:42:10 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 407 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 407: FastModel: add new support for foundation models Message-Id: <20121017224210.14788.26295.launchpad@ackee.canonical.com> Date: Wed, 17 Oct 2012 22:42:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16152"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: cd07d157092db7702b0ef636230ab0a936cc3d56 X-Gm-Message-State: ALoCoQkNluiTNAuy9b/N5JrcofPgELg5DQGkrgcl4OPQpcPyzSEM4PjGFn5eJostY5pjEXrJ7Oo7 Merge authors: Andy Doan (doanac) Ricardo Salveti (rsalveti) Related merge proposals: https://code.launchpad.net/~doanac/lava-dispatcher/v8-support/+merge/130174 proposed by: Andy Doan (doanac) review: Approve - Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 407 [merge] committer: Andy Doan branch nick: lava-dispatcher timestamp: Wed 2012-10-17 17:41:10 -0500 message: FastModel: add new support for foundation models modified: lava_dispatcher/actions/lava_test_shell.py lava_dispatcher/config.py lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf lava_dispatcher/device/fastmodel.py lava_dispatcher/device/master.py lava_dispatcher/device/qemu.py lava_dispatcher/device/target.py setup.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/actions/lava_test_shell.py' --- lava_dispatcher/actions/lava_test_shell.py 2012-10-04 05:05:26 +0000 +++ lava_dispatcher/actions/lava_test_shell.py 2012-10-17 16:52:36 +0000 @@ -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' --- lava_dispatcher/config.py 2012-10-16 02:26:18 +0000 +++ lava_dispatcher/config.py 2012-10-17 16:51:09 +0000 @@ -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' --- lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf 2012-10-17 03:45:38 +0000 +++ lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf 2012-10-17 16:51:09 +0000 @@ -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' --- lava_dispatcher/device/fastmodel.py 2012-10-17 03:45:38 +0000 +++ lava_dispatcher/device/fastmodel.py 2012-10-17 16:52:05 +0000 @@ -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' --- lava_dispatcher/device/master.py 2012-10-17 03:45:38 +0000 +++ lava_dispatcher/device/master.py 2012-10-17 16:52:05 +0000 @@ -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' --- lava_dispatcher/device/qemu.py 2012-10-17 03:45:38 +0000 +++ lava_dispatcher/device/qemu.py 2012-10-17 16:52:05 +0000 @@ -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' --- lava_dispatcher/device/target.py 2012-10-17 03:45:38 +0000 +++ lava_dispatcher/device/target.py 2012-10-17 16:52:05 +0000 @@ -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' --- setup.py 2012-10-02 02:57:13 +0000 +++ setup.py 2012-10-17 16:52:36 +0000 @@ -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', ]) ],