summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-06-27 23:53:00 +0000
committerBenny Prijono <bennylp@teluu.com>2008-06-27 23:53:00 +0000
commit4ae5b9c8a79c82df96aecf64335177c3a998a808 (patch)
tree97bd61f704502bea8b8b6c61c96a3857608b14f7
parentc7f15ce24cf07f84f4d20881741aec68b0d66f00 (diff)
Added stdout buffering option in Python tests
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2084 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/test-pjsua/inc_cfg.py9
-rw-r--r--pjsip-apps/src/test-pjsua/inc_sip.py4
-rw-r--r--pjsip-apps/src/test-pjsua/run.py4
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py4
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/200_ice_success_2.py5
5 files changed, 18 insertions, 8 deletions
diff --git a/pjsip-apps/src/test-pjsua/inc_cfg.py b/pjsip-apps/src/test-pjsua/inc_cfg.py
index 3c601079..b05fe02f 100644
--- a/pjsip-apps/src/test-pjsua/inc_cfg.py
+++ b/pjsip-apps/src/test-pjsua/inc_cfg.py
@@ -28,6 +28,8 @@ class InstanceParam:
have_reg = False
# Does this have PUBLISH?
have_publish = False
+ # Enable stdout buffer?
+ enable_buffer = False
def __init__( self,
name, # Instance name
arg, # Cmd-line arguments
@@ -37,7 +39,8 @@ class InstanceParam:
have_reg=False, # Have registration?
have_publish=False, # Have publish?
echo_enabled=DEFAULT_ECHO,
- trace_enabled=DEFAULT_TRACE):
+ trace_enabled=DEFAULT_TRACE,
+ enable_buffer = False):
# Instance name
self.name = name
# Give random sip_port if it's not specified
@@ -62,6 +65,7 @@ class InstanceParam:
self.arg = self.arg + " --publish"
self.echo_enabled = echo_enabled
self.trace_enabled = trace_enabled
+ self.enable_buffer = enable_buffer
############################################
@@ -83,7 +87,8 @@ class TestParam:
inst_params, # InstanceParam's as list
func=None,
skip=False,
- post_func=None):
+ post_func=None,
+ need_stdout_buffer=False):
self.title = title
self.inst_params = inst_params
self.skip = skip
diff --git a/pjsip-apps/src/test-pjsua/inc_sip.py b/pjsip-apps/src/test-pjsua/inc_sip.py
index 122eeae0..c8dadc69 100644
--- a/pjsip-apps/src/test-pjsua/inc_sip.py
+++ b/pjsip-apps/src/test-pjsua/inc_sip.py
@@ -224,7 +224,8 @@ class SendtoCfg:
# Constructor
def __init__(self, name, pjsua_args, sdp, resp_code,
resp_inc=[], resp_exc=[], use_tcp=False,
- extra_headers="", complete_msg=""):
+ extra_headers="", complete_msg="",
+ enable_buffer = False):
self.complete_msg = complete_msg
self.sdp = sdp
self.resp_code = resp_code
@@ -233,4 +234,5 @@ class SendtoCfg:
self.use_tcp = use_tcp
self.extra_headers = extra_headers
self.inst_param = cfg.InstanceParam("pjsua", pjsua_args)
+ self.inst_param.enable_buffer = enable_buffer
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index 7b2d3a9f..58a45a85 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -108,7 +108,9 @@ class Expect:
self.name = inst_param.name
self.echo = inst_param.echo_enabled
self.trace_enabled = inst_param.trace_enabled
- fullcmd = G_EXE + " " + inst_param.arg + " --stdout-no-buf --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH
+ fullcmd = G_EXE + " " + inst_param.arg + " --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH
+ if not inst_param.enable_buffer:
+ fullcmd = fullcmd + " --stdout-no-buf"
self.trace("Popen " + fullcmd)
self.proc = subprocess.Popen(fullcmd, shell=G_INUNIX, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=False)
def send(self, cmd):
diff --git a/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py b/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py
index 0bf8cc15..456aa46b 100644
--- a/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py
+++ b/pjsip-apps/src/test-pjsua/scripts-call/300_ice_1_1.py
@@ -6,7 +6,7 @@ from inc_cfg import *
test_param = TestParam(
"Callee=use ICE, caller=use ICE",
[
- InstanceParam("callee", "--null-audio --use-ice --max-calls=1"),
- InstanceParam("caller", "--null-audio --use-ice --max-calls=1")
+ InstanceParam("callee", "--null-audio --use-ice --max-calls=1", enable_buffer=True),
+ InstanceParam("caller", "--null-audio --use-ice --max-calls=1", enable_buffer=True)
]
)
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/200_ice_success_2.py b/pjsip-apps/src/test-pjsua/scripts-sendto/200_ice_success_2.py
index 3f41ebd9..caf64b91 100644
--- a/pjsip-apps/src/test-pjsua/scripts-sendto/200_ice_success_2.py
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/200_ice_success_2.py
@@ -1,4 +1,4 @@
-# $Id:$
+# $Id$
import inc_sip as sip
import inc_sdp as sdp
@@ -31,5 +31,6 @@ exclude = [
sendto_cfg = sip.SendtoCfg( "caller sends only one component",
pjsua_args=args, sdp=sdp, resp_code=200,
- resp_inc=include, resp_exc=exclude)
+ resp_inc=include, resp_exc=exclude,
+ enable_buffer = True)