More ticket #543: added SRTP tests on scripts-sendto

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2036 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index 74c028a..9026f4f 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -109,14 +109,15 @@
 
 #########################
 # Error handling
-def handle_error(errmsg, t):
+def handle_error(errmsg, t, close_processes = True):
 	print "====== Caught error: " + errmsg + " ======"
-	time.sleep(1)
-	for p in t.process:
-		p.send("q")
-		p.send("q")
-		p.expect(const.DESTROYED, False)
-		p.wait()
+	if (close_processes):
+		time.sleep(1)
+		for p in t.process:
+			p.send("q")
+			p.send("q")
+			p.expect(const.DESTROYED, False)
+			p.wait()
 	print "Test completed with error: " + errmsg
 	sys.exit(1)
 
@@ -195,7 +196,7 @@
 	try:
 		script.test.post_func(script.test, script.test.user_data)
 	except TestError, e:
-		handle_error(e.desc, script.test)
+		handle_error(e.desc, script.test, False)
 
 # Done
 print "Test " + script.test.title + " completed successfully"