summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-06-26 07:37:48 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-06-26 07:37:48 +0000
commit212dca784b98723807900d8a935a67e77d4458d4 (patch)
tree456c54ce44da06a1d71d0930c05af87c46f6af1a /tests
parent959ba9df8ca588924ad8c6485607e3c6614e77c3 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/pjsua/mod_sipp.py16
1 files changed, 13 insertions, 3 deletions
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():