- Timestamp:
- Jun 28, 2012 9:16:03 AM (12 years ago)
- Location:
- pjproject/trunk/tests/pjsua
- Files:
-
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/tests/pjsua/mod_sipp.py
r4179 r4183 17 17 G_INUNIX = True 18 18 19 # /dev/null handle, for redirecting output when SIPP is not in background mode 20 FDEVNULL = None 21 19 22 # SIPp executable path and param 20 23 #SIPP_PATH = '"C:\\Program Files (x86)\\Sipp_3.2\\sipp.exe"' … … 25 28 # On non-BG mode, on win, it needs env var: "TERMINFO=c:\cygwin\usr\share\terminfo" 26 29 # TODO: on unix with BG mode, waitpid() always fails, need to be fixed 27 #SIPP_BG_MODE = True28 SIPP_BG_MODE = not G_INUNIX30 SIPP_BG_MODE = False 31 #SIPP_BG_MODE = not G_INUNIX 29 32 30 33 # Will be updated based on configuration file (a .py file whose the same name as SIPp XML file) … … 80 83 sipp_proc = subprocess.Popen(fullcmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=G_INUNIX, universal_newlines=False) 81 84 else: 82 sipp_proc = subprocess.Popen(fullcmd, shell=G_INUNIX) 85 # redirect output to NULL 86 global FDEVNULL 87 FDEVNULL = open(os.devnull, 'w') 88 sipp_proc = subprocess.Popen(fullcmd, shell=G_INUNIX, stdout=FDEVNULL, stderr=FDEVNULL) 83 89 84 90 if not SIPP_BG_MODE: … … 115 121 def wait_sipp(sipp): 116 122 if not SIPP_BG_MODE: 123 global FDEVNULL 117 124 sipp.wait() 125 FDEVNULL.close() 118 126 return sipp.returncode 119 127 … … 176 184 # Ideally the poll should be done contiunously until SIPp process is 177 185 # terminated. 178 ua[0].expect(inc_const.STDOUT_REFRESH, raise_on_error = False) 186 for ua_idx in range(len(ua)): 187 ua[ua_idx].expect(inc_const.STDOUT_REFRESH, raise_on_error = False) 179 188 180 189 return ua_err_st 190 191 192 def sipp_err_to_str(err_code): 193 if err_code == 0: 194 return "All calls were successful" 195 elif err_code == 1: 196 return "At least one call failed" 197 elif err_code == 97: 198 return "exit on internal command. Calls may have been processed" 199 elif err_code == 99: 200 return "Normal exit without calls processed" 201 elif err_code == -1: 202 return "Fatal error (timeout)" 203 elif err_code == -2: 204 return "Fatal error binding a socket" 205 else: 206 return "Unknown error" 181 207 182 208 … … 199 225 200 226 if sipp_ret_code: 201 raise TestError("SIPp returned error " + str(sipp_ret_code)) 227 rc = ctypes.c_byte(sipp_ret_code).value 228 raise TestError("SIPp returned error " + str(rc) + ": " + sipp_err_to_str(rc)) 202 229 203 230 -
pjproject/trunk/tests/pjsua/run.py
r3475 r4183 144 144 # Print the line if echo is ON 145 145 if self.echo: 146 print self.name + ": " + line ,146 print self.name + ": " + line.rstrip() 147 147 # Trap assertion error 148 148 if self.ra.search(line) != None: -
pjproject/trunk/tests/pjsua/runall.py
r4177 r4183 94 94 resume_script=sys.argv[1] 95 95 sys.argv.pop(0) 96 sys.argv.pop( 1)96 sys.argv.pop(0) 97 97 else: 98 98 sys.argv.pop(0) … … 120 120 shell_cmd = sys.argv[1] 121 121 sys.argv.pop(0) 122 sys.argv.pop( 1)122 sys.argv.pop(0) 123 123 else: 124 124 sys.argv.pop(0) 125 125 sys.stderr.write("Error: argument value required") 126 126 sys.exit(1) 127 else: 128 # should be run.py options 129 break 127 130 128 131 129 132 # Generate arguments for run.py 130 argv_st = " ".join(sys.argv) 133 argv_st = " ".join(sys.argv) + " " 131 134 132 135 # Init vars -
pjproject/trunk/tests/pjsua/scripts-sipp/transfer-attended.py
r4178 r4183 12 12 [0, "", "m"], 13 13 [0, "", "sip:localhost:5062"], 14 [0, const.STATE_CALLING, ""], 14 15 [1, const.EVENT_INCOMING_CALL, "a"], 15 16 [1, "", "200"], … … 25 26 [1, "", "m"], 26 27 [1, "", "sip:localhost:5064"], 28 [1, const.STATE_CALLING, ""], 27 29 [2, const.EVENT_INCOMING_CALL, "a"], 28 30 [2, "", "200"], … … 47 49 [0, const.MEDIA_ACTIVE, ""], 48 50 [2, const.MEDIA_ACTIVE, ""], 49 [1, "", " "], 50 [1, "have 0 active call", ""], 51 [1, const.STATE_DISCONNECTED, ""] 51 52 ] -
pjproject/trunk/tests/pjsua/scripts-sipp/transfer-unattended.py
r4178 r4183 12 12 [0, "", "m"], 13 13 [0, "", "sip:localhost:5062"], 14 [0, const.STATE_CALLING, ""], 14 15 [1, const.EVENT_INCOMING_CALL, "a"], 15 16 [1, "", "200"], … … 26 27 [2, const.MEDIA_ACTIVE, ""], 27 28 [1, "call transfered successfully", ""], 28 [1, "", " "], 29 [1, "have 0 active call", ""], 29 [1, const.STATE_DISCONNECTED, ""] 30 30 ] -
pjproject/trunk/tests/pjsua/scripts-sipp/uas-forked-100rel.xml
r3841 r4183 23 23 <recv request="INVITE" crlf="true"> 24 24 <action> 25 <ereg regexp="branch=([ 0-9a-zA-Z\-]*)"25 <ereg regexp="branch=([^;]*)" 26 26 search_in="hdr" 27 27 header="Via" 28 28 assign_to="1,2"/> 29 29 <assign assign_to="1" variable="2"/> -
pjproject/trunk/tests/pjsua/scripts-sipp/uas-forked-200.xml
r4177 r4183 23 23 <recv request="INVITE" crlf="true"> 24 24 <action> 25 <ereg regexp="branch=([ 0-9a-zA-Z]*)"25 <ereg regexp="branch=([^;]*)" 26 26 search_in="hdr" 27 27 header="Via" 28 28 assign_to="1,2"/> 29 29 <assign assign_to="1" variable="2"/> -
pjproject/trunk/tests/pjsua/scripts-sipp/uas-prack_fork.xml
r4177 r4183 23 23 <recv request="INVITE" crlf="true"> 24 24 <action> 25 <ereg regexp="branch=([0-9a-zA-Z]*)" 26 search_in="msg" 25 <ereg regexp="branch=([^;]*)" 26 search_in="hdr" 27 header="Via" 27 28 assign_to="3"/> 28 29 <ereg regexp="CSeq: ([0-9a-zA-Z ]*)"
Note: See TracChangeset
for help on using the changeset viewer.