Skip to content

Commit 4c7c483

Browse files
committed
Add new option to mark certain scenarious as "might fail" without
disabling them completely.
1 parent 60cf4b1 commit 4c7c483

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

bob_main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def main_func():
6868
global_config = {}
6969

7070
try:
71-
opts, args = getopt.getopt(sys.argv[1:], 'p:l:P:T:n:N:w:')
71+
opts, args = getopt.getopt(sys.argv[1:], 'p:l:P:T:n:N:w:f:')
7272
except getopt.GetoptError:
7373
usage(global_config)
7474
tcfg = test_config(global_config)
@@ -102,6 +102,9 @@ def main_func():
102102
if o == '-w':
103103
pre_wait = float(a)
104104
continue
105+
if o == '-f':
106+
tcfg.tests_mightfail = tuple(['bob_' + x for x in a.split(',')])
107+
continue
105108

106109
bodys = [MsgBody(x) for x in BODIES_ALL]
107110
for body in bodys:

lib/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class test_config(object):
8888
body = None
8989
portrange = PortRange('12000-15000')
9090
tests = None
91+
tests_mightfail = tuple()
9192
test_timeout = 60
9293
nh_address4 = ('127.0.0.1', 5060)
9394
nh_address6 = ('[::1]', 5060)

test_cases/t1.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,15 @@ def alldone(self, ua):
6969
if self.ring_done and self.connect_done and self.disconnect_done and self.nerrs == 0:
7070
self.rval = 0
7171
else:
72+
mightfail = self.cli in self.tccfg.tests_mightfail
7273
if self.debug_lvl > -1 and not self.finfo_displayed:
73-
print(self.failed_msg())
74+
fmsg = self.failed_msg()
75+
if mightfail:
76+
fmsg = f'{fmsg} [IGNORED]'
77+
print(fmsg)
7478
self.finfo_displayed = True
79+
if mightfail:
80+
self.rval = 0
7581
self.tccfg.done_cb(self)
7682

7783
class a_test1(test):

test_run.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,12 @@ then
251251
report_rc_log ${?} "rtpproxy.rout rtpproxy.log" "Checking if ${RTPP_SOCK_TEST} works"
252252
fi
253253

254-
MM_AUTH="${MM_AUTH}" ${PYTHON_CMD} bob.py -l '*' -P 5062 -T ${BOB_TIMEOUT} 2>bob.log &
254+
BOB_ARGS="-P 5062 -T ${BOB_TIMEOUT}"
255+
if [ -n "${TEST_SET_MIGHTFAIL}" ]
256+
then
257+
BOB_ARGS="${BOB_ARGS} -f ${TEST_SET_MIGHTFAIL}"
258+
fi
259+
MM_AUTH="${MM_AUTH}" ${PYTHON_CMD} bob.py -l '*' ${BOB_ARGS} 2>bob.log &
255260
BOB_PID=${!}
256261
echo "${BOB_PID}" > "${BOB_PIDF}"
257262
start_mm

0 commit comments

Comments
 (0)