Re #1523: fixed mod_sipp.py problems in executing sipp on unix/mac platforms, i.e: should run on shell and non-background mode.



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@4179 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/tests/pjsua/mod_sipp.py b/tests/pjsua/mod_sipp.py
index a42767d..bda5278 100644
--- a/tests/pjsua/mod_sipp.py
+++ b/tests/pjsua/mod_sipp.py
@@ -9,6 +9,13 @@
 from inc_cfg import *
 import inc_const
 
+# flags that test is running in Unix
+G_INUNIX = False
+if sys.platform.lower().find("win32")!=-1 or sys.platform.lower().find("microsoft")!=-1:
+    G_INUNIX = False
+else:
+    G_INUNIX = True
+
 # SIPp executable path and param
 #SIPP_PATH = '"C:\\Program Files (x86)\\Sipp_3.2\\sipp.exe"'
 SIPP_PATH = 'sipp'
@@ -16,7 +23,9 @@
 SIPP_TIMEOUT = 60
 # On BG mode, SIPp doesn't require special terminal
 # On non-BG mode, on win, it needs env var: "TERMINFO=c:\cygwin\usr\share\terminfo"
-SIPP_BG_MODE = True
+# TODO: on unix with BG mode, waitpid() always fails, need to be fixed
+#SIPP_BG_MODE = True
+SIPP_BG_MODE = not G_INUNIX
 
 # Will be updated based on configuration file (a .py file whose the same name as SIPp XML file)
 PJSUA_INST_PARAM = []
@@ -34,6 +43,7 @@
 else:
     exit(-99)
 
+
 # Init PJSUA test instance
 if os.access(SIPP_SCEN_XML[:-4]+".py", os.R_OK):
     # Load from configuration file (the corresponding .py file), if any
@@ -67,9 +77,9 @@
     fullcmd = os.path.normpath(SIPP_PATH) + " " + sipp_param
     print "Running SIPP: " + fullcmd
     if SIPP_BG_MODE:
-	sipp_proc = subprocess.Popen(fullcmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=False)
+	sipp_proc = subprocess.Popen(fullcmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=G_INUNIX, universal_newlines=False)
     else:
-	sipp_proc = subprocess.Popen(fullcmd)
+	sipp_proc = subprocess.Popen(fullcmd, shell=G_INUNIX)
 
     if not SIPP_BG_MODE:
 	if sipp_proc == None or sipp_proc.poll():