Skip to content

Commit

Permalink
tests: don't bail from OVN_CHECK_PACKETS_CONTAIN prematurily
Browse files Browse the repository at this point in the history
When the expected number of packets arrive, OVN_CHECK_PACKETS_CONTAIN
bails out. But it should bail out from waiting only when the expected
packets were observed or when timeout reached, because the whole point
of the function is to allow to ignore some packets (usually garps
generated by ports) while waiting on the desired packets to arrive.

Signed-off-by: Ihar Hrachyshka <[email protected]>
Acked-by: Mark Michelson <[email protected]>
Signed-off-by: Numan Siddique <[email protected]>
  • Loading branch information
booxter authored and numansiddique committed Feb 25, 2022
1 parent c6cf403 commit 5f7a985
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ m4_divert_text([PREPARE_TESTS],
[dump_diff__ "$rcv_pcap" "$exp_text"])
sort $exp_text > expout
}
ovn_wait_packets__ () {
echo "$3: waiting for packets from $2 at $1:"
rcv_pcap=$1
rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'`
exp_text=$2
OVS_WAIT_UNTIL(
[$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
sort $exp_text > expout
test x"$(sort $rcv_text | comm -2 -3 expout -)" = "x"],
[dump_diff__ "$rcv_pcap" "$exp_text"])
}
])

m4_define([OVN_CHECK_PACKETS],
Expand All @@ -63,8 +74,7 @@ m4_define([OVN_CHECK_PACKETS_REMOVE_BROADCAST],
AT_CHECK([sort $rcv_text], [0], [expout], [ignore], [dump_diff__ "$1" "$2"])])

m4_define([OVN_CHECK_PACKETS_CONTAIN],
[ovn_check_packets__ "$1" "$2" "__file__:__line__"
AT_CHECK([sort $rcv_text | comm -2 -3 expout -], [0], [])])
[ovn_wait_packets__ "$1" "$2" "__file__:__line__"])

AT_BANNER([OVN components])

Expand Down

0 comments on commit 5f7a985

Please sign in to comment.