summaryrefslogtreecommitdiffstats
path: root/meta-yocto-bsp/lib
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-06-23 17:54:30 +0100
commitd7b3683834f9095d7c1144fda18b2a34b85cf339 (patch)
tree1ed41c8d3f8facefeb57121015d4a377f3669bc4 /meta-yocto-bsp/lib
parent809350a23ff2901d90683de52822a715b93a0d41 (diff)
downloadpoky-d7b3683834f9095d7c1144fda18b2a34b85cf339.tar.gz
meta-yocto-bsp: oeqa/controllers: add GrubTarget
add control for generic grub pc via serial line Implementation [YOCTO #5615]. (From OE-Core rev: 01968e9244d0cf3deb1ec5cfb8e562d3b364add6) Signed-off-by: Cristian Iorga <cristian.iorga@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-yocto-bsp/lib')
-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 0000000000..02ada65da6
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py
@@ -0,0 +1,71 @@
1# Copyright (C) 2014 Intel Corporation
2#
3# Released under the MIT license (see COPYING.MIT)
4
5# This module adds support to testimage.bbclass to deploy images and run
6# tests on a Generic PC that boots using grub bootloader. The device must
7# be set up as per README.hardware and the master image should be deployed
8# onto the harddisk so that it boots into it by default.For booting into the
9# image under test we interact with grub over serial, so for the
10# Generic PC you will need an additional serial cable and device under test
11# needs to have a serial interface. The separate ext3
12# partition that will contain the image to be tested must be labelled
13# "testrootfs" so that the deployment code below can find it.
14
15import os
16import bb
17import time
18import subprocess
19import sys
20import pexpect
21
22import oeqa.utils.sshcontrol as sshcontrol
23from oeqa.controllers.masterimage import MasterImageHardwareTarget
24
25class GrubTarget(MasterImageHardwareTarget):
26
27 def __init__(self, d):
28 super(GrubTarget, self).__init__(d)
29 self.deploy_cmds = [
30 'mount -L boot /boot',
31 'mkdir -p /mnt/testrootfs',
32 'mount -L testrootfs /mnt/testrootfs',
33 'cp ~/test-kernel /boot',
34 'rm -rf /mnt/testrootfs/*',
35 'tar xvf ~/test-rootfs.%s -C /mnt/testrootfs' % self.image_fstype,
36 ]
37
38 if not self.serialcontrol_cmd:
39 bb.fatal("This TEST_TARGET needs a TEST_SERIALCONTROL_CMD defined in local.conf.")
40
41
42 def _deploy(self):
43 # make sure these aren't mounted
44 self.master.run("umount /boot; umount /mnt/testrootfs;")
45 self.master.ignore_status = False
46 # Kernel files may not be in the image, so copy them just in case
47 self.master.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype)
48 self.master.copy_to(self.kernel, "~/test-kernel")
49 for cmd in self.deploy_cmds:
50 self.master.run(cmd)
51
52 def _start(self, params=None):
53 self.power_cycle(self.master)
54 try:
55 serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
56 serialconn.expect("GNU GRUB version 2.00")
57 serialconn.expect("Linux")
58 serialconn.sendline("OB\r")
59 serialconn.expect("login:", timeout=120)
60 serialconn.close()
61 except pexpect.ExceptionPexpect as e:
62 bb.fatal('Serial interaction failed: %s' % str(e))
63
64 def _wait_until_booted(self):
65 try:
66 serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
67 serialconn.expect("login:", timeout=120)
68 serialconn.close()
69 except pexpect.ExceptionPexpect as e:
70 bb.fatal('Serial interaction failed: %s' % str(e))
71