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

File:
1 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: 
Note: See TracChangeset for help on using the changeset viewer.