Some unit tests expect that a OVS port has an associated netdevice on
which they can hook tc or tcpdump.
This will not be possible when testing the userspace datapath with DPDK.
Introduce two helpers (which will be overriden in system-dpdk tests) and
use them in the existing tests.

Signed-off-by: David Marchand <david.march...@redhat.com>
---
 tests/system-common-macros.at    | 12 ++++++++++++
 tests/system-offloads-traffic.at |  6 +++---
 tests/system-traffic.at          | 32 ++++++++++++++++----------------
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 0077a8609c..37bc510eaa 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -297,6 +297,18 @@ m4_define([OVS_START_L7],
 #
 m4_define([OFPROTO_CLEAR_DURATION_IDLE], [[sed -e 
's/duration=.*s,/duration=<cleared>,/g' -e 
's/idle_age=[0-9]*,/idle_age=<cleared>,/g']])
 
+# OVS_CHECK_TC_QDISC()
+#
+# Macro to skip tests when tc qdisc can't be applied on a OVS port.
+m4_define([OVS_CHECK_TC_QDISC],
+    [AT_SKIP_IF([test $HAVE_TC = no])])
+
+# OVS_CHECK_TCPDUMP()
+#
+# Macro to skip tests when tcpdump can't be applied on a OVS port.
+m4_define([OVS_CHECK_TCPDUMP],
+    [AT_SKIP_IF([test $HAVE_TCPDUMP = no])])
+
 # OVS_CHECK_TUNNEL_TSO()
 #
 # Macro to be used in general tunneling tests that could be also
diff --git a/tests/system-offloads-traffic.at b/tests/system-offloads-traffic.at
index 7215e36e2d..270314bfd6 100644
--- a/tests/system-offloads-traffic.at
+++ b/tests/system-offloads-traffic.at
@@ -20,7 +20,7 @@ m4_define([OVS_CHECK_ACTIONS], [
 
 m4_define([CHECK_TC_INGRESS_PPS],
 [
-    AT_SKIP_IF([test $HAVE_TC = "no"])
+    OVS_CHECK_TC_QDISC()
     AT_CHECK([ip link add ovs_tc_pps0 type veth peer name ovs_tc_pps1 dnl
                   || exit 77])
     on_exit 'ip link del ovs_tc_pps0'
@@ -95,7 +95,7 @@ AT_CLEANUP
 
 AT_SETUP([offloads - set ingress_policing_rate and ingress_policing_burst - 
offloads disabled])
 AT_KEYWORDS([ingress_policing])
-AT_SKIP_IF([test $HAVE_TC = "no"])
+OVS_CHECK_TC_QDISC()
 OVS_TRAFFIC_VSWITCHD_START()
 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=false])
 AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
@@ -118,7 +118,7 @@ AT_CLEANUP
 
 AT_SETUP([offloads - set ingress_policing_rate and ingress_policing_burst - 
offloads enabled])
 AT_KEYWORDS([ingress_policing])
-AT_SKIP_IF([test $HAVE_TC = "no"])
+OVS_CHECK_TC_QDISC()
 OVS_TRAFFIC_VSWITCHD_START([], [], [-- set Open_vSwitch . 
other_config:hw-offload=true])
 AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
 ADD_NAMESPACES(at_ns0)
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 808c492a22..dc7fa861ef 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -856,7 +856,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([datapath - slow_action on geneve6 tunnel])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_CHECK_TUNNEL_TSO()
 OVS_CHECK_GENEVE_UDP6ZEROCSUM()
 
@@ -2114,7 +2114,7 @@ AT_CLEANUP
 AT_BANNER([MPLS])
 
 AT_SETUP([mpls - encap header dp-support])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_TRAFFIC_VSWITCHD_START()
 
 AT_SKIP_IF([! ovs-appctl dpif/show-dp-features br0 2>&1 | grep "MPLS Label 
add: Yes" >/dev/null])
@@ -2147,7 +2147,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([mpls - encap header slow-path])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_TRAFFIC_VSWITCHD_START()
 
 AT_CHECK(ovs-appctl dpif/set-dp-features br0 add_mpls false)
@@ -2179,7 +2179,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([mpls_mc - encap header dp-support])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_TRAFFIC_VSWITCHD_START()
 
 AT_SKIP_IF([! ovs-appctl dpif/show-dp-features br0 2>&1 | grep "MPLS Label 
add: Yes" >/dev/null])
@@ -2212,7 +2212,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([mpls_mc - encap header slow-path])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_TRAFFIC_VSWITCHD_START()
 
 AT_CHECK(ovs-appctl dpif/set-dp-features br0 add_mpls false)
@@ -2244,7 +2244,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([mpls - decap header dp-support])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_TRAFFIC_VSWITCHD_START()
 
 AT_SKIP_IF([! ovs-appctl dpif/show-dp-features br0 2>&1 | grep "MPLS Label 
add: Yes" >/dev/null])
@@ -2282,7 +2282,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([mpls - decap header slow-path])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 OVS_TRAFFIC_VSWITCHD_START()
 
 AT_CHECK(ovs-appctl dpif/set-dp-features br0 add_mpls false)
@@ -2321,7 +2321,7 @@ AT_CLEANUP
 AT_BANNER([QoS])
 
 AT_SETUP([QoS - basic configuration])
-AT_SKIP_IF([test $HAVE_TC = no])
+OVS_CHECK_TC_QDISC()
 OVS_TRAFFIC_VSWITCHD_START()
 
 ADD_NAMESPACES(at_ns0, at_ns1)
@@ -2355,7 +2355,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([QoS - 64bit])
-AT_SKIP_IF([test $HAVE_TC = no])
+OVS_CHECK_TC_QDISC()
 AT_SKIP_IF([test $HAVE_TCA_HTB_RATE64 = no])
 OVS_TRAFFIC_VSWITCHD_START()
 
@@ -2383,7 +2383,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([Ingress Policing - 64-bit])
-AT_SKIP_IF([test $HAVE_TC = no])
+OVS_CHECK_TC_QDISC()
 AT_SKIP_IF([test $HAVE_TCA_POLICE_PKTRATE64 = no])
 OVS_TRAFFIC_VSWITCHD_START()
 ADD_NAMESPACES(ns0)
@@ -3777,7 +3777,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([conntrack - ICMP related NAT with single port])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
 OVS_TRAFFIC_VSWITCHD_START()
@@ -4565,7 +4565,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([conntrack - IPv4 Fragmentation + NAT])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 CHECK_CONNTRACK()
 
 OVS_TRAFFIC_VSWITCHD_START(
@@ -6103,7 +6103,7 @@ AT_CLEANUP
 
 AT_SETUP([conntrack - ICMP related with NAT])
 AT_SKIP_IF([test $HAVE_NC = no])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
 OVS_TRAFFIC_VSWITCHD_START()
@@ -6871,7 +6871,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([conntrack - IPv6 ICMP6 Related with SNAT])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 AT_SKIP_IF([test $HAVE_NC = no])
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
@@ -6925,7 +6925,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
 AT_SETUP([conntrack - ICMPv6 related NAT with single port])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
 OVS_TRAFFIC_VSWITCHD_START()
@@ -7610,7 +7610,7 @@ AT_CLEANUP
 
 AT_SETUP([conntrack - ICMP from different source related with NAT])
 AT_SKIP_IF([test $HAVE_NC = no])
-AT_SKIP_IF([test $HAVE_TCPDUMP = no])
+OVS_CHECK_TCPDUMP()
 CHECK_CONNTRACK()
 CHECK_CONNTRACK_NAT()
 OVS_TRAFFIC_VSWITCHD_START()
-- 
2.41.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to