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

Acked-by: Aaron Conole <acon...@redhat.com>
Signed-off-by: David Marchand <david.march...@redhat.com>
Acked-by: Eelco Chaudron <echau...@redhat.com>
---
Changes since v4:
- as the traffic tests now use net/af_xdp, it is not required to skip
  tests relying on tcpdump anymore,

---
 tests/system-common-macros.at    | 6 ++++++
 tests/system-offloads-traffic.at | 6 +++---
 tests/system-traffic.at          | 6 +++---
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 0077a8609c..0113aae8bd 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -297,6 +297,12 @@ 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_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 5ad6b4bfdf..0bedee7530 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 7ea4502028..a7d4ed83bd 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -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)
-- 
2.41.0

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

Reply via email to