diff options
Diffstat (limited to 'meta/classes/imagetest-qemu.bbclass')
| -rw-r--r-- | meta/classes/imagetest-qemu.bbclass | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass index d01d1f4979..d56b44b5c4 100644 --- a/meta/classes/imagetest-qemu.bbclass +++ b/meta/classes/imagetest-qemu.bbclass | |||
| @@ -35,12 +35,12 @@ def qemuimagetest_main(d): | |||
| 35 | 35 | ||
| 36 | casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\S+$)') | 36 | casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\S+$)') |
| 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', 1) | 38 | machine = d.getVar('MACHINE', True) |
| 39 | pname = d.getVar('PN', 1) | 39 | pname = d.getVar('PN', True) |
| 40 | 40 | ||
| 41 | """function to save test cases running status""" | 41 | """function to save test cases running status""" |
| 42 | def teststatus(test, status, index, length): | 42 | def teststatus(test, status, index, length): |
| 43 | test_status = d.getVar('TEST_STATUS', 1) | 43 | test_status = d.getVar('TEST_STATUS', True) |
| 44 | if not os.path.exists(test_status): | 44 | if not os.path.exists(test_status): |
| 45 | raise bb.build.FuncFailed("No test status file existing under TEST_TMP") | 45 | raise bb.build.FuncFailed("No test status file existing under TEST_TMP") |
| 46 | 46 | ||
| @@ -51,13 +51,13 @@ def qemuimagetest_main(d): | |||
| 51 | 51 | ||
| 52 | """funtion to run each case under scenario""" | 52 | """funtion to run each case under scenario""" |
| 53 | def runtest(scen, case, fulltestpath): | 53 | def runtest(scen, case, fulltestpath): |
| 54 | resultpath = d.getVar('TEST_RESULT', 1) | 54 | resultpath = d.getVar('TEST_RESULT', True) |
| 55 | tmppath = d.getVar('TEST_TMP', 1) | 55 | tmppath = d.getVar('TEST_TMP', True) |
| 56 | 56 | ||
| 57 | """initialize log file for testcase""" | 57 | """initialize log file for testcase""" |
| 58 | logpath = d.getVar('TEST_LOG', 1) | 58 | logpath = d.getVar('TEST_LOG', True) |
| 59 | bb.utils.mkdirhier("%s/%s" % (logpath, scen)) | 59 | bb.utils.mkdirhier("%s/%s" % (logpath, scen)) |
| 60 | caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', 1))) | 60 | caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True))) |
| 61 | os.system("touch %s" % caselog) | 61 | os.system("touch %s" % caselog) |
| 62 | 62 | ||
| 63 | """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" | 63 | """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" |
| @@ -141,7 +141,7 @@ def qemuimagetest_main(d): | |||
| 141 | 141 | ||
| 142 | """Clean tmp folder for testing""" | 142 | """Clean tmp folder for testing""" |
| 143 | def clean_tmp(): | 143 | def clean_tmp(): |
| 144 | tmppath = d.getVar('TEST_TMP', 1) | 144 | tmppath = d.getVar('TEST_TMP', True) |
| 145 | 145 | ||
| 146 | if os.path.isdir(tmppath): | 146 | if os.path.isdir(tmppath): |
| 147 | for f in os.listdir(tmppath): | 147 | for f in os.listdir(tmppath): |
| @@ -155,28 +155,28 @@ def qemuimagetest_main(d): | |||
| 155 | clean_tmp() | 155 | clean_tmp() |
| 156 | 156 | ||
| 157 | """check testcase folder and create test log folder""" | 157 | """check testcase folder and create test log folder""" |
| 158 | testpath = d.getVar('TEST_DIR', 1) | 158 | testpath = d.getVar('TEST_DIR', True) |
| 159 | bb.utils.mkdirhier(testpath) | 159 | bb.utils.mkdirhier(testpath) |
| 160 | 160 | ||
| 161 | logpath = d.getVar('TEST_LOG', 1) | 161 | logpath = d.getVar('TEST_LOG', True) |
| 162 | bb.utils.mkdirhier(logpath) | 162 | bb.utils.mkdirhier(logpath) |
| 163 | 163 | ||
| 164 | tmppath = d.getVar('TEST_TMP', 1) | 164 | tmppath = d.getVar('TEST_TMP', True) |
| 165 | bb.utils.mkdirhier(tmppath) | 165 | bb.utils.mkdirhier(tmppath) |
| 166 | 166 | ||
| 167 | """initialize test status file""" | 167 | """initialize test status file""" |
| 168 | test_status = d.getVar('TEST_STATUS', 1) | 168 | test_status = d.getVar('TEST_STATUS', True) |
| 169 | if os.path.exists(test_status): | 169 | if os.path.exists(test_status): |
| 170 | os.remove(test_status) | 170 | os.remove(test_status) |
| 171 | os.system("touch %s" % test_status) | 171 | os.system("touch %s" % test_status) |
| 172 | 172 | ||
| 173 | """initialize result file""" | 173 | """initialize result file""" |
| 174 | resultpath = d.getVar('TEST_RESULT', 1) | 174 | resultpath = d.getVar('TEST_RESULT', True) |
| 175 | bb.utils.mkdirhier(resultpath) | 175 | bb.utils.mkdirhier(resultpath) |
| 176 | resultfile = os.path.join(resultpath, "testresult.%s" % d.getVar('DATETIME', 1)) | 176 | resultfile = os.path.join(resultpath, "testresult.%s" % d.getVar('DATETIME', True)) |
| 177 | sresultfile = os.path.join(resultpath, "testresult.log") | 177 | sresultfile = os.path.join(resultpath, "testresult.log") |
| 178 | 178 | ||
| 179 | machine = d.getVar('MACHINE', 1) | 179 | machine = d.getVar('MACHINE', True) |
| 180 | 180 | ||
| 181 | if os.path.exists(sresultfile): | 181 | if os.path.exists(sresultfile): |
| 182 | os.remove(sresultfile) | 182 | os.remove(sresultfile) |
| @@ -188,7 +188,7 @@ def qemuimagetest_main(d): | |||
| 188 | f.close() | 188 | f.close() |
| 189 | 189 | ||
| 190 | """generate pre-defined testcase list""" | 190 | """generate pre-defined testcase list""" |
| 191 | testlist = d.getVar('TEST_SCEN', 1) | 191 | testlist = d.getVar('TEST_SCEN', True) |
| 192 | fulllist = generate_list(testlist) | 192 | fulllist = generate_list(testlist) |
| 193 | 193 | ||
| 194 | """Begin testing""" | 194 | """Begin testing""" |
