From 50db4c1b86fe10c0e6c175b98cd08ea654acdfcd Mon Sep 17 00:00:00 2001 From: Thomas Aubry Date: Mon, 29 Oct 2018 10:06:48 +0100 Subject: [PATCH] spns #8471 : add Windows case to launch tests with the command 'sat test' --- src/fork.py | 17 ++++++++++++++++- src/test_module.py | 14 +++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/fork.py b/src/fork.py index 5a6582a..6684fda 100644 --- a/src/fork.py +++ b/src/fork.py @@ -22,6 +22,9 @@ import time import pickle import subprocess +# OP +import src + def show_progress(logger, top, delai, ss=""): """shortcut function to display the progression @@ -51,12 +54,24 @@ def launch_command(cmd, logger, cwd, args=[], log=None): logger.write("launch: %s\n" % cmd, 5, screenOnly=True) for arg in args: cmd += " " + arg - prs = subprocess.Popen(cmd, + + # OP Add Windows case + if src.architecture.is_windows(): + prs = subprocess.Popen(cmd, + shell=True, + stdout=log, + stderr=subprocess.STDOUT, + cwd=cwd) + pass + else: + prs = subprocess.Popen(cmd, shell=True, stdout=log, stderr=subprocess.STDOUT, cwd=cwd, executable='/bin/bash') + pass + # END OP return prs # Launch a batch diff --git a/src/test_module.py b/src/test_module.py index 30336ce..765b1e3 100644 --- a/src/test_module.py +++ b/src/test_module.py @@ -445,13 +445,21 @@ class Test: # stdout=subprocess.PIPE, # shell=True, # executable='/bin/bash').communicate()[0].split()[-1] - subproc_res = subprocess.Popen(cmd, + # OP Add Windows case + if src.architecture.is_windows(): + subproc_res = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + shell=True).communicate() + pass + else: + subproc_res = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, executable='/bin/bash').communicate() + pass #print "TRACES OP - test_module.py/Test.get_tmp_dir() subproc_res = " - for resLine in subproc_res: - print "- '#%s#'" %resLine + #for resLine in subproc_res: + # print "- '#%s#'" %resLine root_dir = subproc_res[0].split()[-1] -- 2.39.2