Added stdout buffering option in Python tests

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2084 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/test-pjsua/inc_cfg.py b/pjsip-apps/src/test-pjsua/inc_cfg.py
index 3c60107..b05fe02 100644
--- a/pjsip-apps/src/test-pjsua/inc_cfg.py
+++ b/pjsip-apps/src/test-pjsua/inc_cfg.py
@@ -28,6 +28,8 @@
 	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 @@
 			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 @@
 			self.arg = self.arg + " --publish"
 		self.echo_enabled = echo_enabled
 		self.trace_enabled = trace_enabled
+		self.enable_buffer = enable_buffer
 
 
 ############################################
@@ -83,7 +87,8 @@
 			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 122eeae..c8dadc6 100644
--- a/pjsip-apps/src/test-pjsua/inc_sip.py
+++ b/pjsip-apps/src/test-pjsua/inc_sip.py
@@ -224,7 +224,8 @@
 	# 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 @@
 		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 7b2d3a9..58a45a8 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -108,7 +108,9 @@
 		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 0bf8cc1..456aa46 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 @@
 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 3f41ebd..caf64b9 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 @@
 
 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)