summaryrefslogtreecommitdiffstats
path: root/meta/classes/imagetest-qemu.bbclass
diff options
context:
space:
mode:
authorJiajun Xu <jiajun.xu@intel.com>2011-01-13 09:46:14 +0800
committerSaul Wold <sgw@linux.intel.com>2011-01-14 08:09:26 -0800
commit2119274314f49678de78dc1c5aa2971676fa6774 (patch)
tree3ebf3b48d3a0e99930f7184dfe147c7259bd90f1 /meta/classes/imagetest-qemu.bbclass
parent897530621fabf3c345c302050a5c21e16097a2ba (diff)
downloadopenembedded-core-contrib-2119274314f49678de78dc1c5aa2971676fa6774.tar.gz
qemuimagetest: Use the same image in sanity testing to fix the timeout issue on autobuilder
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>
Diffstat (limited to 'meta/classes/imagetest-qemu.bbclass')
-rw-r--r--meta/classes/imagetest-qemu.bbclass22
1 files changed, 19 insertions, 3 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index bcae10d61d..28bb218272 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -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!!!")