From 9735eeff2b736145fe7ab444eb77686a595a9c8e Mon Sep 17 00:00:00 2001
From: Numan Siddique <numans@ovn.org>
Date: Fri, 17 Apr 2020 20:09:24 +0530
Subject: [PATCH 4/4] tests: Fix occasional failures for test 85.
The test case "85: ovn -- send gratuitous ARP for NAT rules on HA distributed router"
fails occaionally. On faster systems, chances of failure are higher.
This patch fixes this.
Tested-by: Flavio Fernandes <flavio@flaviof.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
tests/ovn.at | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/tests/ovn.at b/tests/ovn.at
index ae3b44cb3..91d0a8fec 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -11062,6 +11062,12 @@ only_broadcast_from_lrp1() {
garp="fffffffffffff0000000000108060001080006040001f00000000001c0a80064000000000000c0a80064"
echo $garp > expout
+OVS_WAIT_UNTIL(
+ [$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap > rcv_text
+ exp_rcvd=$(cat rcv_text | grep $garp | wc -l)
+ echo "expected received = $exp_rcvd"
+ test $exp_rcvd -ge 1])
+
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv1_snoop_tx
echo "packets on hv1-snoopvif:"
cat hv1_snoop_tx
@@ -11090,12 +11096,17 @@ as hv1 reset_pcap_file snoopvif hv1/snoopvif
as hv2 reset_pcap_file br-phys_n1 hv2/br-phys_n1
as hv3 reset_pcap_file br-phys_n1 hv3/br-phys_n1
-# Wait for packets to be received.
-OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}
+# Wait for packets to be received.
+OVS_WAIT_UNTIL(
+ [$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap > rcv_text
+ exp_rcvd=$(cat rcv_text | grep $garp | wc -l)
+ echo "expected received = $exp_rcvd"
+ test $exp_rcvd -ge 1])
+
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv1_snoopvif_tx
AT_CHECK([sort hv1_snoopvif_tx], [0], [expout])
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv3/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv3_br_phys_tx
@@ -11141,6 +11152,12 @@ trim_zeros() {
garp="fffffffffffff00000000001810007de08060001080006040001f00000000001c0a80064000000000000c0a80064"
echo $garp > expout
+OVS_WAIT_UNTIL(
+ [$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap > rcv_text
+ exp_rcvd=$(cat rcv_text | grep $garp | wc -l)
+ echo "expected received = $exp_rcvd"
+ test $exp_rcvd -ge 1])
+
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv1_snoopvif_tx
AT_CHECK([sort hv1_snoopvif_tx], [0], [expout])
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv3/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv3_br_phys_tx
--
2.26.2