Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] qemuimagetest support for more FSTYPES
@ 2013-05-10 16:06 Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 1/3] scripts/runqemu: add ext4 to the list of extracted extensions Stefan Stanacar
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Stanacar @ 2013-05-10 16:06 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 88a7b041fbf2583472aa9408a33dd8881223a0c1:

  bitbake: pysh: Say what kind of token isn't implemented (2013-05-10 13:35:10 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib stefans/qemutests2
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=stefans/qemutests2

Stefan Stanacar (3):
  scripts/runqemu: add ext4 to the list of extracted extensions
  runqemu-internal: support for ext2 and ext4 not only ext3
  imagetest-qemu.bbclass,qemuimage-testlib: add support for more FSTYPES

 meta/classes/imagetest-qemu.bbclass | 26 +++++++++++++++-----------
 scripts/qemuimage-testlib           | 19 +++++++++----------
 scripts/runqemu                     |  3 ++-
 scripts/runqemu-internal            | 14 +++++++-------
 4 files changed, 33 insertions(+), 29 deletions(-)

-- 
1.8.1.4




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

* [PATCH 1/3] scripts/runqemu: add ext4 to the list of extracted extensions
  2013-05-10 16:06 [PATCH 0/3] qemuimagetest support for more FSTYPES Stefan Stanacar
@ 2013-05-10 16:06 ` Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 2/3] runqemu-internal: support for ext2 and ext4 not only ext3 Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 3/3] imagetest-qemu.bbclass, qemuimage-testlib: add support for more FSTYPES Stefan Stanacar
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Stanacar @ 2013-05-10 16:06 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 scripts/runqemu | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 8ed1226..9bd35de 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -384,7 +384,8 @@ if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
     # Extract the filename extension
     EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
     if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
-          "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
+          "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" -o \
+          "x$EXT" = "xext4" ]; then
         FSTYPE=$EXT
     else
         echo "Note: Unable to determine filesystem extension for $ROOTFS"
-- 
1.8.1.4




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

* [PATCH 2/3] runqemu-internal: support for ext2 and ext4 not only ext3
  2013-05-10 16:06 [PATCH 0/3] qemuimagetest support for more FSTYPES Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 1/3] scripts/runqemu: add ext4 to the list of extracted extensions Stefan Stanacar
@ 2013-05-10 16:06 ` Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 3/3] imagetest-qemu.bbclass, qemuimage-testlib: add support for more FSTYPES Stefan Stanacar
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Stanacar @ 2013-05-10 16:06 UTC (permalink / raw)
  To: openembedded-core

Don't check only for ext3 fstype, we can boot ext2 and ext4 just
as well.

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 scripts/runqemu-internal | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index f11706d..3bd0a09 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -299,7 +299,7 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm
     export QEMU_AUDIO_DRV="none"
     QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
     # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer"
-    if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
     fi
@@ -323,7 +323,7 @@ fi
 if [ "$MACHINE" = "qemux86" ]; then
     QEMU=qemu-system-i386
     QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
-    if [ "$FSTYPE" = "ext2" -o "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
         QEMUOPTIONS="$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
     fi
@@ -347,7 +347,7 @@ fi
 if [ "$MACHINE" = "qemux86-64" ]; then
     QEMU=qemu-system-x86_64
     QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
-    if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
         QEMUOPTIONS="$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
     fi
@@ -373,7 +373,7 @@ fi
 
 if [ "$MACHINE" = "spitz" ]; then
     QEMU=qemu-system-arm
-    if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         echo $ROOTFS
         ROOTFS=`readlink -f $ROOTFS`
         echo $ROOTFS
@@ -393,7 +393,7 @@ if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemum
     esac
     MACHINE_SUBTYPE=malta
     QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS"
-    if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
@@ -415,7 +415,7 @@ if [ "$MACHINE" = "qemuppc" ]; then
     CPU_SUBTYPE=G4
     QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
     QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD"
-    if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
     fi
@@ -434,7 +434,7 @@ if [ "$MACHINE" = "qemush4" ]; then
     QEMU=qemu-system-sh4
     MACHINE_SUBTYPE=r2d
     QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
-    if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+    if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
         #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
         QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
-- 
1.8.1.4




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

* [PATCH 3/3] imagetest-qemu.bbclass, qemuimage-testlib: add support for more FSTYPES
  2013-05-10 16:06 [PATCH 0/3] qemuimagetest support for more FSTYPES Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 1/3] scripts/runqemu: add ext4 to the list of extracted extensions Stefan Stanacar
  2013-05-10 16:06 ` [PATCH 2/3] runqemu-internal: support for ext2 and ext4 not only ext3 Stefan Stanacar
@ 2013-05-10 16:06 ` Stefan Stanacar
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Stanacar @ 2013-05-10 16:06 UTC (permalink / raw)
  To: openembedded-core

qemuimage-testlib hardcodes ext3 as fs type. This adds support for more
images types which are supported by runqemu: ext[234]/jffs2/btrfs.

I've skipped (for now) vmdk (which qemu can boot) because:
 - we don't have network on images without connman because of the way
runqemu starts vmdk images (can't pass kernel args for network config)
 - qemuimage-testlib-pythonhelper relies on '192.168' being in the output of
ps to return the pid

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 meta/classes/imagetest-qemu.bbclass | 26 +++++++++++++++-----------
 scripts/qemuimage-testlib           | 19 +++++++++----------
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index 94bed3b..7083a99 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -37,6 +37,8 @@ def qemuimagetest_main(d):
     resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)')
     machine = d.getVar('MACHINE', True)
     pname = d.getVar('PN', True)
+    allfstypes = d.getVar("IMAGE_FSTYPES", True).split()
+    testfstypes = [ "ext2", "ext3", "ext4", "jffs2", "btrfs" ]
     
     """function to save test cases running status"""
     def teststatus(test, status, index, length):
@@ -50,7 +52,7 @@ def qemuimagetest_main(d):
         f.close()
 
     """funtion to run each case under scenario"""
-    def runtest(scen, case, fulltestpath):
+    def runtest(scen, case, fulltestpath, fstype):
         resultpath = d.getVar('TEST_RESULT', True)
         tmppath = d.getVar('TEST_TMP', True)
 
@@ -75,6 +77,7 @@ def qemuimagetest_main(d):
         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())
+        os.environ["ROOTFS_EXT"] = fstype
 
         # Add in all variables from the user's original environment which
         # haven't subsequntly been set/changed
@@ -193,21 +196,22 @@ def qemuimagetest_main(d):
         os.remove(sresultfile)
     subprocess.call("touch %s" % resultfile, shell=True)
     os.symlink(resultfile, sresultfile)
-    f = open(sresultfile, "a")
-    f.write("\tTest Result for %s %s\n" % (machine, pname))
-    f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT"))
-    f.close()
     
     """generate pre-defined testcase list"""
     testlist = d.getVar('TEST_SCEN', True)
     fulllist = generate_list(testlist)
 
     """Begin testing"""
-    for index,test in enumerate(fulllist):
-        (scen, case, fullpath) = test
-        teststatus(case, "running", index, (len(fulllist) - 1))
-        runtest(scen, case, fullpath)
-        teststatus(case, "finished", index, (len(fulllist) - 1))
+    for fstype in allfstypes:
+        if fstype in testfstypes:
+            with open(sresultfile, "a") as f:
+                f.write("\tTest Result for %s %s %s\n" % (machine, pname, fstype))
+                f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT"))
+            for index,test in enumerate(fulllist):
+                (scen, case, fullpath) = test
+                teststatus(case, "running", index, (len(fulllist) - 1))
+                runtest(scen, case, fullpath, fstype)
+                teststatus(case, "finished", index, (len(fulllist) - 1))
     
     """Print Test Result"""
     ret = 0
@@ -230,5 +234,5 @@ def qemuimagetest_main(d):
     clean_tmp()
 
     if ret != 0:
-        raise bb.build.FuncFailed("Some testcases fail, pls. check test result and test log!!!")
+        raise bb.build.FuncFailed("Some tests failed. Please check the results file: %s and the log files found in: %s." % (resultfile, d.getVar('TEST_LOG', True)))
 
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index 051fee8..622c1ce 100755
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -14,8 +14,6 @@
 # Version 2.
 #
 
-TYPE="ext3"
-
 # The folder to hold all scripts running on targets
 TOOLS="$COREBASE/scripts/qemuimage-tests/tools"
 
@@ -306,18 +304,18 @@ Test_Find_Image()
 	extension=""
 	rootfs=""
 
-	while getopts "l:k:a:t:" Option
+	while getopts "l:k:a:t:e:" Option
 	do
 		case $Option in
 			l) where="$OPTARG"
 			   ;;
 			k) kernel="$OPTARG"
-			   extension="bin"
 			   ;;
 			a) arch="$OPTARG"
 			   ;;
 			t) target="$OPTARG"
-			   extension="ext3"
+			   ;;
+			e) extension="$OPTARG"
 			   ;;
 			*) echo "invalid option: -$Option" && return 1
 			   ;;
@@ -396,11 +394,11 @@ Test_Create_Qemu()
 	fi
 	
 	if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then
-		KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH})
+		KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH} -e "bin")
 	elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then
 		KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH})
 	elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then
-		KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH})
+		KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH} -e "bin")
 	fi
 
 	# If there is no kernel image found, return failed directly
@@ -409,7 +407,8 @@ Test_Create_Qemu()
 		return 1
 	fi
 	
-	ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH})
+	Test_Info "rootfs image extension selected: $ROOTFS_EXT"
+	ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH} -e "$ROOTFS_EXT")
 
 	# If there is no rootfs image found, return failed directly
 	if [ $? -eq 1 ]; then
@@ -417,7 +416,7 @@ Test_Create_Qemu()
 		return 1
 	fi
 
-	TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3"
+	TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.${ROOTFS_EXT}"
 	
 	CP=`which cp`
 
@@ -751,4 +750,4 @@ Test_Display_Syslog()
         echo "System logs:"
         cat $tmplog
         rm -f $tmplog
-}
\ No newline at end of file
+}
-- 
1.8.1.4




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

end of thread, other threads:[~2013-05-10 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-10 16:06 [PATCH 0/3] qemuimagetest support for more FSTYPES Stefan Stanacar
2013-05-10 16:06 ` [PATCH 1/3] scripts/runqemu: add ext4 to the list of extracted extensions Stefan Stanacar
2013-05-10 16:06 ` [PATCH 2/3] runqemu-internal: support for ext2 and ext4 not only ext3 Stefan Stanacar
2013-05-10 16:06 ` [PATCH 3/3] imagetest-qemu.bbclass, qemuimage-testlib: add support for more FSTYPES Stefan Stanacar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox