Patchwork [2/2] qemuimagetest: collect and print runqemu output

login
register
mail settings
Submitter Paul Eggleton
Date March 26, 2013, 12:43 p.m.
Message ID <d83fc1249f83f8ffd7fa356ace6590751661c14c.1364301448.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/46923/
State Accepted
Commit 827106a57ca88760a19f9309d859b500c5c4fe97
Headers show

Comments

Paul Eggleton - March 26, 2013, 12:43 p.m.
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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/imagetest-qemu.bbclass |    1 +
 scripts/qemuimage-testlib           |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index 0d18f06..63ba087 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -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
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index 6377c7f..a800f68 100755
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -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