Move get_platform_cmd_prefix into util.py (#4495)

get_platform_cmd_prefix implement multiple times in multiple function.
Also add function get_python_cmd_prefix, call to python script always
add python command so that on windows, the python script doesn't have
executable permission also can be called.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
Yonggang Luo
2021-02-04 20:23:57 +08:00
committed by GitHub
parent 9db4ec7d77
commit 4bb9e2b878
3 changed files with 24 additions and 18 deletions
+3 -9
View File
@@ -75,12 +75,6 @@ def get_tests(test_dir, test_list, skip_list):
return [test for test in tests if filter_tests(test)]
def get_platform_cmd_prefix():
if sys.platform == 'win32':
return ['cmd', '/S', '/C']
return []
def execute_test_command(test_cmd):
kwargs = {}
if sys.version_info.major >= 3:
@@ -126,7 +120,7 @@ def main(args):
def run_normal_tests(args, tests):
test_cmd = get_platform_cmd_prefix()
test_cmd = util.get_platform_cmd_prefix()
if args.runtime:
test_cmd.append(args.runtime)
test_cmd.extend([args.engine, '--call-on-exit', '__checkAsync'])
@@ -161,8 +155,8 @@ def run_normal_tests(args, tests):
def run_snapshot_tests(args, tests):
execute_snapshot_cmd = get_platform_cmd_prefix()
generate_snapshot_cmd = get_platform_cmd_prefix()
execute_snapshot_cmd = util.get_platform_cmd_prefix()
generate_snapshot_cmd = util.get_platform_cmd_prefix()
if args.runtime:
execute_snapshot_cmd.append(args.runtime)
generate_snapshot_cmd.append(args.runtime)