summaryrefslogtreecommitdiff
path: root/tests/ovn.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-07-28 21:41:29 -0700
committerBen Pfaff <blp@ovn.org>2016-07-28 21:41:29 -0700
commit20ec448168a04d930dfab81b8c3b817001a6a290 (patch)
treeb3f79a67eca3327fe0f028069447886cec5a5132 /tests/ovn.at
parent5db68db9bf6644956acc0320d50bb26936a632d4 (diff)
downloadopenvswitch-20ec448168a04d930dfab81b8c3b817001a6a290.tar.gz
tests: Define trim_zeros in only one place.
Defining trim_zeros in a common place allows us to skip defining it in every test that needs it. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Flavio Fernandes <flavio@flaviof.com>
Diffstat (limited to 'tests/ovn.at')
-rw-r--r--tests/ovn.at64
1 files changed, 11 insertions, 53 deletions
diff --git a/tests/ovn.at b/tests/ovn.at
index 140a9cedf..1272c6562 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -1,3 +1,14 @@
+# trim_zeros()
+#
+# Removes pairs of trailing zeros from lines of text. Useful for
+# fairly comparing Ethernet packets that might have been padded out to
+# a minimum (e.g. 64-byte) length.
+m4_divert_text([PREPARE_TESTS],
+ [trim_zeros() {
+ sed 's/\(00\)\{1,\}$//' "$@"
+ }
+])
+
AT_BANNER([OVN components])
AT_SETUP([ovn -- lexer])
@@ -737,9 +748,6 @@ vif_to_hv() {
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2 3; do
for j in 1 2 3; do
: > $i$j.expected
@@ -1038,9 +1046,6 @@ vif_to_hv() {
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2; do
for j in 1 2 3 4 5; do
: > $i$j.expected
@@ -1223,9 +1228,6 @@ sleep 1
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 1 for vif1.
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2 3; do
: > $i.expected
done
@@ -1384,9 +1386,6 @@ sleep 1
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as lport numbers, e.g. 1 for vif1.
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2 3; do
: > $i.expected
done
@@ -1593,9 +1592,6 @@ sleep 1
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 123 for vif123.
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2 3; do
for j in 1 2 3; do
for k in 1 2 3; do
@@ -1951,10 +1947,6 @@ vif_to_hv() {
echo hv${1%?}
}
-
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2 3; do
for j in 1 2 3; do
: > $i$j.expected
@@ -2372,9 +2364,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Packet to send.
src_mac="f00000010203"
@@ -2474,9 +2463,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Packet to send.
src_mac="f00000010203"
@@ -2610,9 +2596,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Packet to send.
src_mac="f00000010203"
@@ -2768,9 +2751,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Send ip packets between foo1 and alice1
src_mac="f00000010203"
@@ -2865,9 +2845,6 @@ AT_CHECK([ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 externa
# Wait for packet to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv/snoopvif-tx.pcap"` -ge 50])
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv/snoopvif-tx.pcap | trim_zeros > packets
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80102000000000000c0a80102"
echo $expected > expout
@@ -2996,9 +2973,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Send ip packets between foo1 and alice1
src_mac="f00000010203"
@@ -3138,10 +3112,6 @@ sleep 2
as hv1 ovs-vsctl show
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
-
# This shell function sends a DHCP request packet
# test_dhcp INPORT SRC_MAC DHCP_TYPE OFFER_IP ...
test_dhcp() {
@@ -3443,9 +3413,6 @@ sleep 2
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Send ip packets between foo1 and alice1
src_mac="f00000010203"
@@ -3590,9 +3557,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2; do
: > vif$i.expected
done
@@ -3756,9 +3720,6 @@ sleep 1
vif_to_hv() {
echo hv1${1%?}
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
for i in 1 2; do
: > $i.expected
done
@@ -4050,9 +4011,6 @@ sleep 1
ip_to_hex() {
printf "%02x%02x%02x%02x" "$@"
}
-trim_zeros() {
- sed 's/\(00\)\{1,\}$//'
-}
# Send ip packets between foo1 and foo2
src_mac="0a0000000001"