From 77e1e2f71cc91e015938ed14544a92bcdd6b904a Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 6 Nov 2013 11:23:35 +0100 Subject: [PATCH] MT#4817 Add not match rule. Use '_:NOT:_' as prefix for negative rules to match --- bin/check.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/check.py b/bin/check.py index 65d3ff17..3db33dcf 100755 --- a/bin/check.py +++ b/bin/check.py @@ -181,11 +181,21 @@ def check_flow(scen, check, test): def check_sip(scen, msg, test): for rule in scen: + if rule.startswith('_:NOT:_'): + flag = False + rule = rule[7:] + msg_ok = '%s not match' + msg_ko = '%s match' + else: + flag = True + msg_ok = '%s match' + msg_ko = '%s not match' result = re.search(rule, msg) - if result is not None: - test.ok('%s match' % rule) + if (result is not None) == flag: + test.ok(msg_ok % rule) continue - test.error('%s not match' % rule) + test.comment('result:%s' % result) + test.error(msg_ko % rule) def check_sip_out(scen, msgs, test): num_msgs = len(msgs)