This test wasn't entirely reliable because sometimes more than one
packet could get sent, but it only checked for exactly "n_packets=1".
This fixes the problem and improves the debuggability by producing
more output on failure.

Signed-off-by: Ben Pfaff <[email protected]>
---
 tests/ovn.at | 45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/tests/ovn.at b/tests/ovn.at
index 9493bca6e8e1..3d2b7a7989a7 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -19833,18 +19833,22 @@ 
match_arp_req="priority=80.*${match_sw_metadata}.*arp_tpa=10.0.0.1,arp_op=1"
 match_send_rtr1="load:0x${r1_tnl_key}->NXM_NX_REG15"
 match_send_rtr2="load:0x${r2_tnl_key}->NXM_NX_REG15"
 
+for var in sw_dp_uuid sw_dp_key sw1_dp_key r1_dp_key r1_tnl_key r2_tnl_key \
+           match_arp_req match_send_rtr1 match_send_rtr2; do
+   AS_VAR_COPY([value], [$var])
+   echo "$var=$value"
+done
+
 as hv1
-OVS_WAIT_UNTIL([
-    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_arp_req}" | grep "${match_send_rtr1}" | \
-    grep n_packets=1 -c)
-    test "1" = "${pkts_to_rtr1}"
-])
-OVS_WAIT_UNTIL([
-    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_arp_req}" | grep "${match_send_rtr2}" | \
-    grep n_packets=1 -c)
-    test "0" = "${pkts_to_rtr2}"
+AT_CAPTURE_FILE([offlows])
+OVS_WAIT_FOR_OUTPUT([
+    ovs-ofctl dump-flows br-int > offlows
+    for match in "$match_send_rtr1" "$match_send_rtr2"; do
+        grep -E "$match_arp_req.*$match" offlows | grep -c 'n_packets=[[1-9]]'
+    done
+    :
+], [0], [1
+0
 ])
 
 # Inject ND_NS for ofirst router owned IP address.
@@ -19856,17 +19860,14 @@ send_nd_ns 1 0 ${src_mac} ${src_ipv6} ${dst_ipv6} 751d
 match_nd_ns="priority=80.*${match_sw_metadata}.*icmp_type=135.*nd_target=10::1"
 
 as hv1
-OVS_WAIT_UNTIL([
-    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_nd_ns}" | grep "${match_send_rtr1}" | \
-    grep n_packets=1 -c)
-    test "1" = "${pkts_to_rtr1}"
-])
-OVS_WAIT_UNTIL([
-    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
-    grep -E "${match_nd_ns}" | grep "${match_send_rtr2}" | \
-    grep n_packets=1 -c)
-    test "0" = "${pkts_to_rtr2}"
+OVS_WAIT_FOR_OUTPUT([
+    ovs-ofctl dump-flows br-int > offlows
+    for match in "$match_send_rtr1" "$match_send_rtr2"; do
+        grep -E "$match_nd_ns.*$match" offlows | grep -c 'n_packets=[[1-9]]'
+    done
+    :
+], [0], [1
+0
 ])
 
 # Configure load balancing on both routers.
-- 
2.26.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to