summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJiajun Xu <jiajun.xu@intel.com>2011-01-19 00:22:30 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-20 21:36:57 +0000
commit3e052919c9307ba73a1db0f705b7dc1a677cb80f (patch)
tree14861629035fb78eaae19645801f49a608536ecf /meta
parent50b208612945c638e3f4965ebf90ade4aac5b636 (diff)
downloadpoky-3e052919c9307ba73a1db0f705b7dc1a677cb80f.tar.gz
qemuimagetest: Use same image during sanity testing instead of copying a new image for each case
To reduce the time on sanity testing, we remove variable SHARE_IMAGE and use a new variable TEST_SERIALIZE in local.conf. It is by default set to 1. Poky will copy and boot the to-be tested image for only once. It will not remove or kill the image and test cases will be serialized executed against the same image. If it is set to 0, image is always be copied for each cases, which takes much time. I had a experiment that latest qemuppc sato only takes 7 minutes to finish 9 sanity test cases, which takes more than 20 minutes before. I also removed sanity case "boot" from sato/sdk/lsb because the other cases for these targets already cover the check point of "boot". Signed-off-by Jiajun Xu <jiajun.xu@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/imagetest-qemu.bbclass33
-rw-r--r--meta/conf/local.conf.sample10
2 files changed, 33 insertions, 10 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index 28bb218272..8301df8452 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -5,7 +5,9 @@ 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" 8TEST_STATUS ?= "${TEST_TMP}/status"
9TARGET_IPSAVE ?= "${TEST_TMP}/target_ip"
10TEST_SERIALIZE ?= "1"
9 11
10python do_qemuimagetest() { 12python do_qemuimagetest() {
11 qemuimagetest_main(d) 13 qemuimagetest_main(d)
@@ -35,6 +37,17 @@ def qemuimagetest_main(d):
35 machine = bb.data.getVar('MACHINE', d, 1) 37 machine = bb.data.getVar('MACHINE', d, 1)
36 pname = bb.data.getVar('PN', d, 1) 38 pname = bb.data.getVar('PN', d, 1)
37 39
40 """function to save test cases running status"""
41 def teststatus(test, status, index, length):
42 test_status = bb.data.getVar('TEST_STATUS', d, 1)
43 if not os.path.exists(test_status):
44 raise bb.build.FuncFailed("No test status file existing under TEST_TMP")
45
46 f = open(test_status, "w")
47 f.write("\t%-15s%-15s%-15s%-15s\n" % ("Case", "Status", "Number", "Total"))
48 f.write("\t%-15s%-15s%-15s%-15s\n" % (case, status, index, length))
49 f.close()
50
38 """funtion to run each case under scenario""" 51 """funtion to run each case under scenario"""
39 def runtest(scen, case, fulltestpath): 52 def runtest(scen, case, fulltestpath):
40 resultpath = bb.data.getVar('TEST_RESULT', d, 1) 53 resultpath = bb.data.getVar('TEST_RESULT', d, 1)
@@ -56,11 +69,13 @@ def qemuimagetest_main(d):
56 os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True) 69 os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True)
57 os.environ["POKYBASE"] = bb.data.getVar("POKYBASE", d, True) 70 os.environ["POKYBASE"] = bb.data.getVar("POKYBASE", d, True)
58 os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True) 71 os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True)
59 os.environ["SHARE_IMAGE"] = bb.data.getVar("SHARE_IMAGE", d, True) 72 os.environ["TEST_STATUS"] = bb.data.getVar("TEST_STATUS", d, True)
73 os.environ["TARGET_IPSAVE"] = bb.data.getVar("TARGET_IPSAVE", d, True)
74 os.environ["TEST_SERIALIZE"] = bb.data.getVar("TEST_SERIALIZE", d, True)
60 75
61 """run Test Case""" 76 """run Test Case"""
62 bb.note("Run %s test in scenario %s" % (case, scen)) 77 bb.note("Run %s test in scenario %s" % (case, scen))
63 os.system("%s | tee -a %s" % (fulltestpath, caselog)) 78 os.system("%s" % fulltestpath)
64 79
65 """Generate testcase list in runtime""" 80 """Generate testcase list in runtime"""
66 def generate_list(testlist): 81 def generate_list(testlist):
@@ -119,7 +134,13 @@ def qemuimagetest_main(d):
119 134
120 tmppath = bb.data.getVar('TEST_TMP', d, 1) 135 tmppath = bb.data.getVar('TEST_TMP', d, 1)
121 bb.utils.mkdirhier(tmppath) 136 bb.utils.mkdirhier(tmppath)
122 137
138 """initialize test status file"""
139 test_status = bb.data.getVar('TEST_STATUS', d, 1)
140 if os.path.exists(test_status):
141 os.remove(test_status)
142 os.system("touch %s" % test_status)
143
123 """initialize result file""" 144 """initialize result file"""
124 resultpath = bb.data.getVar('TEST_RESULT', d, 1) 145 resultpath = bb.data.getVar('TEST_RESULT', d, 1)
125 bb.utils.mkdirhier(resultpath) 146 bb.utils.mkdirhier(resultpath)
@@ -142,9 +163,11 @@ def qemuimagetest_main(d):
142 fulllist = generate_list(testlist) 163 fulllist = generate_list(testlist)
143 164
144 """Begin testing""" 165 """Begin testing"""
145 for test in fulllist: 166 for index,test in enumerate(fulllist):
146 (scen, case, fullpath) = test 167 (scen, case, fullpath) = test
168 teststatus(case, "running", index, (len(fulllist) - 1))
147 runtest(scen, case, fullpath) 169 runtest(scen, case, fullpath)
170 teststatus(case, "finished", index, (len(fulllist) - 1))
148 171
149 """Print Test Result""" 172 """Print Test Result"""
150 ret = 0 173 ret = 0
diff --git a/meta/conf/local.conf.sample b/meta/conf/local.conf.sample
index cb0e54887f..4567a828ff 100644
--- a/meta/conf/local.conf.sample
+++ b/meta/conf/local.conf.sample
@@ -158,11 +158,11 @@ ENABLE_BINARY_LOCALE_GENERATION = "1"
158 158
159#Because of the QEMU booting slowness issue(see bug #646 and #618), autobuilder 159#Because of the QEMU booting slowness issue(see bug #646 and #618), autobuilder
160#may suffer a timeout issue when running sanity test. We introduce variable 160#may suffer a timeout issue when running sanity test. We introduce variable
161#SHARE_IMAGE here to fix the issue. It is by default set to 1. Poky will copy 161#TEST_SERIALIZE here to reduce the time on sanity test. It is by default set
162#latest built-out image and keep using it in sanity testing. If it is set to 0, 162#to 1. Poky will start image and run cases in the same image without reboot
163#latest built-out image will be copied and tested for each case, which will take 163#or kill. If it is set to 0, the image will be copied and tested for each
164#much time. 164#case, which will take much time.
165#SHARE_IMAGE = "1" 165#TEST_SERIALIZE = "1"
166 166
167# Set GLIBC_GENERATE_LOCALES to the locales you wish to generate should you not 167# Set GLIBC_GENERATE_LOCALES to the locales you wish to generate should you not
168# wish to perform the time-consuming step of generating all LIBC locales. 168# wish to perform the time-consuming step of generating all LIBC locales.