Squashed 'yocto-poky/' content from commit ea562de
git-subtree-dir: yocto-poky
git-subtree-split: ea562de57590c966cd5a75fda8defecd397e6436
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/__init__.py b/meta-yocto-bsp/lib/oeqa/controllers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/__init__.py
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py b/meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py
new file mode 100644
index 0000000..0f1aeb3
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py
@@ -0,0 +1,98 @@
+# Copyright (C) 2014 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# This module adds support to testimage.bbclass to deploy images and run
+# tests on a BeagleBone (original "white" or Black models). The device must
+# be set up as per README.hardware and the master image should be deployed
+# onto the card so that it boots into it by default. For booting into the
+# image under test we interact with u-boot over serial, so for the
+# BeagleBone Black you will need an additional TTL serial cable since a
+# serial interface isn't automatically provided over the USB connection as
+# it is on the original BeagleBone ("white") version. The separate ext3
+# partition that will contain the image to be tested must be labelled
+# "testrootfs" so that the deployment code below can find it.
+#
+# NOTE: for the BeagleBone "white" (original version) you may need to use
+# a script which handles the serial device disappearing on power down, such
+# as scripts/contrib/serdevtry in OE-Core.
+
+import os
+import bb
+import time
+import subprocess
+import sys
+import pexpect
+
+import oeqa.utils.sshcontrol as sshcontrol
+from oeqa.controllers.masterimage import MasterImageHardwareTarget
+
+
+class BeagleBoneTarget(MasterImageHardwareTarget):
+
+ dtbs = {'uImage-am335x-bone.dtb': 'am335x-bone.dtb', 'uImage-am335x-boneblack.dtb': 'am335x-boneblack.dtb'}
+
+ @classmethod
+ def get_extra_files(self):
+ return list(self.dtbs.keys())
+
+ def __init__(self, d):
+ super(BeagleBoneTarget, self).__init__(d)
+
+ self.image_fstype = self.get_image_fstype(d)
+ self.deploy_cmds = [
+ 'mkdir -p /mnt/testrootfs',
+ 'mount -L testrootfs /mnt/testrootfs',
+ 'rm -rf /mnt/testrootfs/*',
+ 'tar xvf ~/test-rootfs.%s -C /mnt/testrootfs' % self.image_fstype,
+ '[ -e /mnt/testrootfs/boot/uImage ] || [ -L /mnt/testrootfs/boot/uImage ] || cp ~/test-kernel /mnt/testrootfs/boot/uImage',
+ ]
+
+ for _, dtbfn in self.dtbs.iteritems():
+ # Kernel and dtb files may not be in the image, so copy them if not
+ self.deploy_cmds.append('[ -e /mnt/testrootfs/boot/{0} ] || cp ~/{0} /mnt/testrootfs/boot/'.format(dtbfn))
+
+ if not self.serialcontrol_cmd:
+ bb.fatal("This TEST_TARGET needs a TEST_SERIALCONTROL_CMD defined in local.conf.")
+
+
+ def _deploy(self):
+ self.master.run("umount /boot; umount /mnt/testrootfs;")
+ self.master.ignore_status = False
+ # Kernel and dtb files may not be in the image, so copy them just in case
+ self.master.copy_to(self.kernel, "~/test-kernel")
+ kernelpath = os.path.dirname(self.kernel)
+ for dtborig, dtbfn in self.dtbs.iteritems():
+ dtbfile = os.path.join(kernelpath, dtborig)
+ if os.path.exists(dtbfile):
+ self.master.copy_to(dtbfile, "~/%s" % dtbfn)
+ self.master.copy_to(self.rootfs, "~/test-rootfs.%s" % self.image_fstype)
+ for cmd in self.deploy_cmds:
+ self.master.run(cmd)
+
+ def _start(self, params=None):
+ self.power_cycle(self.master)
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ # We'd wait for "U-Boot" here but sometimes we connect too late on BeagleBone white to see it
+ serialconn.expect("NAND:")
+ serialconn.expect("MMC:")
+ serialconn.sendline("a")
+ serialconn.expect("U-Boot#")
+ serialconn.sendline("setenv bootpart 0:3")
+ serialconn.expect("U-Boot#")
+ serialconn.sendline("setenv mmcroot /dev/mmcblk0p3 ro")
+ serialconn.expect("U-Boot#")
+ serialconn.sendline("boot")
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
+
+ def _wait_until_booted(self):
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/edgeroutertarget.py b/meta-yocto-bsp/lib/oeqa/controllers/edgeroutertarget.py
new file mode 100644
index 0000000..b3338ca
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/edgeroutertarget.py
@@ -0,0 +1,90 @@
+# Copyright (C) 2014 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# This module adds support to testimage.bbclass to deploy images and run
+# tests on a Ubiquiti Networks EdgeRouter Lite. The device must be set up
+# to boot into the master image already - the easiest way to do that is as
+# follows:
+#
+# 1. Take out the internal USB drive and plug it into your PC
+# 2. Repartition the USB drive so that you have three partitions in this
+# order:
+# 1: vfat, labelled "boot" (it will need to be formatted with mkfs.vfat
+# for this to be possible, since FAT partitions formatted under
+# DOS/Windows will only support uppercase labels)
+# 2: ext3 (for master image) labelled "testmaster"
+# 3: ext3 (for image under test) labelled "testrootfs"
+# 3. Copy the kernel to be used by the master image to the FAT partition
+# (it should be named "vmlinux.64" with the factory u-boot configuration)
+# 4. Install the master image onto the "testmaster" ext3 partition. If
+# you do this by just extracting the contents of an image onto the
+# partition, you will also likely need to create the master image marker
+# file /etc/masterimage within this partition so that we can tell when
+# we're booted into it that it is the master image.
+# 5. Put the USB drive back into the device, and ensure the console port
+# and first ethernet port are connected before powering on
+#
+# TEST_SERIALCONTROL_CMD will need to be set in local.conf so that we can
+# interact with u-boot over the serial console port.
+
+import os
+import bb
+import time
+import subprocess
+import sys
+import pexpect
+
+import oeqa.utils.sshcontrol as sshcontrol
+from oeqa.controllers.masterimage import MasterImageHardwareTarget
+
+
+class EdgeRouterTarget(MasterImageHardwareTarget):
+
+ def __init__(self, d):
+ super(EdgeRouterTarget, self).__init__(d)
+
+ self.image_fstype = self.get_image_fstype(d)
+ self.deploy_cmds = [
+ 'mount -L boot /boot',
+ 'mkdir -p /mnt/testrootfs',
+ 'mount -L testrootfs /mnt/testrootfs',
+ 'cp ~/test-kernel /boot',
+ 'rm -rf /mnt/testrootfs/*',
+ 'tar xvf ~/test-rootfs.%s -C /mnt/testrootfs' % self.image_fstype
+ ]
+ if not self.serialcontrol_cmd:
+ bb.fatal("This TEST_TARGET needs a TEST_SERIALCONTROL_CMD defined in local.conf.")
+
+
+ def _deploy(self):
+ self.master.run("umount /mnt/testrootfs;")
+ self.master.ignore_status = False
+ self.master.copy_to(self.kernel, "~/test-kernel")
+ self.master.copy_to(self.rootfs, "~/test-rootfs.%s" % self.image_fstype)
+ for cmd in self.deploy_cmds:
+ self.master.run(cmd)
+
+ def _start(self, params=None):
+ self.power_cycle(self.master)
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ serialconn.expect("U-Boot")
+ serialconn.sendline("a")
+ serialconn.expect("Octeon ubnt_e100#")
+ serialconn.sendline("fatload usb 0:1 $loadaddr test-kernel")
+ serialconn.expect(" bytes read")
+ serialconn.expect("Octeon ubnt_e100#")
+ serialconn.sendline("bootoctlinux $loadaddr coremask=0x3 root=/dev/sda3 rw rootwait mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@3072k(eeprom)")
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
+
+ def _wait_until_booted(self):
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py b/meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py
new file mode 100644
index 0000000..7bc807d
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py
@@ -0,0 +1,71 @@
+# Copyright (C) 2014 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# This module adds support to testimage.bbclass to deploy images and run
+# tests on a Generic PC that boots using grub bootloader. The device must
+# be set up as per README.hardware and the master image should be deployed
+# onto the harddisk so that it boots into it by default.For booting into the
+# image under test we interact with grub over serial, so for the
+# Generic PC you will need an additional serial cable and device under test
+# needs to have a serial interface. The separate ext3
+# partition that will contain the image to be tested must be labelled
+# "testrootfs" so that the deployment code below can find it.
+
+import os
+import bb
+import time
+import subprocess
+import sys
+import pexpect
+
+import oeqa.utils.sshcontrol as sshcontrol
+from oeqa.controllers.masterimage import MasterImageHardwareTarget
+
+class GrubTarget(MasterImageHardwareTarget):
+
+ def __init__(self, d):
+ super(GrubTarget, self).__init__(d)
+ self.deploy_cmds = [
+ 'mount -L boot /boot',
+ 'mkdir -p /mnt/testrootfs',
+ 'mount -L testrootfs /mnt/testrootfs',
+ 'cp ~/test-kernel /boot',
+ 'rm -rf /mnt/testrootfs/*',
+ 'tar xvf ~/test-rootfs.%s -C /mnt/testrootfs' % self.image_fstype,
+ ]
+
+ if not self.serialcontrol_cmd:
+ bb.fatal("This TEST_TARGET needs a TEST_SERIALCONTROL_CMD defined in local.conf.")
+
+
+ def _deploy(self):
+ # make sure these aren't mounted
+ self.master.run("umount /boot; umount /mnt/testrootfs;")
+ self.master.ignore_status = False
+ # Kernel files may not be in the image, so copy them just in case
+ self.master.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype)
+ self.master.copy_to(self.kernel, "~/test-kernel")
+ for cmd in self.deploy_cmds:
+ self.master.run(cmd)
+
+ def _start(self, params=None):
+ self.power_cycle(self.master)
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ serialconn.expect("GNU GRUB version 2.00")
+ serialconn.expect("Linux")
+ serialconn.sendline("x")
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
+
+ def _wait_until_booted(self):
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
+
diff --git a/meta-yocto-bsp/lib/oeqa/selftest/__init__.py b/meta-yocto-bsp/lib/oeqa/selftest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/selftest/__init__.py
diff --git a/meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py b/meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py
new file mode 100644
index 0000000..00aa36f
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py
@@ -0,0 +1,83 @@
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
+from oeqa.utils.decorators import testcase
+import re
+import os
+import sys
+import logging
+
+
+class Gummiboot(oeSelfTest):
+
+ def _common_setup(self):
+ """
+ Common setup for test cases: 1101, 1103
+ """
+
+ # Set EFI_PROVIDER = "gummiboot" and MACHINE = "genericx86-64" in conf/local.conf
+ features = 'EFI_PROVIDER = "gummiboot"\n'
+ features += 'MACHINE = "genericx86-64"'
+ self.append_config(features)
+
+ def _common_build(self):
+ """
+ Common build for test cases: 1101, 1103
+ """
+
+ # Build a genericx86-64/efi gummiboot image
+ bitbake('syslinux syslinux-native parted-native dosfstools-native mtools-native core-image-minimal')
+
+
+ @testcase(1101)
+ def test_efi_gummiboot_images_can_be_built(self):
+ """
+ Summary: Check if efi/gummiboot images can be built
+ Expected: 1. File gummibootx64.efi should be available in build/tmp/deploy/images/genericx86-64
+ 2. Efi/gummiboot images can be built
+ Product: oe-core
+ Author: Ionut Chisanovici <ionutx.chisanovici@intel.com>
+ AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
+ """
+
+ # We'd use DEPLOY_DIR_IMAGE here, except that we need its value for
+ # MACHINE="genericx86-64 which is probably not the one configured
+ gummibootfile = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', 'gummibootx64.efi')
+
+ self._common_setup()
+
+ # Ensure we're actually testing that this gets built and not that
+ # it was around from an earlier build
+ bitbake('-c cleansstate gummiboot')
+ runCmd('rm -f %s' % gummibootfile)
+
+ self._common_build()
+
+ found = os.path.isfile(gummibootfile)
+ self.assertTrue(found, 'Gummiboot file %s not found' % gummibootfile)
+
+ @testcase(1103)
+ def test_wic_command_can_create_efi_gummiboot_installation_images(self):
+ """
+ Summary: Check that wic command can create efi/gummiboot installation images
+ Expected: A .direct file in folder /var/tmp/wic/ must be created.
+ Product: oe-core
+ Author: Ionut Chisanovici <ionutx.chisanovici@intel.com>
+ AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
+ """
+
+ self._common_setup()
+ self._common_build()
+
+ # Create efi/gummiboot installation images
+ wic_create_cmd = 'wic create mkgummidisk -e core-image-minimal'
+ result = runCmd(wic_create_cmd)
+
+ # Find file written by wic from output
+ res = re.search('(/var/tmp/wic/.*\.direct)', result.output)
+ if res:
+ direct_file = res.group(1)
+ # Check it actually exists
+ if not os.path.exists(direct_file):
+ self.fail('wic reported direct file "%s" does not exist; wic output:\n%s' % (direct_file, result.output))
+ else:
+ self.fail('No .direct file reported in wic output:\n%s' % result.output)