diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-05-29 22:53:06 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 12:04:45 +0100 |
commit | e40995e569289598a1d9d71e19734402f2b54718 (patch) | |
tree | 108328e272a149da0e27dec0e0f0bebe602b80b8 /meta/classes/imagetest-qemu.bbclass | |
parent | e4c35790d6dc23a0933f188f52fa4434784e1d98 (diff) | |
download | poky-e40995e569289598a1d9d71e19734402f2b54718.tar.gz |
meta: replace os.system with subprocess.call
Replace os.system with subprocess.call since the older function would
fail (more or less) silently if the executed program cannot be found
More info:
http://docs.python.org/library/subprocess.html#subprocess-replacements
[YOCTO #2454]
(From OE-Core rev: a07d03cc6f67c88feb9813ae7deb6e4a93552dfe)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/imagetest-qemu.bbclass')
-rw-r--r-- | meta/classes/imagetest-qemu.bbclass | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass index d56b44b5c4..f51eeba98c 100644 --- a/meta/classes/imagetest-qemu.bbclass +++ b/meta/classes/imagetest-qemu.bbclass | |||
@@ -28,6 +28,7 @@ def qemuimagetest_main(d): | |||
28 | import re | 28 | import re |
29 | import os | 29 | import os |
30 | import shutil | 30 | import shutil |
31 | import subprocess | ||
31 | 32 | ||
32 | """ | 33 | """ |
33 | Test Controller for automated testing. | 34 | Test Controller for automated testing. |
@@ -58,7 +59,7 @@ def qemuimagetest_main(d): | |||
58 | logpath = d.getVar('TEST_LOG', True) | 59 | logpath = d.getVar('TEST_LOG', True) |
59 | bb.utils.mkdirhier("%s/%s" % (logpath, scen)) | 60 | bb.utils.mkdirhier("%s/%s" % (logpath, scen)) |
60 | caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True))) | 61 | caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True))) |
61 | os.system("touch %s" % caselog) | 62 | subprocess.call("touch %s" % caselog, shell=True) |
62 | 63 | ||
63 | """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" | 64 | """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" |
64 | os.environ["PATH"] = d.getVar("PATH", True) | 65 | os.environ["PATH"] = d.getVar("PATH", True) |
@@ -78,7 +79,7 @@ def qemuimagetest_main(d): | |||
78 | 79 | ||
79 | """run Test Case""" | 80 | """run Test Case""" |
80 | bb.note("Run %s test in scenario %s" % (case, scen)) | 81 | bb.note("Run %s test in scenario %s" % (case, scen)) |
81 | os.system("%s" % fulltestpath) | 82 | subprocess.call("%s" % fulltestpath, shell=True) |
82 | 83 | ||
83 | """function to check testcase list and remove inappropriate cases""" | 84 | """function to check testcase list and remove inappropriate cases""" |
84 | def check_list(list): | 85 | def check_list(list): |
@@ -168,7 +169,7 @@ def qemuimagetest_main(d): | |||
168 | test_status = d.getVar('TEST_STATUS', True) | 169 | test_status = d.getVar('TEST_STATUS', True) |
169 | if os.path.exists(test_status): | 170 | if os.path.exists(test_status): |
170 | os.remove(test_status) | 171 | os.remove(test_status) |
171 | os.system("touch %s" % test_status) | 172 | subprocess.call("touch %s" % test_status, shell=True) |
172 | 173 | ||
173 | """initialize result file""" | 174 | """initialize result file""" |
174 | resultpath = d.getVar('TEST_RESULT', True) | 175 | resultpath = d.getVar('TEST_RESULT', True) |
@@ -180,7 +181,7 @@ def qemuimagetest_main(d): | |||
180 | 181 | ||
181 | if os.path.exists(sresultfile): | 182 | if os.path.exists(sresultfile): |
182 | os.remove(sresultfile) | 183 | os.remove(sresultfile) |
183 | os.system("touch %s" % resultfile) | 184 | subprocess.call("touch %s" % resultfile, shell=True) |
184 | os.symlink(resultfile, sresultfile) | 185 | os.symlink(resultfile, sresultfile) |
185 | f = open(sresultfile, "a") | 186 | f = open(sresultfile, "a") |
186 | f.write("\tTest Result for %s %s\n" % (machine, pname)) | 187 | f.write("\tTest Result for %s %s\n" % (machine, pname)) |