summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-06-12 19:13:51 +0000
committerBenny Prijono <bennylp@teluu.com>2008-06-12 19:13:51 +0000
commit71b3b5351bba81bac0d664c27a9eeec5fd97ed08 (patch)
treeef02fc74c6a63f5ba2deb3ec8e18046e77cca871
parent1f539f89c3358b65779097192c62b2fb978f08fb (diff)
Ticket #543: added TCP call in pjsua unit test
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2013 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/test-pjsua/inc_cfg.py2
-rw-r--r--pjsip-apps/src/test-pjsua/inc_param.py2
-rw-r--r--pjsip-apps/src/test-pjsua/mod_call.py2
-rw-r--r--pjsip-apps/src/test-pjsua/run.py14
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py11
5 files changed, 24 insertions, 7 deletions
diff --git a/pjsip-apps/src/test-pjsua/inc_cfg.py b/pjsip-apps/src/test-pjsua/inc_cfg.py
index cf5f6117..a800fe5e 100644
--- a/pjsip-apps/src/test-pjsua/inc_cfg.py
+++ b/pjsip-apps/src/test-pjsua/inc_cfg.py
@@ -18,6 +18,8 @@ class Config:
# Call config class
class CallConfig:
+ # additional parameter to be added to target URI
+ uri_param = ""
def __init__(self, title, callee_cfg, caller_cfg):
self.title = title
self.callee_cfg = callee_cfg
diff --git a/pjsip-apps/src/test-pjsua/inc_param.py b/pjsip-apps/src/test-pjsua/inc_param.py
index e897d140..7fa23714 100644
--- a/pjsip-apps/src/test-pjsua/inc_param.py
+++ b/pjsip-apps/src/test-pjsua/inc_param.py
@@ -31,7 +31,7 @@ class Pjsua:
# Test parameter class
class Test:
title = ""
- # params is list containing PjsuaParam objects
+ # params is list containing Pjsua objects
run = []
# list of Expect instances, to be filled at run-time by
# the test program
diff --git a/pjsip-apps/src/test-pjsua/mod_call.py b/pjsip-apps/src/test-pjsua/mod_call.py
index b047f071..07f5a0e7 100644
--- a/pjsip-apps/src/test-pjsua/mod_call.py
+++ b/pjsip-apps/src/test-pjsua/mod_call.py
@@ -35,7 +35,7 @@ def test_func(t):
# Caller making call
caller.send("m")
- caller.send("sip:localhost:" + port1)
+ caller.send("sip:localhost:" + port1 + cfg_file.config.uri_param)
caller.expect(const.STATE_CALLING)
# Callee answers with 200/OK
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index 16d23ca2..4a7c0d34 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -47,20 +47,23 @@ class Expect:
while True:
line = self.proc.stdout.readline()
if line == "":
- raise TestError("Premature EOF")
+ raise TestError(self.name + ": Premature EOF")
# Print the line if echo is ON
if self.echo:
print self.name + ": " + line,
# Trap assertion error
if self.ra.search(line) != None:
- raise TestError(line)
+ if raise_on_error:
+ raise TestError(self.name + ": " + line)
+ else:
+ return None
# Count stdout refresh text.
if self.rr.search(line) != None:
refresh_cnt = refresh_cnt+1
if refresh_cnt >= 6:
self.trace("Timed-out!")
if raise_on_error:
- raise TestError("Timeout expecting pattern: " + pattern)
+ raise TestError(self.name + ": Timeout expecting pattern: " + pattern)
else:
return None # timeout
# Search for expected text
@@ -80,7 +83,7 @@ def handle_error(errmsg, t):
time.sleep(1)
for p in t.process:
p.send("q")
- p.expect(const.DESTROYED)
+ p.expect(const.DESTROYED, False)
p.wait()
print "Test completed with error: " + errmsg
sys.exit(1)
@@ -117,6 +120,7 @@ for run in script.test.run:
p.expect(const.PROMPT)
p.send("echo 1")
p.send("echo 1")
+ p.expect("echo 1")
# add running instance
script.test.process.append(p)
# run initial script
@@ -143,7 +147,7 @@ time.sleep(2)
for p in script.test.process:
p.send("q")
time.sleep(0.5)
- p.expect(const.DESTROYED)
+ p.expect(const.DESTROYED, False)
p.wait()
# Done
diff --git a/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py b/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py
new file mode 100644
index 00000000..62bdee1b
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py
@@ -0,0 +1,11 @@
+# $Id:$
+#
+import inc_cfg
+
+# Simple call
+config = inc_cfg.CallConfig(
+ title = "TCP transport",
+ callee_cfg = inc_cfg.Config(arg="--null-audio --no-udp"),
+ caller_cfg = inc_cfg.Config(arg="--null-audio --no-udp")
+ )
+config.uri_param = ";transport=tcp"