Compare commits

...

7 Commits

Author SHA1 Message Date
Riza Sulistyo 198ceebd64 Fix some error
- On windows, error EACCESS when binding/opening socket
- Fix UnicodeEncodeError/UnicodeDecodeError
2023-07-05 09:09:41 +07:00
Riza Sulistyo ed83e140aa Replace imp to importlib to fix warning 2023-06-30 18:36:51 +07:00
Riza Sulistyo 59249c9ec4 Fix error 2023-06-28 21:40:29 +07:00
Riza Sulistyo 86f4d2e4c5 Fix runtime error 2023-06-28 20:32:20 +07:00
Riza Sulistyo 65ade5b397 Fix runtime error due to changes in socket lib 2023-06-28 17:31:24 +07:00
Riza Sulistyo 2be541b0a7 Fix runtime error due to changes in telnetlib for python3
This will also remove support for python2
2023-06-28 16:20:43 +07:00
Riza Sulistyo 332156c797 Support Python3 for github CI 2023-06-27 11:56:52 +07:00
16 changed files with 147 additions and 124 deletions

View File

@ -32,10 +32,10 @@ jobs:
run: make
- name: swig bindings
run: cd pjsip-apps/src/swig && make
- name: set up Python 2.7 for pjsua test
- name: set up Python 3.10 for pjsua test
uses: actions/setup-python@v2
with:
python-version: 2.7
python-version: '3.10'
- name: unit tests
run: make pjlib-test-ci pjlib-util-test pjmedia-test pjsua-test
@ -122,10 +122,10 @@ jobs:
run: make
- name: swig bindings
run: cd pjsip-apps/src/swig && make
- name: set up Python 2.7 for pjsua test
uses: actions/setup-python@v2
- name: set up Python 3.10 for pjsua test
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: unit tests
run: make pjlib-test-ci pjlib-util-test pjmedia-test pjsua-test

View File

@ -34,10 +34,10 @@ jobs:
run: cd pjsip-apps/src/swig && make
- name: disable firewall
run: sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
- name: set up Python 2.7 for pjsua test
uses: actions/setup-python@v2
- name: set up Python 3.10 for pjsua test
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: unit tests
run: make pjlib-test-ci pjmedia-test pjlib-util-test pjsua-test
@ -126,10 +126,10 @@ jobs:
run: cd pjsip-apps/src/swig && make
- name: disable firewall
run: sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
- name: set up Python 2.7 for pjsua test
- name: set up Python 3.10 for pjsua test
uses: actions/setup-python@v2
with:
python-version: 2.7
python-version: '3.10'
- name: unit tests
run: make pjlib-test-ci pjmedia-test pjlib-util-test pjsua-test

View File

@ -128,10 +128,10 @@ jobs:
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild cmp_wav.vcxproj /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
- name: set up Python 2.7 for pjsua test
uses: actions/setup-python@v2
- name: set up Python 3.10 for pjsua test
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: unit tests
run: |
$env:OPENSSL_DIR = Get-Content .\openssl_dir.txt
@ -262,10 +262,10 @@ jobs:
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild cmp_wav.vcxproj /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
- name: set up Python 2.7 for pjsua test
uses: actions/setup-python@v2
- name: set up Python 3.10 for pjsua test
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: unit tests
run: |
$env:OPENSSL_DIR = Get-Content .\openssl_dir.txt
@ -332,4 +332,4 @@ jobs:
set INCLUDE=%INCLUDE%;%LIBFFMPEG_DIR%\include;%SDL_DIR%\include
set LIB=%LIB%;%FFMPEG_DIR%\lib;%SDL_DIR%\lib\x86
msbuild pjproject-vs14.sln /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
shell: cmd

View File

@ -67,7 +67,7 @@ class InstanceParam:
s.bind(("0.0.0.0", port))
except socket.error as serr:
s.close()
if serr.errno == errno.EADDRINUSE:
if serr.errno == errno.EADDRINUSE or serr.errno == errno.EACCES:
continue
s.close()
break;
@ -89,7 +89,7 @@ class InstanceParam:
s.bind(("0.0.0.0", port))
except socket.error as serr:
s.close()
if serr.errno == errno.EADDRINUSE:
if serr.errno == errno.EADDRINUSE or serr.errno == errno.EACCES:
continue
s.close()
break;
@ -148,7 +148,7 @@ class TestParam:
###################################
# TestError exception
class TestError:
class TestError(Exception):
desc = ""
def __init__(self, desc):
self.desc = desc

View File

@ -88,7 +88,10 @@ class Dialog:
def trace(self, txt):
if self.trace_enabled:
print str(time.strftime("%H:%M:%S ")) + txt
try:
print(str(time.strftime("%H:%M:%S ")) + txt)
except UnicodeEncodeError:
print((str(time.strftime("%H:%M:%S ")) + txt).encode('utf-8'))
def update_fields(self, msg):
if self.tcp:
@ -157,7 +160,7 @@ class Dialog:
if not dst_addr:
dst_addr = (self.dst_addr, self.dst_port)
self.trace("============== TX MSG to " + str(dst_addr) + " ============= \n" + msg)
self.sock.sendto(msg, 0, dst_addr)
self.sock.sendto(msg.encode('utf-8'), 0, dst_addr)
def wait_msg_from(self, timeout):
endtime = time.time() + timeout
@ -167,29 +170,30 @@ class Dialog:
readset = select([self.sock], [], [], 1)
if len(readset[0]) < 1 or not self.sock in readset[0]:
if len(readset[0]) < 1:
print "select() timeout (will wait for " + str(int(endtime - time.time())) + "more secs)"
print("select() timeout (will wait for " + str(int(endtime - time.time())) + "more secs)")
elif not self.sock in readset[0]:
print "select() alien socket"
print("select() alien socket")
else:
print "select other error"
print("select other error")
continue
try:
msg, src_addr = self.sock.recvfrom(4096)
break
except:
print "recv() exception: ", sys.exc_info()[0]
print("recv() exception: ", sys.exc_info()[0])
continue
if msg=="":
msgstr = msg.decode('utf-8')
if msgstr=="":
return "", None
if self.last_request=="INVITE" and self.rem_tag=="":
self.rem_tag = get_tag(msg, "To")
self.rem_tag = get_tag(msgstr, "To")
self.rem_tag = self.rem_tag.rstrip("\r\n;")
if self.rem_tag != "":
self.rem_tag = ";tag=" + self.rem_tag
self.trace("=== rem_tag:" + self.rem_tag)
self.trace("=========== RX MSG from " + str(src_addr) + " ===========\n" + msg)
return (msg, src_addr)
self.trace("=========== RX MSG from " + str(src_addr) + " ===========\n" + msgstr)
return (msgstr, src_addr)
def wait_msg(self, timeout):
return self.wait_msg_from(timeout)[0]
@ -263,7 +267,7 @@ class SendtoCfg:
resp_inc=[], resp_exc=[], use_tcp=False,
extra_headers="", body="", complete_msg="",
enable_buffer = False):
self.complete_msg = complete_msg
self.complete_msg = complete_msg
self.sdp = sdp
self.resp_code = resp_code
self.resp_include = resp_inc

13
tests/pjsua/inc_util.py Normal file
View File

@ -0,0 +1,13 @@
import sys
def load_module_from_file(module_name, module_path):
if sys.version_info[0] == 3 and sys.version_info[1] >= 5:
import importlib.util
spec = importlib.util.spec_from_file_location(module_name, module_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
elif sys.version_info[0] == 3 and sys.version_info[1] < 5:
import importlib.machinery
loader = importlib.machinery.SourceFileLoader(module_name, module_path)
module = loader.load_module()
return module

View File

@ -1,11 +1,11 @@
import time
import imp
import sys
import inc_const as const
import inc_util as util
from inc_cfg import *
# Load configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# Trigger address switch for media flow between ua1 and ua2.
# When the receiver uses STUN while both sides are actually in the same

View File

@ -8,15 +8,15 @@
# wav input must be more than 3 seconds long
import time
import imp
import sys
import re
import subprocess
import inc_const as const
import inc_util as util
from inc_cfg import *
# Load configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# WAV similarity calculator
COMPARE_WAV_EXE = ""
@ -95,7 +95,7 @@ def post_func(t):
# Evaluate the similarity value
sim_val = mo_sim_val.group(1)
if (sim_val >= COMPARE_THRESHOLD):
if (int(sim_val) >= COMPARE_THRESHOLD):
endpt.trace("WAV similarity = " + sim_val)
else:
raise TestError("WAV degraded heavily, similarity = " + sim_val)

View File

@ -10,7 +10,6 @@
# - clock-rate of those files can only be 8khz or 16khz
import time
import imp
import os
import sys
import re
@ -18,11 +17,12 @@ import subprocess
import wave
import shutil
import inc_const as const
import inc_util as util
from inc_cfg import *
# Load configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# PESQ configs
PESQ = "tools/pesq" # PESQ executable path
@ -56,7 +56,7 @@ def test_func(t):
inwavlen = fin.getnframes() * 1.0 / fin.getframerate()
inwavlen += 0.2
fin.close()
print "WAV input len = " + str(inwavlen) + "s"
print("WAV input len = " + str(inwavlen) + "s")
# Get clock rate of the output
mo_clock_rate = re.compile("\.(\d+)\.wav").search(output_filename)
@ -159,9 +159,9 @@ def post_func(t):
wavoutname = "logs/" + wavoutname
try:
shutil.copyfile(output_filename, wavoutname)
print "Output WAV is copied to " + wavoutname
print("Output WAV is copied to " + wavoutname)
except:
print "Couldn't copy output WAV, please check if 'logs' directory exists."
print("Couldn't copy output WAV, please check if 'logs' directory exists.")
raise TestError("WAV seems to be degraded badly, PESQ = "+ pesq_res + " (target=" + str(threshold) + ").")

View File

@ -1,11 +1,11 @@
import time
import imp
import sys
import inc_const as const
import inc_util as util
from inc_cfg import *
# Load configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# Test body function

View File

@ -1,12 +1,12 @@
import imp
import sys
import inc_sip as sip
import inc_const as const
import inc_util as util
import re
from inc_cfg import *
# Read configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# Default server port (should we randomize?)
srv_port = 50070
@ -18,7 +18,7 @@ def test_func(test):
tcp=cfg_file.recvfrom_cfg.tcp)
config = pjsua.get_config(cfg_file.recvfrom_cfg.pj_config)
print "Config : " + config
print("Config : " + config)
last_cseq = 0
last_method = ""
@ -28,7 +28,7 @@ def test_func(test):
if t.pj_config != "":
r = re.compile(t.pj_config, re.I)
if r.search(config) == None:
print "Configuration : " + t.pj_config + " not found, skipping"
print("Configuration : " + t.pj_config + " not found, skipping")
continue
# Print transaction title

View File

@ -1,10 +1,10 @@
import imp
import sys
import inc_util as util
from inc_cfg import *
# Read configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# Here where it all comes together
test = cfg_file.test_param

View File

@ -1,12 +1,12 @@
import imp
import sys
import inc_sip as sip
import inc_const as const
import inc_util as util
import re
from inc_cfg import *
# Read configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
cfg_file = util.load_module_from_file("cfg_file", ARGS[1])
# Test body function
def test_func(t):

View File

@ -17,16 +17,15 @@
## - $SIPP_URI : SIPp SIP URI
## - $PJSUA_PORT[N] : binding port of PJSUA instance #N
## - $PJSUA_URI[N] : SIP URI of PJSUA instance #N
import ctypes
import time
import imp
import sys
import os
import re
import subprocess
from inc_cfg import *
import inc_const
import inc_util as util
# flags that test is running in Unix
G_INUNIX = False
@ -85,7 +84,7 @@ def resolve_driver_macros(st):
# Init test driver
if os.access(SIPP_SCEN_XML[:-4]+".py", os.R_OK):
# Load test driver file (the corresponding .py file), if any
cfg_file = imp.load_source("cfg_file", SIPP_SCEN_XML[:-4]+".py")
cfg_file = util.load_module_from_file("cfg_file", SIPP_SCEN_XML[:-4]+".py")
for ua_idx, ua_param in enumerate(cfg_file.PJSUA):
ua_param = resolve_driver_macros(ua_param)
PJSUA_INST_PARAM.append(InstanceParam("pjsua"+str(ua_idx), ua_param))
@ -120,7 +119,7 @@ def start_sipp():
# run SIPp
fullcmd = os.path.normpath(SIPP_PATH) + " " + sipp_param
print "Running SIPP: " + fullcmd
print("Running SIPP: " + fullcmd)
if SIPP_BG_MODE:
sipp_proc = subprocess.Popen(fullcmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=G_INUNIX, universal_newlines=False)
else:
@ -169,7 +168,7 @@ def wait_sipp(sipp):
return sipp.returncode
else:
print "Waiting SIPp (PID=" + str(sipp) + ") to exit.."
print("Waiting SIPp (PID=" + str(sipp) + ") to exit..")
wait_cnt = 0
while True:
try:
@ -186,7 +185,7 @@ def wait_sipp(sipp):
return ret_code
except os.error:
if wait_cnt <= 5:
print "Retry ("+str(wait_cnt)+") waiting SIPp.."
print("Retry ("+str(wait_cnt)+") waiting SIPp..")
else:
return -99
@ -214,7 +213,7 @@ def exec_pjsua_expects(t, sipp):
ua[ua_idx].expect(expect_st, raise_on_error = True)
if send_cmd != "":
ua[ua_idx].send(send_cmd)
except TestError, e:
except TestError as e:
ua_err_st = e.desc
break;
except:

View File

@ -1,5 +1,4 @@
import sys
import imp
import re
import os
import subprocess
@ -12,6 +11,7 @@ import getopt
import inc_cfg as inc
import inc_const as const
import inc_util as util
# Vars
G_EXE = "" # pjsua executable path
@ -35,25 +35,25 @@ Sample:
# Parse arguments
try:
opts, args = getopt.getopt(sys.argv[1:], "hne:", ["help", "null-audio", "exe="])
except getopt.GetoptError, err:
print str(err)
print usage
except getopt.GetoptError as err:
print(str(err))
print(usage)
sys.exit(2)
for o, a in opts:
if o in ("-h", "--help"):
print usage
print(usage)
sys.exit()
elif o in ("-n", "--null-audio"):
inc.HAS_SND_DEV = 0
elif o in ("-e", "--exe"):
G_EXE = a
else:
print "Unknown options"
print("Unknown options")
sys.exit(2)
if len(args) != 2:
print "Invalid arguments"
print usage
print("Invalid arguments")
print(usage)
sys.exit(2)
# Set global ARGS to be used by modules
@ -88,7 +88,7 @@ if G_EXE == "":
e_ts = st.st_mtime
if G_EXE=="":
print "Unable to find valid pjsua. Please build pjsip first"
print("Unable to find valid pjsua. Please build pjsip first")
sys.exit(1)
G_INUNIX = False
@ -99,11 +99,11 @@ if G_EXE == "":
if not line:
break
if line.find("TARGET_NAME")!=-1:
print line
print(line)
G_EXE="../../pjsip-apps/bin/pjsua-" + line.split(":= ")[1]
break
if G_EXE=="":
print "Unable to find ../../../build.mak. Please build pjsip first"
print("Unable to find ../../../build.mak. Please build pjsip first")
sys.exit(1)
G_INUNIX = True
else:
@ -160,16 +160,20 @@ class Expect(threading.Thread):
self.running = True
while self.proc.poll() is None:
line = self.telnet.read_until('\n', 60)
if line == "" or const.DESTROYED in line:
line = self.telnet.read_until(b'\n', 60)
linestr = line.decode('utf-8')
if linestr == "" or const.DESTROYED in linestr:
break;
#Print the line if echo is ON
if self.echo:
print self.name + ": " + line.rstrip()
try:
print(self.name + ": " + linestr.rstrip())
except UnicodeEncodeError:
print((self.name + ": " + linestr.rstrip()).encode('utf-8'))
self.lock.acquire()
self.output += line
self.output += linestr
self.lock.release()
self.running = False
else:
@ -186,7 +190,7 @@ class Expect(threading.Thread):
#Print the line if echo is ON
if self.echo:
print self.name + ": " + line.rstrip()
print(self.name + ": " + line.rstrip())
self.lock.acquire()
self.output += line
@ -196,7 +200,7 @@ class Expect(threading.Thread):
def send(self, cmd):
self.trace("send " + cmd)
if self.use_telnet:
self.telnet.write(cmd + '\r\n')
self.telnet.write((cmd + '\r\n').encode('utf-8'))
else:
self.proc.stdin.writelines(cmd + "\n")
self.proc.stdin.flush()
@ -271,12 +275,15 @@ class Expect(threading.Thread):
if self.trace_enabled:
now = time.time()
fmt = self.name + ": " + "================== " + s + " ==================" + " [at t=%(time)03d]"
print fmt % {'time':int(now - self.t0)}
try:
print(fmt % {'time':int(now - self.t0)})
except UnicodeEncodeError:
print((fmt % {'time':int(now - self.t0)}).encode('utf-8'))
#########################
# Error handling
def handle_error(errmsg, t, close_processes = True):
print "====== Caught error: " + errmsg + " ======"
print("====== Caught error: " + errmsg + " ======")
if (close_processes):
time.sleep(1)
for p in t.process:
@ -304,7 +311,7 @@ def handle_error(errmsg, t, close_processes = True):
else:
p.wait()
print "Test completed with error: " + errmsg
print("Test completed with error: " + errmsg)
sys.exit(1)
@ -312,27 +319,27 @@ def handle_error(errmsg, t, close_processes = True):
# MAIN
# Import the test script
script = imp.load_source("script", inc.ARGS[0])
script = util.load_module_from_file("script", inc.ARGS[0])
# Init random seed
random.seed()
# Validate
if script.test == None:
print "Error: no test defined"
print("Error: no test defined")
sys.exit(1)
if script.test.skip:
print "Test " + script.test.title + " is skipped"
print("Test " + script.test.title + " is skipped")
sys.exit(0)
if len(script.test.inst_params) == 0:
print "Error: test doesn't contain pjsua run descriptions"
print("Error: test doesn't contain pjsua run descriptions")
sys.exit(1)
# Instantiate pjsuas
print "====== Running " + script.test.title + " ======"
print "Using " + G_EXE + " as pjsua executable"
print("====== Running " + script.test.title + " ======")
print("Using " + G_EXE + " as pjsua executable")
for inst_param in script.test.inst_params:
retry = 0
@ -344,7 +351,7 @@ for inst_param in script.test.inst_params:
# Create pjsua's Expect instance from the param
p = Expect(inst_param)
p.start()
except inc.TestError, e:
except inc.TestError as e:
handle_error(e.desc, script.test)
# wait process ready
@ -389,14 +396,14 @@ for p in script.test.process:
p.send("echo 1")
p.expect("echo 1")
except inc.TestError, e:
except inc.TestError as e:
handle_error(e.desc, script.test)
# Run the test function
if script.test.test_func != None:
try:
script.test.test_func(script.test)
except inc.TestError, e:
except inc.TestError as e:
handle_error(e.desc, script.test)
except:
handle_error("Unknown error: " + str(traceback.format_exc()), script.test)
@ -424,10 +431,10 @@ for p in script.test.process:
if script.test.post_func != None:
try:
script.test.post_func(script.test)
except inc.TestError, e:
except inc.TestError as e:
handle_error(e.desc, script.test, False)
# Done
print "Test " + script.test.title + " completed successfully"
print("Test " + script.test.title + " completed successfully")
sys.exit(0)

View File

@ -93,30 +93,30 @@ sys.argv.pop(0)
while len(sys.argv):
if sys.argv[0]=='/h' or sys.argv[0]=='-h' or sys.argv[0]=='--help' or sys.argv[0]=='/help':
sys.argv.pop(0)
print "Usage:"
print " runall.py [OPTIONS] [run.py-OPTIONS]"
print "OPTIONS:"
print " --list"
print " List the tests"
print " --list-xml"
print " List the tests as XML format suitable for ccdash"
print " --resume,-r RESUME"
print " RESUME is string/substring to specify where to resume tests."
print " If this argument is omited, tests will start from the beginning."
print " --disable,-d TEST_NAME"
print " Disable a specific test that contains the specified TEST_NAME."
print " --retry,-t RETRY_NUM"
print " Retry a specific test RETRY_NUM times before marking it as failed."
print " Default is 0 (no retry)."
print " --shell,-s SHELL"
print " Run the tests with the specified SHELL cmd. This can also be"
print " used to run the test with ccdash. Example:"
print " --shell '/bin/sh -c'"
print " --no-log"
print " Do not generate log files. By default log files will be generated"
print " and put in 'logs' dir."
print ""
print " run.py-OPTIONS are applicable here"
print("Usage:")
print(" runall.py [OPTIONS] [run.py-OPTIONS]")
print("OPTIONS:")
print(" --list")
print(" List the tests")
print(" --list-xml")
print(" List the tests as XML format suitable for ccdash")
print(" --resume,-r RESUME")
print(" RESUME is string/substring to specify where to resume tests.")
print(" If this argument is omited, tests will start from the beginning.")
print(" --disable,-d TEST_NAME")
print(" Disable a specific test that contains the specified TEST_NAME.")
print(" --retry,-t RETRY_NUM")
print(" Retry a specific test RETRY_NUM times before marking it as failed.")
print(" Default is 0 (no retry).")
print(" --shell,-s SHELL")
print(" Run the tests with the specified SHELL cmd. This can also be")
print(" used to run the test with ccdash. Example:")
print(" --shell '/bin/sh -c'")
print(" --no-log")
print(" Do not generate log files. By default log files will be generated")
print(" and put in 'logs' dir.")
print("")
print(" run.py-OPTIONS are applicable here")
sys.exit(0)
elif sys.argv[0] == '-r' or sys.argv[0] == '--resume':
if len(sys.argv) > 1:
@ -139,7 +139,7 @@ while len(sys.argv):
elif sys.argv[0] == '--list':
sys.argv.pop(0)
for t in tests:
print t
print(t)
sys.exit(0)
elif sys.argv[0] == '--list-xml':
sys.argv.pop(0)
@ -151,7 +151,7 @@ while len(sys.argv):
if len(sys.argv):
c = " ".join(sys.argv) + " "
tcmd = PYTHON + ' run.py ' + c + t
print '\t\t<Test name="%s" cmd="%s" wdir="tests/pjsua" />' % (tname, tcmd)
print('\t\t<Test name="%s" cmd="%s" wdir="tests/pjsua" />' % (tname, tcmd))
sys.exit(0)
elif sys.argv[0] == '-s' or sys.argv[0] == '--shell':
if len(sys.argv) > 1:
@ -194,7 +194,7 @@ for pat in excluded_tests:
total_cnt = len(tests)
for t in tests:
if resume_script!="" and t.find(resume_script)==-1:
print "Skipping " + t +".."
print("Skipping " + t +"..")
total_cnt = total_cnt - 1
continue
resume_script=""
@ -218,23 +218,23 @@ for t in tests:
t1 = time.time()
if ret != 0:
dur = int(t1 - t0)
print " failed!! [" + str(dur) + "s]"
print(" failed!! [" + str(dur) + "s]")
if (i < retry_num + 1):
continue
if with_log:
lines = open(logname, "r").readlines()
print ''.join(lines)
print "Log file: '" + logname + "'."
lines = open(logname, "r", encoding='utf-8').readlines()
print(''.join(lines))
print("Log file: '" + logname + "'.")
fails_cnt += 1
else:
dur = int(t1 - t0)
print " ok [" + str(dur) + "s]"
print(" ok [" + str(dur) + "s]")
break
tests_cnt += 1
if fails_cnt == 0:
print "All " + str(tests_cnt) + " tests completed successfully"
print("All " + str(tests_cnt) + " tests completed successfully")
else:
print str(tests_cnt) + " tests completed, " + str(fails_cnt) + " test(s) failed"
print(str(tests_cnt) + " tests completed, " + str(fails_cnt) + " test(s) failed")
sys.exit(fails_cnt)