From 212dca784b98723807900d8a935a67e77d4458d4 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Tue, 26 Jun 2012 07:37:48 +0000 Subject: 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: http://svn.pjsip.org/repos/pjproject/trunk@4179 74dad513-b988-da41-8d7b-12977e46ad98 --- tests/pjsua/mod_sipp.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/pjsua/mod_sipp.py b/tests/pjsua/mod_sipp.py index a42767d3..bda52781 100644 --- a/tests/pjsua/mod_sipp.py +++ b/tests/pjsua/mod_sipp.py @@ -9,6 +9,13 @@ import subprocess 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_PARAM = "-i 127.0.0.1 -p 6000 -m 1 127.0.0.1" 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 @@ if ARGS[1].endswith('.xml'): 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 @@ def start_sipp(): 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(): -- cgit v1.2.3