Skip to content

Commit

Permalink
Support "expect no packets" in STF (#55)
Browse files Browse the repository at this point in the history
Specifying `expect 1` as an STF statement will tell the test runner to
expect 0 packets to appear on interface 1. Any packets that egress
interface 1 will cause an error. This is useful for test cases that
explicitly should not generate packets -- e.g. for filtering programs.
  • Loading branch information
bstpierre authored and robertsoule-barefoot committed Feb 28, 2019
1 parent 6422309 commit 55105a9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker/scripts/stf/bmv2stf.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ def do_command(self, cmd):
data = ''.join(data.split())
if data != '':
self.expected.setdefault(interface, []).append(data)
else:
# No data provided: expect 0 packets on this intf.
self.expected.setdefault(interface, [])
else:
if self.options.verbose:
print("ignoring stf command:", first, cmd)
Expand Down

0 comments on commit 55105a9

Please sign in to comment.