summaryrefslogtreecommitdiffstats
path: root/meta-yocto-bsp
diff options
context:
space:
mode:
authorCristian Iorga <cristian.iorga@intel.com>2014-06-20 18:42:20 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-04 08:46:01 +0100
commit581a06afb5b59e1821eabb209a61612b0cdc137d (patch)
tree5e4eb2cdb571163e9350824be13f856c94b3475d /meta-yocto-bsp
parent57bbb1af5ea1ef0cf10d92e399c445a3607b8be2 (diff)
downloadast2050-yocto-poky-581a06afb5b59e1821eabb209a61612b0cdc137d.zip
ast2050-yocto-poky-581a06afb5b59e1821eabb209a61612b0cdc137d.tar.gz
meta-yocto-bsp: oeqa/controllers: add GrubTarget
add control for generic grub pc via serial line Implementation [YOCTO #5615]. (From meta-yocto rev: dc3d298688c2265b023219c81124065c36eeb417) Signed-off-by: Cristian Iorga <cristian.iorga@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-yocto-bsp')
-rw-r--r--meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py71
1 files changed, 71 insertions, 0 deletions
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..02ada65
--- /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("OB\r")
+ 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))
+
OpenPOWER on IntegriCloud