pf tests: support packet size range in pft_ether.py

Teach pft_ether.py to send a range of packet sizes. Use this to move the
size sweep into Python, removing the repeated Python startup overhead
and greatly speeding up the pf.ether.short_pkt test.

This should fix test timeouts seen on ci.freebsd.org.

While here also extend the range of packet sizes tested, because it adds
very little runtime now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost 2022-07-11 12:17:56 +02:00
parent 3c9ad9398f
commit 6d1471fda8
2 changed files with 10 additions and 8 deletions

View file

@ -668,13 +668,10 @@ short_pkt_body()
# Try sending ever shorter ping requests
# BPF won't let us send anything shorter than an Ethernet header, but
# that's good enough for this test
for i in `seq 46 14`
do
$(atf_get_srcdir)/pft_ether.py \
--sendif ${epair}a \
--to 192.0.2.2 \
--len ${i}
done
$(atf_get_srcdir)/pft_ether.py \
--sendif ${epair}a \
--to 192.0.2.2 \
--len 14-64
}
short_pkt_cleanup()

View file

@ -61,7 +61,12 @@ def main():
args = parser.parse_args()
ping(args.sendif[0], args.to[0], int(args.len[0]))
if '-' in args.len[0]:
s=args.len[0].split('-')
for i in range(int(s[0]), int(s[1]) + 1):
ping(args.sendif[0], args.to[0], i)
else:
ping(args.sendif[0], args.to[0], int(args.len[0]))
if __name__ == '__main__':
main()