diff options
-rw-r--r-- | meta/classes/imagetest-qemu.bbclass | 26 | ||||
-rwxr-xr-x | scripts/qemuimage-testlib | 19 |
2 files changed, 24 insertions, 21 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 | ||
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib index 051fee806c..622c1ce438 100755 --- a/scripts/qemuimage-testlib +++ b/scripts/qemuimage-testlib | |||
@@ -14,8 +14,6 @@ | |||
14 | # Version 2. | 14 | # Version 2. |
15 | # | 15 | # |
16 | 16 | ||
17 | TYPE="ext3" | ||
18 | |||
19 | # The folder to hold all scripts running on targets | 17 | # The folder to hold all scripts running on targets |
20 | TOOLS="$COREBASE/scripts/qemuimage-tests/tools" | 18 | TOOLS="$COREBASE/scripts/qemuimage-tests/tools" |
21 | 19 | ||
@@ -306,18 +304,18 @@ Test_Find_Image() | |||
306 | extension="" | 304 | extension="" |
307 | rootfs="" | 305 | rootfs="" |
308 | 306 | ||
309 | while getopts "l:k:a:t:" Option | 307 | while getopts "l:k:a:t:e:" Option |
310 | do | 308 | do |
311 | case $Option in | 309 | case $Option in |
312 | l) where="$OPTARG" | 310 | l) where="$OPTARG" |
313 | ;; | 311 | ;; |
314 | k) kernel="$OPTARG" | 312 | k) kernel="$OPTARG" |
315 | extension="bin" | ||
316 | ;; | 313 | ;; |
317 | a) arch="$OPTARG" | 314 | a) arch="$OPTARG" |
318 | ;; | 315 | ;; |
319 | t) target="$OPTARG" | 316 | t) target="$OPTARG" |
320 | extension="ext3" | 317 | ;; |
318 | e) extension="$OPTARG" | ||
321 | ;; | 319 | ;; |
322 | *) echo "invalid option: -$Option" && return 1 | 320 | *) echo "invalid option: -$Option" && return 1 |
323 | ;; | 321 | ;; |
@@ -396,11 +394,11 @@ Test_Create_Qemu() | |||
396 | fi | 394 | fi |
397 | 395 | ||
398 | if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then | 396 | if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then |
399 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH}) | 397 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH} -e "bin") |
400 | elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then | 398 | elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then |
401 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH}) | 399 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH}) |
402 | elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then | 400 | elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then |
403 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH}) | 401 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH} -e "bin") |
404 | fi | 402 | fi |
405 | 403 | ||
406 | # If there is no kernel image found, return failed directly | 404 | # If there is no kernel image found, return failed directly |
@@ -409,7 +407,8 @@ Test_Create_Qemu() | |||
409 | return 1 | 407 | return 1 |
410 | fi | 408 | fi |
411 | 409 | ||
412 | ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH}) | 410 | Test_Info "rootfs image extension selected: $ROOTFS_EXT" |
411 | ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH} -e "$ROOTFS_EXT") | ||
413 | 412 | ||
414 | # If there is no rootfs image found, return failed directly | 413 | # If there is no rootfs image found, return failed directly |
415 | if [ $? -eq 1 ]; then | 414 | if [ $? -eq 1 ]; then |
@@ -417,7 +416,7 @@ Test_Create_Qemu() | |||
417 | return 1 | 416 | return 1 |
418 | fi | 417 | fi |
419 | 418 | ||
420 | TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3" | 419 | TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.${ROOTFS_EXT}" |
421 | 420 | ||
422 | CP=`which cp` | 421 | CP=`which cp` |
423 | 422 | ||
@@ -751,4 +750,4 @@ Test_Display_Syslog() | |||
751 | echo "System logs:" | 750 | echo "System logs:" |
752 | cat $tmplog | 751 | cat $tmplog |
753 | rm -f $tmplog | 752 | rm -f $tmplog |
754 | } \ No newline at end of file | 753 | } |