aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2017-01-02 09:03:47 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-02 22:54:45 +0000
commitc86fa02201750a4770d7dab07b2294a5072fc1b9 (patch)
tree98481c6b16a48a6b00c5de53cfde42ef8720aad7
parent8372ff4f279c7d7c48d70ce0b80b973f939401ff (diff)
make test: fix assert_nothing_captured api
Change-Id: I5cd11adcbd90a018deb3cd7cf157f72d9ab76e1c Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r--test/vpp_pg_interface.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py
index f4305275937..d3db8d208a3 100644
--- a/test/vpp_pg_interface.py
+++ b/test/vpp_pg_interface.py
@@ -173,11 +173,11 @@ class VppPGInterface(VppInterface):
expected_count = \
self.test.get_packet_count_for_if_idx(self.sw_if_index)
based_on = "based on stored packet_infos"
+ if expected_count == 0:
+ raise Exception(
+ "Internal error, expected packet count for %s is 0!" % name)
self.test.logger.debug("Expecting to capture %s(%s) packets on %s" % (
expected_count, based_on, name))
- if expected_count == 0:
- raise Exception(
- "Internal error, expected packet count for %s is 0!" % name)
while remaining_time > 0:
before = time.time()
capture = self._get_capture(remaining_time, filter_out_fn)
@@ -186,6 +186,8 @@ class VppPGInterface(VppInterface):
if len(capture.res) == expected_count:
# bingo, got the packets we expected
return capture
+ elif expected_count == 0:
+ return None
remaining_time -= elapsed_time
if capture:
raise Exception("Captured packets mismatch, captured %s packets, "
@@ -209,8 +211,8 @@ class VppPGInterface(VppInterface):
if len(capture.res) == 0:
# junk filtered out, we're good
return
- self.test.logger.error(
- ppc("Unexpected packets captured:", capture))
+ self.test.logger.error(
+ ppc("Unexpected packets captured:", capture))
except:
pass
if remark:
@@ -235,9 +237,8 @@ class VppPGInterface(VppInterface):
self.test.logger.debug("Waiting for capture file %s to appear, "
"timeout is %ss" % (self.out_path, timeout))
else:
- self.test.logger.debug(
- "Capture file %s already exists" %
- self.out_path)
+ self.test.logger.debug("Capture file %s already exists" %
+ self.out_path)
return True
while time.time() < limit:
if os.path.isfile(self.out_path):