More pjsua-test work: print full log to help investigating any failed test, and other minor updates. (#2322)

* pjsua-test print full test log if test failed
* Update subscription check condition in pjsua presence test
* Update ccpp.yml
This commit is contained in:
Nanang Izzuddin 2020-03-04 09:11:37 +07:00 committed by GitHub
parent 848ce29fa5
commit fedc629c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 16 deletions

View File

@ -10,9 +10,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: sudo apt-get install -y sip-tester
run: |
sudo apt-get install -y sip-tester
sudo apt-get install -y libopencore-amrnb-dev
- name: config site
run: echo "#define PJMEDIA_SRTP_HAS_DTLS 1" > pjlib/include/pj/config_site.h
run: |
echo "#define PJMEDIA_SRTP_HAS_DTLS 1" > pjlib/include/pj/config_site.h
echo "#define PJMEDIA_HAS_G722_CODEC 1" >> pjlib/include/pj/config_site.h
echo "#define PJMEDIA_HAS_G7221_CODEC 1" >> pjlib/include/pj/config_site.h
echo "#define PJ_EXCLUDE_BENCHMARK_TESTS 1" >> pjlib/include/pj/config_site.h
echo "#define PJ_CLI_MAX_CHOICE_VAL 64" >> pjlib/include/pj/config_site.h
- name: configure
run: ./configure
- name: make

1
tests/pjsua/logs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

View File

@ -52,7 +52,10 @@ def test_func(t):
u2.send("+b")
u2.send(uri1)
u2.expect("Subscription state changed NULL --> SENT")
u2.expect("Presence subscription.*is ACCEPTED")
# sometime it is NULL->SENT->ACCEPTED->ACTIVE
# some othertime NULL->SENT->ACTIVE
#u2.expect("Presence subscription.*is ACCEPTED")
u2.expect("Presence subscription.*is ACTIVE")
if not u1.inst_param.have_publish:
# Process incoming SUBSCRIBE in U1
# Finds out which account gets the subscription in U1

View File

@ -143,7 +143,7 @@ class Expect(threading.Thread):
# start telnet-ing to pjsua, raise exception if telnet fails after 5s
t0 = time.time()
while self.proc.poll() == None and self.telnet is None:
while self.proc.poll() is None and self.telnet is None:
try:
time.sleep(0.01)
self.telnet = telnetlib.Telnet('127.0.0.1', port=self.inst_param.telnet_port, timeout=60)
@ -154,7 +154,7 @@ class Expect(threading.Thread):
raise inc.TestError(self.name + ": Timeout connecting to pjsua: " + repr(e))
self.running = True
while self.proc.poll() == None:
while self.proc.poll() is None:
line = self.telnet.read_until('\n', 60)
if line == "" or const.DESTROYED in line:
break;
@ -174,7 +174,7 @@ class Expect(threading.Thread):
self.trace("Popen " + fullcmd)
self.proc = subprocess.Popen(fullcmd, shell=G_INUNIX, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=False)
self.running = True
while self.proc.poll() == None:
while self.proc.poll() is None:
line = self.proc.stdout.readline()
if line == "":
break;
@ -283,18 +283,18 @@ def handle_error(errmsg, t, close_processes = True):
is_err = False
try:
ret = p.expect(const.DESTROYED, False)
if not ret:
if ret is None:
is_err = True
except:
is_err = True
if is_err:
if is_err and p.proc.poll() is None:
if sys.hexversion >= 0x02060000:
p.proc.terminate()
else:
p.wait()
else:
p.wait()
print "Test completed with error: " + errmsg
sys.exit(1)

View File

@ -82,7 +82,7 @@ for f in os.listdir("scripts-sipp"):
resume_script=""
shell_cmd=""
with_log=False
with_log=True
# Parse arguments
sys.argv.pop(0)
@ -105,8 +105,9 @@ while len(sys.argv):
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 " --logs"
print " Generate log files, the log files will be put in 'logs' dir."
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)
@ -154,9 +155,9 @@ while len(sys.argv):
sys.argv.pop(0)
sys.stderr.write("Error: argument value required")
sys.exit(1)
elif sys.argv[0] == '--logs':
elif sys.argv[0] == '--no-log':
sys.argv.pop(0)
with_log=True
with_log=False
else:
# should be run.py options
break
@ -185,7 +186,7 @@ for t in tests:
if shell_cmd:
cmdline = "%s '%s'" % (shell_cmd, cmdline)
t0 = time.time()
msg = "Running %d/%d: %s..." % (tests_cnt+1, total_cnt, cmdline)
msg = "Running %3d/%d: %s..." % (tests_cnt+1, total_cnt, cmdline)
sys.stdout.write(msg)
sys.stdout.flush()
if with_log:
@ -202,7 +203,9 @@ for t in tests:
dur = int(t1 - t0)
print " failed!! [" + str(dur) + "s]"
if with_log:
print "Please check '" + logname + "' for the test log."
lines = open(logname, "r").readlines()
print ''.join(lines)
print "Log file: '" + logname + "'."
fails_cnt += 1
else:
dur = int(t1 - t0)