Skip to contentSkip to conversation

qemuimagetest debugging improvements

PATCH New Paul Eggleton 1 participant 3 messages Mar 26, 2013

lore
Share & tools
lore
#0 lore raw

cover qemuimagetest debugging improvements

A couple of fixes to hopefully help us track down the qemuimagetest failures on the autobuilder.

The following changes since commit d60aec3f5b319f4583fa72a8357b9ddd3be62b1a:

docbook-utils-native: Unbreak the build after source and build dir split (2013-03-25 20:51:15 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib paule/qemuimagetest
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/qemuimagetest

Paul Eggleton (2):
qemuimagetest: fix erroneous ps errors when qemu couldn't be started
qemuimagetest: collect and print runqemu output

 meta/classes/imagetest-qemu.bbclass    |    1 +
 scripts/qemuimage-testlib              |   12 +++++++++---
 scripts/qemuimage-testlib-pythonhelper |    2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/2 qemuimagetest: fix erroneous ps errors when qemu couldn't be started

The helper script was printing an error to stdout when it couldn't find any qemu child processes; output this error to stderr instead and redirect stderr to /dev/null when running from qemuimage-testlib so that QEMUPID is actually blank if there are no qemu instances found.

---
 scripts/qemuimage-testlib              |    2 +-
 scripts/qemuimage-testlib-pythonhelper |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/qemuimage-testlib +1 -1
index 551011c..6377c7f 100755
@@ -420,7 +420,7 @@ Test_Create_Qemu()
 
 	while [ ${up_time} -lt 10 ]
 	do
-		QEMUPID=`qemuimage-testlib-pythonhelper --findqemu $XTERMPID`
+		QEMUPID=`qemuimage-testlib-pythonhelper --findqemu $XTERMPID 2>/dev/null`
 		if [ $? -ne 0 ]; then
 			Test_Info "Wait for qemu up..."
 			up_time=`expr $up_time + 5`
scripts/qemuimage-testlib-pythonhelper +1 -1
index 2ca61ca..2c1f557 100755
@@ -34,7 +34,7 @@ if options.findqemu:
         commands[data[0]] = data[2]
 
     if options.findqemu not in pids:
-        print "No children found matching %s" % options.findqemu
+        sys.stderr.write("No children found matching %s" % options.findqemu)
         sys.exit(1)
 
     parents = []
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 qemuimagetest: collect and print runqemu output

In reply to Paul Eggleton

If runqemu (or qemu itself) fails we need to know why, so tee out to a log file and print it when we can't find the qemu process or determine its IP address.

---
 meta/classes/imagetest-qemu.bbclass |    1 +
 scripts/qemuimage-testlib           |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
meta/classes/imagetest-qemu.bbclass +1 -0
index 0d18f06..63ba087 100644
@@ -74,6 +74,7 @@ def qemuimagetest_main(d):
         os.environ["TARGET_IPSAVE"] = d.getVar("TARGET_IPSAVE", True)
         os.environ["TEST_SERIALIZE"] = d.getVar("TEST_SERIALIZE", True)
         os.environ["SDK_NAME"] = d.getVar("SDK_NAME", True)
+        os.environ["RUNQEMU_LOGFILE"] = d.expand("${T}/log.runqemutest.%s" % os.getpid())
 
         # Add in all variables from the user's original environment which
         # haven't subsequntly been set/changed
scripts/qemuimage-testlib +8 -2
index 6377c7f..a800f68 100755
@@ -408,8 +408,8 @@ Test_Create_Qemu()
 		export MACHINE=$QEMUARCH
 
 		# Create Qemu in localhost VNC Port 1
-		echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} || /bin/sleep 60' &"
-		xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} || /bin/sleep 60" &
+		echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60' &"
+		xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60" &
 	
 		# Get the pid of the xterm processor, which will be used in Test_Kill_Qemu
 		XTERMPID=$!
@@ -436,6 +436,9 @@ Test_Create_Qemu()
 		Test_Info "No qemu process appeared to start, exiting"
 		ps axww -O ppid
 		Test_Info "Process list dumped for debugging purposes"
+		Test_Info "runqemu output log:"
+		cat ${RUNQEMU_LOGFILE}
+		echo
 		return 1
 	fi
 
@@ -446,6 +449,9 @@ Test_Create_Qemu()
 		Test_Info "There is no qemu process or qemu ip address found, return failed"
 		ps -wwf
 		ps axww -O ppid
+		Test_Info "runqemu output log:"
+		cat ${RUNQEMU_LOGFILE}
+		echo
 		return 1
 	fi
 
Signature · 1 line
1.7.10.4