Bug 11748

Summary: Machine given to runqemu util is overwritten
Product: [QA/Testing] Build Testing Reporter: Humberto Ibarra <humberto.ibarra.lopez>
Component: generalAssignee: Robert Yang <liezhi.yang>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium+ CC: jair.de.jesus.gonzalez.plascencia
Version: 2.4   
Target Milestone: 2.4 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Humberto Ibarra 2017-07-03 16:32:34 UTC
Trying to make a testcase giving a wrong machine to runqemu as follows:

    def test_wrong_machine(self):
        """Test runqemu with wrong machine"""
        cmd = "%s %s" % (self.cmd_common, 'qemuarm')
        with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
            self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)

The build done was a qemux86-64, from selftest, so it was expected that giving qemuarm to runqemu would cause the test to fail. It didn't happen that way, the runqemu util seems to get the qemuarm value but at some point it overwrites it with qemux86-64 and the test passes. Here is the output:

Output from runqemu:
runqemu - INFO - Assuming MACHINE = qemuarm
runqemu - INFO - Running MACHINE=qemuarm bitbake -e...
runqemu - INFO - MACHINE: qemuarm
runqemu - INFO - DEPLOY_DIR_IMAGE: /home/humberto/poky/build/tmp/deploy/images/qemux86-64
runqemu - INFO - Running ls -t /home/humberto/poky/build/tmp/deploy/images/qemux86-64/*.qemuboot.conf...
runqemu - INFO - CONFFILE: /home/humberto/poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20170703160717.qemuboot.conf
runqemu - INFO - Continuing with the following parameters:

runqemu - INFO - Running /usr/sbin/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 - Running ldd tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin//qemu-system-x86_64...
runqemu - INFO - Running tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/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 file=tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20170703160717.rootfs.ext4,if=virtio,format=raw -vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci  -nographic -serial tcp:127.0.0.1:56917  -cpu core2duo -m 256 -serial tcp:127.0.0.1:48241 -kernel tmp/deploy/images/qemux86-64/bzImage--4.10.17+git0+4b89f331d4_6648a34e00-r0-qemux86-64-20170629102456.bin -append 'root=/dev/vda rw highres=off  console=ttyS0 mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1 console=tty1 console=ttyS0,115200n8 printk.time=1'


As seen, the qemuarm value is received, but it is soon changed to qemux86-64 when looking for a conf file.
Comment 1 Robert Yang 2017-09-11 02:57:42 UTC
The real problem is DEPLOY_DIR_IMAGE is exported somewhere, runqemu doesn't know  whether qemuarm is a MACHINE or not, it needs guess. And then it will look DEPLOY_DIR_IMAGE, so you need unset DEPLOY_DIR_IMAGE to test it.