Bug 612

Summary: imagetest-qemu ssh'd into my desktop and ran /sbin/poweroff
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Richard Purdie <richard.purdie>
Component: meta-yoctoAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: jiajun.xu, poky.bs.watcher, poky.watcher, scott.a.garman
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Richard Purdie 2010-12-22 16:29:39 UTC
I tried reproducing bug 611. It didn't build an image, it asked me for a sudo password to setup the network interfaces, then it ssh'd into localhost and ran /sbin/poweroff, presumably as part of one of the shutdown tests.

I wasn't impressed by this.

I'd like to see the qemu connection verified a little more rigorously.
Comment 1 Jiajun Xu 2010-12-22 16:38:07 UTC
It's a bug in sanity test. I can look into the bug and send out a patch for
such condition checking.
Comment 2 Jiajun Xu 2010-12-22 23:02:39 UTC
Hi Richard,
I would like to add following check in sanity test to prevent such issue. Could you help to review?

diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index c2c394d..2325237 100644
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -365,8 +365,21 @@ Test_Create_Qemu()
        elif [ "$QEMUARCH" = "qemumips" ]; then
                KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH})
        fi
+
+       # If there is kernel image found, return failed directly
+       if [ $? -eq 1 ]; then
+               Test_Info "No kernel image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check"
+               return $ret
+       fi

        ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH})
+
+       # If there is rootfs image found, return failed directly
+       if [ $? -eq 1 ]; then
+               Test_Info "No ${QEMUTARGET} rootfs image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check"
+               return $ret
+       fi
+
        TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3"

        CP=`which cp`
@@ -375,6 +388,11 @@ Test_Create_Qemu()
        fi
        $CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE

+       if [ $? -ne 0 ]; then
+               Test_Info "Image ${ROOTFS_IMAGE} copy to ${TEST_ROOTFS_IMAGE} failed, return fail"
+               return $ret
+       fi
+
        export MACHINE=$QEMUARCH

        # Create Qemu in localhost VNC Port 1
@@ -402,6 +420,11 @@ Test_Create_Qemu()
        if [ ${up_time} -lt ${timeout} ]; then
                sleep 5
                TARGET_IPADDR=`Test_Fetch_Target_IP $PID`
+               # If IP address is 0, means there is no qemu process found
+               if [ ${TARGET_IPADDR} -eq 0 ]; then
+                       Test_Info "There is no qemu process or qemu ip address found, return failed"
+                       return $ret
+               fi
        fi
Comment 3 Richard Purdie 2010-12-23 03:46:22 UTC
I've checked and the "If IP address is 0, means there is no qemu process found" test does ensure the problem I saw doesn't happen. Please send this patch as is a definite improvement on the existing code, thanks.
Comment 4 Jiajun Xu 2010-12-23 17:26:29 UTC
Fixing patch in master now, commit 236faced1d907b025a3136c5949a311104d3a661.