summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/test-pjsua
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-06-26 22:20:11 +0000
committerBenny Prijono <bennylp@teluu.com>2008-06-26 22:20:11 +0000
commit3295efbbcce1ce10d02824e2b1dad5d688f2ea54 (patch)
treee13219a06d57b8b169d9fd553a0f334fa038fd13 /pjsip-apps/src/test-pjsua
parentaac5231515ffded8354292ba0940ca02fa03ff5d (diff)
echo command in pjsua can be used to print any text, and this is used to better synchronize stdout in Python test apps
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2069 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/test-pjsua')
-rw-r--r--pjsip-apps/src/test-pjsua/run.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index e525bac9..c1947efa 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -54,6 +54,7 @@ class Expect:
rh = re.compile(const.DESTROYED)
ra = re.compile(const.ASSERT, re.I)
rr = re.compile(const.STDOUT_REFRESH)
+ t0 = time.time()
def __init__(self, inst_param):
self.inst_param = inst_param
self.name = inst_param.name
@@ -98,15 +99,18 @@ class Expect:
def sync_stdout(self):
self.trace("sync_stdout")
- self.send("echo 1")
- self.expect("echo 1")
+ cmd = "echo 1" + str(random.randint(1000,9999))
+ self.send(cmd)
+ self.expect(cmd)
def wait(self):
self.trace("wait")
self.proc.wait()
def trace(self, s):
if self.trace_enabled:
- print self.name + ": " + "====== " + s + " ======"
+ now = time.time()
+ fmt = self.name + ": " + "================== " + s + " ==================" + " [at t=%(time)03d]"
+ print fmt % {'time':int(now - self.t0)}
#########################
# Error handling