diff options
author | Stefan Stanacar <stefanx.stanacar@intel.com> | 2013-05-10 19:06:26 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-12 08:33:16 +0100 |
commit | cef2446eb34c878ed9b5087d53c334cb407a2190 (patch) | |
tree | a377717e7945b40780c6333fa0f92fca1da42ceb /meta/classes | |
parent | 2c2dd5be3ea38e8639ed3ffb65dd9ad638c08a59 (diff) | |
download | poky-cef2446eb34c878ed9b5087d53c334cb407a2190.tar.gz |
imagetest-qemu.bbclass, qemuimage-testlib: add support for more FSTYPES
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
(From OE-Core rev: 95b7cafafcaa4dda7328632475003f5778ab95bd)
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/imagetest-qemu.bbclass | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass index 94bed3b797..7083a99381 100644 --- a/meta/classes/imagetest-qemu.bbclass +++ b/meta/classes/imagetest-qemu.bbclass | |||
@@ -37,6 +37,8 @@ def qemuimagetest_main(d): | |||
37 | resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)') | 37 | resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)') |
38 | machine = d.getVar('MACHINE', True) | 38 | machine = d.getVar('MACHINE', True) |
39 | pname = d.getVar('PN', True) | 39 | pname = d.getVar('PN', True) |
40 | allfstypes = d.getVar("IMAGE_FSTYPES", True).split() | ||
41 | testfstypes = [ "ext2", "ext3", "ext4", "jffs2", "btrfs" ] | ||
40 | 42 | ||
41 | """function to save test cases running status""" | 43 | """function to save test cases running status""" |
42 | def teststatus(test, status, index, length): | 44 | def teststatus(test, status, index, length): |
@@ -50,7 +52,7 @@ def qemuimagetest_main(d): | |||
50 | f.close() | 52 | f.close() |
51 | 53 | ||
52 | """funtion to run each case under scenario""" | 54 | """funtion to run each case under scenario""" |
53 | def runtest(scen, case, fulltestpath): | 55 | def runtest(scen, case, fulltestpath, fstype): |
54 | resultpath = d.getVar('TEST_RESULT', True) | 56 | resultpath = d.getVar('TEST_RESULT', True) |
55 | tmppath = d.getVar('TEST_TMP', True) | 57 | tmppath = d.getVar('TEST_TMP', True) |
56 | 58 | ||
@@ -75,6 +77,7 @@ def qemuimagetest_main(d): | |||
75 | os.environ["TEST_SERIALIZE"] = d.getVar("TEST_SERIALIZE", True) | 77 | os.environ["TEST_SERIALIZE"] = d.getVar("TEST_SERIALIZE", True) |
76 | os.environ["SDK_NAME"] = d.getVar("SDK_NAME", True) | 78 | os.environ["SDK_NAME"] = d.getVar("SDK_NAME", True) |
77 | os.environ["RUNQEMU_LOGFILE"] = d.expand("${T}/log.runqemutest.%s" % os.getpid()) | 79 | os.environ["RUNQEMU_LOGFILE"] = d.expand("${T}/log.runqemutest.%s" % os.getpid()) |
80 | os.environ["ROOTFS_EXT"] = fstype | ||
78 | 81 | ||
79 | # Add in all variables from the user's original environment which | 82 | # Add in all variables from the user's original environment which |
80 | # haven't subsequntly been set/changed | 83 | # haven't subsequntly been set/changed |
@@ -193,21 +196,22 @@ def qemuimagetest_main(d): | |||
193 | os.remove(sresultfile) | 196 | os.remove(sresultfile) |
194 | subprocess.call("touch %s" % resultfile, shell=True) | 197 | subprocess.call("touch %s" % resultfile, shell=True) |
195 | os.symlink(resultfile, sresultfile) | 198 | os.symlink(resultfile, sresultfile) |
196 | f = open(sresultfile, "a") | ||
197 | f.write("\tTest Result for %s %s\n" % (machine, pname)) | ||
198 | f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT")) | ||
199 | f.close() | ||
200 | 199 | ||
201 | """generate pre-defined testcase list""" | 200 | """generate pre-defined testcase list""" |
202 | testlist = d.getVar('TEST_SCEN', True) | 201 | testlist = d.getVar('TEST_SCEN', True) |
203 | fulllist = generate_list(testlist) | 202 | fulllist = generate_list(testlist) |
204 | 203 | ||
205 | """Begin testing""" | 204 | """Begin testing""" |
206 | for index,test in enumerate(fulllist): | 205 | for fstype in allfstypes: |
207 | (scen, case, fullpath) = test | 206 | if fstype in testfstypes: |
208 | teststatus(case, "running", index, (len(fulllist) - 1)) | 207 | with open(sresultfile, "a") as f: |
209 | runtest(scen, case, fullpath) | 208 | f.write("\tTest Result for %s %s %s\n" % (machine, pname, fstype)) |
210 | teststatus(case, "finished", index, (len(fulllist) - 1)) | 209 | f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT")) |
210 | for index,test in enumerate(fulllist): | ||
211 | (scen, case, fullpath) = test | ||
212 | teststatus(case, "running", index, (len(fulllist) - 1)) | ||
213 | runtest(scen, case, fullpath, fstype) | ||
214 | teststatus(case, "finished", index, (len(fulllist) - 1)) | ||
211 | 215 | ||
212 | """Print Test Result""" | 216 | """Print Test Result""" |
213 | ret = 0 | 217 | ret = 0 |
@@ -230,5 +234,5 @@ def qemuimagetest_main(d): | |||
230 | clean_tmp() | 234 | clean_tmp() |
231 | 235 | ||
232 | if ret != 0: | 236 | if ret != 0: |
233 | raise bb.build.FuncFailed("Some testcases fail, pls. check test result and test log!!!") | 237 | 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))) |
234 | 238 | ||