All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/6] runqemu: do not rely on grepping images
@ 2017-04-10 18:26 Ed Bartosh
  0 siblings, 0 replies; 2+ messages in thread
From: Ed Bartosh @ 2017-04-10 18:26 UTC (permalink / raw)
  To: openembedded-core

Hi,

This patch breaks wic test_qemu test case. The reason is that it runs qemu with
-drive if=none command line option. Changing it to -drive if=virtio should fix the issue.

stty: standard input: Inappropriate ioctl for device
runqemu - INFO - Running /bin/ip link...
runqemu - INFO - Acquiring lockfile /tmp/qemu-tap-locks/tap0.lock...
runqemu - INFO - Using preconfigured tap device tap0
runqemu - INFO - If this is not intended, touch
/tmp/qemu-tap-locks/tap0.skip to make runqemu skip tap0.
runqemu - INFO - Network configuration:
192.168.7.2::192.168.7.1:255.255.255.0
runqemu - INFO - Using scsi drive
runqemu - INFO - Running ldd
/home/ed/git/yocto/poky/build/tmp/work/qemux86_64-poky-linux/wic-image-minimal/1.0-r0/recipe-sysroot-native/usr/bin/qemu-system-x86_64...
runqemu - INFO - Running
/home/ed/git/yocto/poky/build/tmp/work/qemux86_64-poky-linux/wic-image-minimal/1.0-r0/recipe-sysroot-native/usr/bin/qemu-system-x86_64
-device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:02 -netdev
tap,id=net0,ifname=tap0,script=no,downscript=no -drive
if=none,id=hd,file=/home/ed/git/yocto/poky/build/tmp/deploy/images/qemux86-64/wic-image-minimal-qemux86-64.wic,format=raw
-device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd -no-reboot -vga
vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci
-nographic -serial tcp:127.0.0.1:38144  -cpu core2duo -m 256 -serial
tcp:127.0.0.1:33992 -snapshot 
QEMU 2.8.0 monitor - type 'help' for more information
(qemu) 
Waiting at most 1000 seconds for login banner
Connection from 127.0.0.1:51177
Reached login banner
Logged as root in serial console
Stopping logging thread
Stop event received
Tearing down logging thread
Sending SIGTERM to runqemu
FAIL

======================================================================
FAIL: test_qemu (oeqa.selftest.wic.Wic)
Test wic-image-minimal under qemu
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ed/git/yocto/poky/meta/lib/oeqa/utils/decorators.py", line
109, in wrapped_f
    return func(*args, **kwargs)
  File "/home/ed/git/yocto/poky/meta/lib/oeqa/selftest/wic.py", line 57,
in wrapped_f
    return func(*args, **kwargs)
  File "/home/ed/git/yocto/poky/meta/lib/oeqa/selftest/wic.py", line
613, in test_qemu
    self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt')
AssertionError: '/dev/root /' != '/dev/root /\r\n/dev/vda3 /mnt'
- /dev/root /
+ /dev/root /
/dev/vda3 /mnt


----------------------------------------------------------------------
Ran 1 test in 179.193s

--
Regards,
Ed


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 6/6] runqemu: do not rely on grepping images
  2017-04-06  6:41 [PATCH 0/6] fixes for runqemu Robert Yang
@ 2017-04-06  6:41 ` Robert Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Yang @ 2017-04-06  6:41 UTC (permalink / raw)
  To: openembedded-core

Fixed when the image is large and not enough memory:
  grep: memory exhausted
  Aborted

[YOCTO #11073]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/qemuboot.bbclass |  3 +++
 scripts/runqemu               | 19 +++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 3ca97cad4c..2870388dfb 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -64,6 +64,9 @@ QB_DEFAULT_FSTYPE ?= "ext4"
 QB_OPT_APPEND ?= "-show-cursor"
 QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
 
+# This should be kept align with ROOT_VM
+QB_DRIVE_TYPE ?= "/dev/sd"
+
 # Create qemuboot.conf
 addtask do_write_qemuboot_conf after do_rootfs before do_image
 IMGDEPLOYDIR ?= "${WORKDIR}/deploy-${PN}-image-complete"
diff --git a/scripts/runqemu b/scripts/runqemu
index b9646223c4..b5fc22af18 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -978,23 +978,26 @@ class BaseConfig(object):
             self.kernel_cmdline = 'root=/dev/ram0 rw debugshell'
             self.rootfs_options = '-initrd %s' % self.rootfs
         else:
+            vm_drive = ''
             if self.fstype in self.vmtypes:
                 if self.fstype == 'iso':
                     vm_drive = '-cdrom %s' % self.rootfs
-                else:
-                    cmd1 = "grep -q 'root=/dev/sd' %s" % self.rootfs
-                    cmd2 = "grep -q 'root=/dev/hd' %s" % self.rootfs
-                    if subprocess.call(cmd1, shell=True) == 0:
+                elif self.get('QB_DRIVE_TYPE'):
+                    drive_type = self.get('QB_DRIVE_TYPE')
+                    if drive_type.startswith("/dev/sd"):
                         logger.info('Using scsi drive')
                         vm_drive = '-drive if=none,id=hd,file=%s,format=%s -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd' \
                                        % (self.rootfs, rootfs_format)
-                    elif subprocess.call(cmd2, shell=True) == 0:
+                    elif drive_type.startswith("/dev/hd"):
                         logger.info('Using ide drive')
                         vm_drive = "%s,format=%s" % (self.rootfs, rootfs_format)
                     else:
-                        logger.warn("Can't detect drive type %s" % self.rootfs)
-                        logger.warn('Trying to use virtio block drive')
-                        vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format)
+                        logger.warn("Unknown QB_DRIVE_TYPE: %s" % drive_type)
+
+                if not vm_drive:
+                    logger.warn("Failed to figure out drive type, consider define or fix QB_DRIVE_TYPE")
+                    logger.warn('Trying to use virtio block drive')
+                    vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format)
                 self.rootfs_options = '%s -no-reboot' % vm_drive
             self.kernel_cmdline = 'root=%s rw highres=off' % (self.get('QB_KERNEL_ROOT'))
 
-- 
2.11.0.rc2.dirty



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-10 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 18:26 [PATCH 6/6] runqemu: do not rely on grepping images Ed Bartosh
  -- strict thread matches above, loose matches on Subject: below --
2017-04-06  6:41 [PATCH 0/6] fixes for runqemu Robert Yang
2017-04-06  6:41 ` [PATCH 6/6] runqemu: do not rely on grepping images Robert Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.