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)
downloadpoky-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"
5TEST_RESULT ?= "${TEST_DIR}/result" 5TEST_RESULT ?= "${TEST_DIR}/result"
6TEST_TMP ?= "${TEST_DIR}/tmp" 6TEST_TMP ?= "${TEST_DIR}/tmp"
7TEST_SCEN ?= "sanity" 7TEST_SCEN ?= "sanity"
8SHARE_IMAGE ?= "1"
8 9
9python do_qemuimagetest() { 10python do_qemuimagetest() {
10 qemuimagetest_main(d) 11 qemuimagetest_main(d)
@@ -37,7 +38,7 @@ def qemuimagetest_main(d):
37 """funtion to run each case under scenario""" 38 """funtion to run each case under scenario"""
38 def runtest(scen, case, fulltestpath): 39 def runtest(scen, case, fulltestpath):
39 resultpath = bb.data.getVar('TEST_RESULT', d, 1) 40 resultpath = bb.data.getVar('TEST_RESULT', d, 1)
40 testpath = bb.data.getVar('TEST_DIR', d, 1) 41 tmppath = bb.data.getVar('TEST_TMP', d, 1)
41 42
42 """initialize log file for testcase""" 43 """initialize log file for testcase"""
43 logpath = bb.data.getVar('TEST_LOG', d, 1) 44 logpath = bb.data.getVar('TEST_LOG', d, 1)
@@ -45,10 +46,9 @@ def qemuimagetest_main(d):
45 caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, bb.data.getVar('DATETIME', d, 1))) 46 caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, bb.data.getVar('DATETIME', d, 1)))
46 os.system("touch %s" % caselog) 47 os.system("touch %s" % caselog)
47 48
48
49 """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" 49 """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH"""
50 os.environ["PATH"] = bb.data.getVar("PATH", d, True) 50 os.environ["PATH"] = bb.data.getVar("PATH", d, True)
51 os.environ["TEST_TMP"] = testpath 51 os.environ["TEST_TMP"] = tmppath
52 os.environ["TEST_RESULT"] = resultpath 52 os.environ["TEST_RESULT"] = resultpath
53 os.environ["DEPLOY_DIR"] = bb.data.getVar("DEPLOY_DIR", d, True) 53 os.environ["DEPLOY_DIR"] = bb.data.getVar("DEPLOY_DIR", d, True)
54 os.environ["QEMUARCH"] = machine 54 os.environ["QEMUARCH"] = machine
@@ -56,6 +56,7 @@ def qemuimagetest_main(d):
56 os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True) 56 os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True)
57 os.environ["POKYBASE"] = bb.data.getVar("POKYBASE", d, True) 57 os.environ["POKYBASE"] = bb.data.getVar("POKYBASE", d, True)
58 os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True) 58 os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True)
59 os.environ["SHARE_IMAGE"] = bb.data.getVar("SHARE_IMAGE", d, True)
59 60
60 """run Test Case""" 61 """run Test Case"""
61 bb.note("Run %s test in scenario %s" % (case, scen)) 62 bb.note("Run %s test in scenario %s" % (case, scen))
@@ -97,6 +98,18 @@ def qemuimagetest_main(d):
97 list.append((item, casefile, fulltestcase)) 98 list.append((item, casefile, fulltestcase))
98 return list 99 return list
99 100
101 """Clean tmp folder for testing"""
102 def clean_tmp():
103 tmppath = bb.data.getVar('TEST_TMP', d, 1)
104
105 if os.path.isdir(tmppath):
106 for f in os.listdir(tmppath):
107 tmpfile = os.path.join(tmppath, f)
108 os.remove(tmpfile)
109
110 """Before running testing, clean temp folder first"""
111 clean_tmp()
112
100 """check testcase folder and create test log folder""" 113 """check testcase folder and create test log folder"""
101 testpath = bb.data.getVar('TEST_DIR', d, 1) 114 testpath = bb.data.getVar('TEST_DIR', d, 1)
102 bb.utils.mkdirhier(testpath) 115 bb.utils.mkdirhier(testpath)
@@ -150,6 +163,9 @@ def qemuimagetest_main(d):
150 bb.note(line) 163 bb.note(line)
151 f.close() 164 f.close()
152 165
166 """Clean temp files for testing"""
167 clean_tmp()
168
153 if ret != 0: 169 if ret != 0:
154 raise bb.build.FuncFailed("Some testcases fail, pls. check test result and test log!!!") 170 raise bb.build.FuncFailed("Some testcases fail, pls. check test result and test log!!!")
155 171