* [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature
@ 2014-06-20 15:42 Cristian Iorga
2014-06-20 15:42 ` [PATCH 1/5] init-install-testfs: add grub serial line support Cristian Iorga
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Cristian Iorga @ 2014-06-20 15:42 UTC (permalink / raw)
To: openembedded-core
Various fixes related to master image install script and
GRUB targets controller implemented.
The following changes since commit 7c1a975a1c2fd884aa9f6f4736656d854a6c5edb:
bitbake: toaster: Fix spacing and layout in no image files notification (2014-06-20 14:03:58 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ciorga/YB5615
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ciorga/YB5615
Cristian Iorga (5):
init-install-testfs: add grub serial line support
oe-core/init-install-testfs.sh: do not overwrite /etc/mtab if the link
already exist
init-install-testfs: fix typo
init-install-testfs: create signature file for master image
meta-yocto-bsp: oeqa/controllers: add GrubTarget
meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py | 71 ++++++++++++++++++++++
.../initrdscripts/files/init-install-testfs.sh | 15 ++++-
2 files changed, 84 insertions(+), 2 deletions(-)
create mode 100644 meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] init-install-testfs: add grub serial line support
2014-06-20 15:42 [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature Cristian Iorga
@ 2014-06-20 15:42 ` Cristian Iorga
2014-06-20 15:42 ` [PATCH 2/5] oe-core/init-install-testfs.sh: do not overwrite /etc/mtab if the link already exist Cristian Iorga
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Cristian Iorga @ 2014-06-20 15:42 UTC (permalink / raw)
To: openembedded-core
For automated hardware testing, boot process control
via serial interface is needed. As such, in grub, serial
line support is added upon testmaster image install.
Also add a specific timeout to automatically start
the master image upon start of testing phase.
Tested on multiple hardware targets without issues.
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
meta/recipes-core/initrdscripts/files/init-install-testfs.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
index 116a6b7..6faa233 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -172,6 +172,11 @@ if [ -f /etc/grub.d/00_header ] ; then
GRUBCFG="/boot/grub/grub.cfg"
mkdir -p $(dirname $GRUBCFG)
cat >$GRUBCFG <<_EOF
+serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
+terminal_input --append serial
+terminal_output --append serial
+set timeout_style=hidden
+set timeout=5
menuentry "Linux" {
set root=(hd0,1)
linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] oe-core/init-install-testfs.sh: do not overwrite /etc/mtab if the link already exist
2014-06-20 15:42 [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature Cristian Iorga
2014-06-20 15:42 ` [PATCH 1/5] init-install-testfs: add grub serial line support Cristian Iorga
@ 2014-06-20 15:42 ` Cristian Iorga
2014-06-20 15:42 ` [PATCH 3/5] init-install-testfs: fix typo Cristian Iorga
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Cristian Iorga @ 2014-06-20 15:42 UTC (permalink / raw)
To: openembedded-core
Overwriting of /etc/mtab would fail as below if the /etc/mtab link already
exist during installation phase, this patch fix this problem by checking
existance of the link before try to overwrite it.
Error message during installation if the /etc/mtab exists:
"cat: /proc/mounts: input file is output file"
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
meta/recipes-core/initrdscripts/files/init-install-testfs.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
index 6faa233..d2cc6ac 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -90,7 +90,9 @@ if [ ! -b /dev/loop0 ] ; then
fi
mkdir -p /tmp
-cat /proc/mounts > /etc/mtab
+if [ ! -L /etc/mtab ]; then
+ cat /proc/mounts > /etc/mtab
+fi
disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] init-install-testfs: fix typo
2014-06-20 15:42 [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature Cristian Iorga
2014-06-20 15:42 ` [PATCH 1/5] init-install-testfs: add grub serial line support Cristian Iorga
2014-06-20 15:42 ` [PATCH 2/5] oe-core/init-install-testfs.sh: do not overwrite /etc/mtab if the link already exist Cristian Iorga
@ 2014-06-20 15:42 ` Cristian Iorga
2014-06-20 15:42 ` [PATCH 4/5] init-install-testfs: create signature file for master image Cristian Iorga
2014-06-20 15:42 ` [PATCH 5/5] meta-yocto-bsp: oeqa/controllers: add GrubTarget Cristian Iorga
4 siblings, 0 replies; 6+ messages in thread
From: Cristian Iorga @ 2014-06-20 15:42 UTC (permalink / raw)
To: openembedded-core
_EOF marker was not used properly
(space left before end of line).
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
meta/recipes-core/initrdscripts/files/init-install-testfs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
index d2cc6ac..cf290a5 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -183,7 +183,7 @@ menuentry "Linux" {
set root=(hd0,1)
linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet
}
-_EOF
+_EOF
# Add the test label
echo -ne "\nmenuentry 'test' {\nlinux /test-kernel root=$testfs rw $rootwait quiet\n}\n" >> $GRUBCFG
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] init-install-testfs: create signature file for master image
2014-06-20 15:42 [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature Cristian Iorga
` (2 preceding siblings ...)
2014-06-20 15:42 ` [PATCH 3/5] init-install-testfs: fix typo Cristian Iorga
@ 2014-06-20 15:42 ` Cristian Iorga
2014-06-20 15:42 ` [PATCH 5/5] meta-yocto-bsp: oeqa/controllers: add GrubTarget Cristian Iorga
4 siblings, 0 replies; 6+ messages in thread
From: Cristian Iorga @ 2014-06-20 15:42 UTC (permalink / raw)
To: openembedded-core
Also small cosmetic changes.
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
meta/recipes-core/initrdscripts/files/init-install-testfs.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
index cf290a5..618a53d 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -154,8 +154,12 @@ mkdir -p /boot
# Handling of the target root partition
mount $rootfs /tgt_root
mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
+
echo "Copying rootfs files..."
cp -a /src_root/* /tgt_root
+
+touch /tgt_root/etc/masterimage
+
if [ -d /tgt_root/etc/ ] ; then
echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab
# We dont want udev to mount our root device while we're booting...
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] meta-yocto-bsp: oeqa/controllers: add GrubTarget
2014-06-20 15:42 [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature Cristian Iorga
` (3 preceding siblings ...)
2014-06-20 15:42 ` [PATCH 4/5] init-install-testfs: create signature file for master image Cristian Iorga
@ 2014-06-20 15:42 ` Cristian Iorga
4 siblings, 0 replies; 6+ messages in thread
From: Cristian Iorga @ 2014-06-20 15:42 UTC (permalink / raw)
To: openembedded-core
add control for generic grub pc via serial line
Implementation [YOCTO #5615].
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py | 71 +++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py
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))
+
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-20 15:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-20 15:42 [PATCH 0/5] Automated hardware testing bugfixes and grub target controller feature Cristian Iorga
2014-06-20 15:42 ` [PATCH 1/5] init-install-testfs: add grub serial line support Cristian Iorga
2014-06-20 15:42 ` [PATCH 2/5] oe-core/init-install-testfs.sh: do not overwrite /etc/mtab if the link already exist Cristian Iorga
2014-06-20 15:42 ` [PATCH 3/5] init-install-testfs: fix typo Cristian Iorga
2014-06-20 15:42 ` [PATCH 4/5] init-install-testfs: create signature file for master image Cristian Iorga
2014-06-20 15:42 ` [PATCH 5/5] meta-yocto-bsp: oeqa/controllers: add GrubTarget Cristian Iorga
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox