From a07d03cc6f67c88feb9813ae7deb6e4a93552dfe Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Tue, 29 May 2012 22:53:06 +0800 Subject: 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] Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- meta/classes/imagetest-qemu.bbclass | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'meta/classes/imagetest-qemu.bbclass') 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): import re import os import shutil + import subprocess """ Test Controller for automated testing. @@ -58,7 +59,7 @@ def qemuimagetest_main(d): logpath = d.getVar('TEST_LOG', True) bb.utils.mkdirhier("%s/%s" % (logpath, scen)) caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True))) - os.system("touch %s" % caselog) + subprocess.call("touch %s" % caselog, shell=True) """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" os.environ["PATH"] = d.getVar("PATH", True) @@ -78,7 +79,7 @@ def qemuimagetest_main(d): """run Test Case""" bb.note("Run %s test in scenario %s" % (case, scen)) - os.system("%s" % fulltestpath) + subprocess.call("%s" % fulltestpath, shell=True) """function to check testcase list and remove inappropriate cases""" def check_list(list): @@ -168,7 +169,7 @@ def qemuimagetest_main(d): test_status = d.getVar('TEST_STATUS', True) if os.path.exists(test_status): os.remove(test_status) - os.system("touch %s" % test_status) + subprocess.call("touch %s" % test_status, shell=True) """initialize result file""" resultpath = d.getVar('TEST_RESULT', True) @@ -180,7 +181,7 @@ def qemuimagetest_main(d): if os.path.exists(sresultfile): os.remove(sresultfile) - os.system("touch %s" % resultfile) + subprocess.call("touch %s" % resultfile, shell=True) os.symlink(resultfile, sresultfile) f = open(sresultfile, "a") f.write("\tTest Result for %s %s\n" % (machine, pname)) -- cgit 1.2.3-korg