]> code.ossystems Code Review - openembedded-core.git/commitdiff
qemuimagetest: Use the same image in sanity testing to fix the timeout issue on autob...
authorJiajun Xu <jiajun.xu@intel.com>
Thu, 13 Jan 2011 01:46:14 +0000 (09:46 +0800)
committerSaul Wold <sgw@linux.intel.com>
Fri, 14 Jan 2011 16:09:26 +0000 (08:09 -0800)
Fixes [BUGID #595]

Because of the QEMU booting slowness issue(see bug #646 and #618), autobuilder
may suffer a timeout issue when running sanity test. We introduce variable
SHARE_IMAGE here to fix the issue. It is by default set to 1. Poky will copy
latest built-out image and keep using it in sanity testing. If it is set to 0,
latest built-out image will be copied and tested for each case, which will take
much time.

Signed-off-by Jiajun Xu <jiajun.xu@intel.com>

27 files changed:
meta/classes/imagetest-qemu.bbclass
meta/conf/local.conf.sample
scripts/qemuimage-testlib
scripts/qemuimage-tests/sanity/compiler
scripts/qemuimage-tests/sanity/connman
scripts/qemuimage-tests/sanity/dmesg
scripts/qemuimage-tests/sanity/rpm_query
scripts/qemuimage-tests/sanity/scp
scripts/qemuimage-tests/sanity/shutdown
scripts/qemuimage-tests/sanity/ssh
scripts/qemuimage-tests/sanity/zypper_help
scripts/qemuimage-tests/sanity/zypper_search
scripts/qemuimage-tests/scenario/qemuarm/poky-image-lsb
scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
scripts/qemuimage-tests/scenario/qemumips/poky-image-lsb
scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
scripts/qemuimage-tests/scenario/qemuppc/poky-image-lsb
scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
scripts/qemuimage-tests/scenario/qemux86-64/poky-image-lsb
scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato
scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk
scripts/qemuimage-tests/scenario/qemux86/poky-image-lsb
scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk

index bcae10d61dea9fc343fe46ee2c340650d00082ec..28bb2182725c87552b129f30939c0cf1c04641f5 100644 (file)
@@ -5,6 +5,7 @@ TEST_LOG ?= "${LOG_DIR}/qemuimagetests"
 TEST_RESULT ?= "${TEST_DIR}/result"
 TEST_TMP ?= "${TEST_DIR}/tmp"
 TEST_SCEN ?= "sanity"
+SHARE_IMAGE ?= "1"
 
 python do_qemuimagetest() {
     qemuimagetest_main(d)
@@ -37,7 +38,7 @@ def qemuimagetest_main(d):
     """funtion to run each case under scenario"""
     def runtest(scen, case, fulltestpath):
         resultpath = bb.data.getVar('TEST_RESULT', d, 1)
-        testpath = bb.data.getVar('TEST_DIR', d, 1)
+        tmppath = bb.data.getVar('TEST_TMP', d, 1)
 
         """initialize log file for testcase"""
         logpath = bb.data.getVar('TEST_LOG', d, 1)
@@ -45,10 +46,9 @@ def qemuimagetest_main(d):
         caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, bb.data.getVar('DATETIME', d, 1)))
         os.system("touch %s" % caselog)
         
-
         """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH"""
         os.environ["PATH"] = bb.data.getVar("PATH", d, True)
-        os.environ["TEST_TMP"] = testpath
+        os.environ["TEST_TMP"] = tmppath
         os.environ["TEST_RESULT"] = resultpath
         os.environ["DEPLOY_DIR"] = bb.data.getVar("DEPLOY_DIR", d, True)
         os.environ["QEMUARCH"] = machine
@@ -56,6 +56,7 @@ def qemuimagetest_main(d):
         os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True)
         os.environ["POKYBASE"] = bb.data.getVar("POKYBASE", d, True)
         os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True)
+        os.environ["SHARE_IMAGE"] = bb.data.getVar("SHARE_IMAGE", d, True)
 
         """run Test Case"""
         bb.note("Run %s test in scenario %s" % (case, scen))
@@ -97,6 +98,18 @@ def qemuimagetest_main(d):
                        list.append((item, casefile, fulltestcase))
         return list
 
+    """Clean tmp folder for testing"""
+    def clean_tmp():
+        tmppath = bb.data.getVar('TEST_TMP', d, 1)
+
+        if os.path.isdir(tmppath):
+            for f in os.listdir(tmppath):
+                tmpfile = os.path.join(tmppath, f)
+                os.remove(tmpfile)
+
+    """Before running testing, clean temp folder first"""
+    clean_tmp()
+
     """check testcase folder and create test log folder"""
     testpath = bb.data.getVar('TEST_DIR', d, 1)
     bb.utils.mkdirhier(testpath)
@@ -150,6 +163,9 @@ def qemuimagetest_main(d):
             bb.note(line)
     f.close()
 
+    """Clean temp files for testing"""
+    clean_tmp()
+
     if ret != 0:
         raise bb.build.FuncFailed("Some testcases fail, pls. check test result and test log!!!")
 
index 9c58e6bc0ca16ef17d2c53ee3fbb8dff8470be8c..cb0e54887f0e864366315719affc198595b3dd1e 100644 (file)
@@ -156,6 +156,14 @@ ENABLE_BINARY_LOCALE_GENERATION = "1"
 # list them like following.
 #TEST_SCEN = "sanity bat sanity:boot"
 
+#Because of the QEMU booting slowness issue(see bug #646 and #618), autobuilder
+#may suffer a timeout issue when running sanity test. We introduce variable
+#SHARE_IMAGE here to fix the issue. It is by default set to 1. Poky will copy
+#latest built-out image and keep using it in sanity testing. If it is set to 0,
+#latest built-out image will be copied and tested for each case, which will take
+#much time.
+#SHARE_IMAGE = "1"
+
 # Set GLIBC_GENERATE_LOCALES to the locales you wish to generate should you not
 # wish to perform the time-consuming step of generating all LIBC locales.
 # NOTE: If removing en_US.UTF-8 you will also need to uncomment, and set
index e2c2d244c56738c5798f9066db9027d294dac98a..b9afcf5bb6633ae3e33521095204e059b92d4d63 100644 (file)
@@ -383,9 +383,16 @@ Test_Create_Qemu()
        TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3"
        
        CP=`which cp`
+
+       # When SHARE_IMAGE is set, we use the existing image under tmp folder
        if [ -e "$TEST_ROOTFS_IMAGE" ]; then
+               if [ ${SHARE_IMAGE} -eq 1 ]; then
+                       ROOTFS_IMAGE="$TEST_ROOTFS_IMAGE"
+                       TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-shared-test.ext3"
+               fi
                rm -rf $TEST_ROOTFS_IMAGE
        fi
+
        $CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE
 
        if [ $? -ne 0 ]; then
index 0290540e71d17bbf8a354f254f104786440778a8..d3168a973cb068f5e9ee7566178f9a8356c1549d 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index 8c5b7c5cf6bb56eede9b1fd756ef0bc2c7cd5ba4..6e19b81b16aad83916923c8f6255a46499a530a3 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index 36813dcd4326040d0fa75dae4e13163ea7d11ad8..d98d7aff84e36760d08db39ef60c6153f93a14f4 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index 9962115d6784278d2a7d206099599233ae29ca62..76639019625a7160381f39c39b6e0c8efb419e5f 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index ce3489d66454ba15b88927ee79256242df27c0f1..ca19857928b6ebdd4c71bc236b136d525794a131 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 SPID=0
 i=0
index e36b4a983de701d82648953f4a085ecfbc2c15ce..dde03c9a10011ce95e9ff68d84c8770ab31b6cfa 100755 (executable)
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+if [ $SHARE_IMAGE -eq 0 ]; then
+       TIMEOUT=200
+elif [ $SHARE_IMAGE -eq 1 ]; then
+       TIMEOUT=500
+fi
+
 RET=1
 i=0
 
index 084530adfbb7bdbfb4af5c35e7021845c6a44a9d..e0ade72ca322b8f6e26d23c5f25ac44cb359ddc8 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index e052501957c842e66f85979232625bc2791c4da7..48e121c9e1e880566224e3549c8eef27769641ec 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index b756db8fa3586460f30274a31b164897c63b5eae..9ae69ebf1fc6b294bff28d5a70ba153480b34cb5 100755 (executable)
@@ -11,7 +11,7 @@
 
 . $POKYBASE/scripts/qemuimage-testlib
 
-TIMEOUT=360
+TIMEOUT=200
 RET=1
 
 # Start qemu and check its network
index 32d2bd144b39accacc3ed2f924346a1aabdf54d6..0eb1926cfdce217906fb26e93e8453ad1db208c1 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 7b949a854c5665031c4e70a8cea954e8d81ec8d7..b60a89af5115e295793a8b196b75262b3779f210 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 3a8b1293bd8b32e143d6a587ae71276291152cbf..53c9ad591e142eea3ccd0f7f3ef1d742fcba5ef9 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 32d2bd144b39accacc3ed2f924346a1aabdf54d6..0eb1926cfdce217906fb26e93e8453ad1db208c1 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 7b949a854c5665031c4e70a8cea954e8d81ec8d7..b60a89af5115e295793a8b196b75262b3779f210 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 3a8b1293bd8b32e143d6a587ae71276291152cbf..53c9ad591e142eea3ccd0f7f3ef1d742fcba5ef9 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 32d2bd144b39accacc3ed2f924346a1aabdf54d6..0eb1926cfdce217906fb26e93e8453ad1db208c1 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 7b949a854c5665031c4e70a8cea954e8d81ec8d7..b60a89af5115e295793a8b196b75262b3779f210 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 3a8b1293bd8b32e143d6a587ae71276291152cbf..53c9ad591e142eea3ccd0f7f3ef1d742fcba5ef9 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 32d2bd144b39accacc3ed2f924346a1aabdf54d6..0eb1926cfdce217906fb26e93e8453ad1db208c1 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 7b949a854c5665031c4e70a8cea954e8d81ec8d7..b60a89af5115e295793a8b196b75262b3779f210 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 3a8b1293bd8b32e143d6a587ae71276291152cbf..53c9ad591e142eea3ccd0f7f3ef1d742fcba5ef9 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 32d2bd144b39accacc3ed2f924346a1aabdf54d6..0eb1926cfdce217906fb26e93e8453ad1db208c1 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 7b949a854c5665031c4e70a8cea954e8d81ec8d7..b60a89af5115e295793a8b196b75262b3779f210 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query
index 3a8b1293bd8b32e143d6a587ae71276291152cbf..53c9ad591e142eea3ccd0f7f3ef1d742fcba5ef9 100644 (file)
@@ -1,8 +1,8 @@
+sanity shutdown
 sanity boot
 sanity ssh
 sanity scp
 sanity dmesg
-sanity shutdown
 sanity zypper_help
 sanity zypper_search
 sanity rpm_query