[ovs-dev] [PATCH ovn] tests: actually compare packets in localnet tests
Ihar Hrachyshka
ihrachys at redhat.com
Wed Apr 8 19:32:19 UTC 2020
Before the fix, the OVN_CHECK_PACKETS_REMOVE_BROADCAST macro was
redefining ovn_check_packets__ function and not running any checks
whatsoever. Which made several test cases ineffective, and also
allowed several bugs to creep into the function itself (like using
$top_srcdir/ovs instead of $ovs_srcdir or not initializing $rcv_text.
Signed-off-by: Ihar Hrachyshka <ihrachys at redhat.com>
---
tests/ovn.at | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/tests/ovn.at b/tests/ovn.at
index e8554f60d..084178d61 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -24,26 +24,29 @@ m4_divert_text([PREPARE_TESTS],
test $rcv_n -ge $exp_n])
sort $exp_text > expout
}
+ ovn_check_packets_remove_broadcast__ () {
+ echo "checking packets in $1 against $2:"
+ rcv_pcap=$1
+ rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'`
+ exp_text=$2
+ exp_n=`wc -l < "$exp_text"`
+ OVS_WAIT_UNTIL(
+ [$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
+ sed -i '/ffffffffffff/d' $rcv_text
+ rcv_n=`wc -l < "$rcv_text"`
+ echo "rcv_n=$rcv_n exp_n=$exp_n"
+ test $rcv_n -ge $exp_n])
+ sort $exp_text > expout
+ }
])
+
m4_define([OVN_CHECK_PACKETS],
[ovn_check_packets__ "$1" "$2"
AT_CHECK([sort $rcv_text], [0], [expout])])
m4_define([OVN_CHECK_PACKETS_REMOVE_BROADCAST],
- [ovn_check_packets__ () {
- echo "checking packets in $1 against $2:"
- rcv_pcap=$1
- exp_text=$2
- exp_n=`wc -l < "$exp_text"`
- OVS_WAIT_UNTIL(
- [$PYTHON "$top_srcdir/ovs/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
- sed -i '/ffffffffffff/d' $rcv_text
- rcv_n=`wc -l < "$rcv_text"`
- echo "rcv_n=$rcv_n exp_n=$exp_n"
- test $rcv_n -ge $exp_n])
- sort $exp_text > expout
- }
-])
+ [ovn_check_packets_remove_broadcast__ "$1" "$2"
+ AT_CHECK([sort $rcv_text], [0], [expout])])
AT_BANNER([OVN components])
--
2.25.2
More information about the dev
mailing list