Changeset 2028


Ignore:
Timestamp:
Jun 16, 2008 1:04:44 PM (16 years ago)
Author:
bennylp
Message:

More ticket #543: updated automated tests to run on Unix

Location:
pjproject/trunk/pjsip-apps/src/test-pjsua
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/test-pjsua/run.py

    r2025 r2028  
    1 # $Id:$ 
     1# $Id$ 
    22import sys 
    33import imp 
    44import re 
     5import os 
    56import subprocess 
     7import random 
    68import time 
    79 
    810import inc_const as const 
    911 
    10 # Defaults 
    11 G_EXE="..\\..\\bin\\pjsua_vc6d.exe" 
     12# Get the pjsua executable name 
     13if sys.platform.find("win32")!=-1: 
     14    e = "../../bin/pjsua_vc6d.exe" 
     15    st1 = os.stat(e) 
     16    if st1 != None: 
     17        G_EXE = e 
     18    e = "../../bin/pjsua_vc6d.exe" 
     19    st2 = os.stat(e) 
     20    if st2 != None and st2.st_mtime > st1.st_mtime: 
     21        G_EXE = e 
     22        st1 = st2 
     23    if G_EXE=="": 
     24        print "Unable to find valid pjsua. Please build pjsip first" 
     25        sys.exit(1) 
     26    G_INUNIX = False 
     27else: 
     28    f = open("../../../build.mak", "r") 
     29    while True: 
     30        line = f.readline() 
     31        if not line: 
     32            break 
     33        if line.find("TARGET_NAME")!=-1: 
     34            print line 
     35            G_EXE="../../bin/pjsua-" + line.split(":= ")[1] 
     36            break 
     37    if G_EXE=="": 
     38        print "Unable to find ../../../build.mak. Please build pjsip first" 
     39        sys.exit(1) 
     40    G_INUNIX = True 
     41 
     42 
     43G_EXE = G_EXE.rstrip("\n\r \t") 
    1244 
    1345################################### 
     
    3668                fullcmd = G_EXE + " " + inst_param.arg + " --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH 
    3769                self.trace("Popen " + fullcmd) 
    38                 self.proc = subprocess.Popen(fullcmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True) 
     70                self.proc = subprocess.Popen(fullcmd, shell=G_INUNIX, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True) 
    3971        def send(self, cmd): 
    4072                self.trace("send " + cmd) 
     
    109141script = imp.load_source("script", sys.argv[1])   
    110142 
     143# Init random seed 
     144random.seed() 
     145 
    111146# Validate 
    112147if script.test == None: 
     
    120155# Instantiate pjsuas 
    121156print "====== Running " + script.test.title + " ======" 
     157print "Using " + G_EXE + " as pjsua executable" 
     158 
    122159for inst_param in script.test.inst_params: 
    123160        try: 
  • pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py

    r2025 r2028  
    22import os 
    33import sys 
     4 
     5# Usage: 
     6#  runall.py [test-to-resume] 
     7 
    48 
    59# Initialize test list 
     
    2933    tests = [t for t in tests if t.find(pat)==-1] 
    3034 
     35# Resume test? 
     36resume_script="" 
     37if len(sys.argv) > 1: 
     38    if sys.argv[1][0]=='-' or sys.argv[1][0]=='/': 
     39        print "Usage:" 
     40        print "  runall.py [RESUME]" 
     41        print "where" 
     42        print "  RESUME is string/substring to specify where to resume tests." 
     43        print "  If this argument is omited, tests will start from the beginning." 
     44        sys.exit(0) 
     45    resume_script=sys.argv[1] 
     46 
     47 
    3148# Now run the tests 
    3249for t in tests: 
     50        if resume_script!="" and t.find(resume_script)==-1: 
     51            print "Skipping " + t +".." 
     52            continue 
     53        resume_script="" 
    3354        cmdline = "python run.py " + t 
    3455        print "Running " + cmdline 
  • pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-call/200_tcp.py

    r2025 r2028  
    77                "TCP transport", 
    88                [ 
    9                         InstanceParam("callee", "--null-audio --no-udp", uri_param=";transport=tcp --max-calls=1"), 
     9                        InstanceParam("callee", "--null-audio --no-udp --max-calls=1", uri_param=";transport=tcp"), 
    1010                        InstanceParam("caller", "--null-audio --no-udp --max-calls=1") 
    1111                ] 
  • pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres

    • Property svn:ignore set to
      *.pyc
  • pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pres/200_publish.py

    r2025 r2028  
    1 # $Id:$ 
     1# $Id$ 
    22# 
    33from inc_cfg import * 
     
    99                        InstanceParam(  "ua1",  
    1010                                        "--null-audio"+ 
    11                                                 " --id=<sip:test1@pjsip.org>"+ 
     11                                                " --id=\"<sip:test1@pjsip.org>\""+ 
    1212                                                " --registrar=sip:sip.pjsip.org" + 
    1313                                                " --username=test1" + 
    1414                                                " --password=test1" + 
    1515                                                " --realm=*" + 
    16                                                 " --proxy=sip:sip.pjsip.org;lr" + 
     16                                                " --proxy=\"sip:sip.pjsip.org;lr\"" + 
    1717                                                " --publish", 
    1818                                        uri="<sip:test1@pjsip.org>", 
     
    2121                        InstanceParam(  "ua2",  
    2222                                        "--null-audio"+ 
    23                                                 " --id=<sip:test2@pjsip.org>"+ 
     23                                                " --id=\"<sip:test2@pjsip.org>\""+ 
    2424                                                " --registrar=sip:sip.pjsip.org" + 
    2525                                                " --username=test2" + 
    2626                                                " --password=test2" + 
    2727                                                " --realm=*" + 
    28                                                 " --proxy=sip:sip.pjsip.org;lr" + 
     28                                                " --proxy=\"sip:sip.pjsip.org;lr\"" + 
    2929                                                " --publish", 
    3030                                        uri="<sip:test2@pjsip.org>", 
  • pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/100_simple.py

    r2025 r2028  
    1 # $Id:$ 
     1# $Id$ 
    22# 
    33# Just about the simple pjsua command line parameter, which should 
     
    88                "Basic run",  
    99                [ 
    10                         InstanceParam("pjsua", "--null-audio --local-port 0 --rtp-port 0") 
     10                        InstanceParam("pjsua", "--null-audio --rtp-port 0") 
    1111                ] 
    1212                ) 
  • pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-run/200_register.py

    r2025 r2028  
    1 # $Id:$ 
     1# $Id$ 
    22# 
    33from inc_cfg import * 
     
    99                        InstanceParam(  "client",  
    1010                                        "--null-audio"+ 
    11                                                 " --id=<sip:test1@pjsip.org>"+ 
     11                                                " --id=\"<sip:test1@pjsip.org>\""+ 
    1212                                                " --registrar=sip:sip.pjsip.org" + 
    1313                                                " --username=test1" + 
Note: See TracChangeset for help on using the changeset viewer.