Some tests depend on upstream gre modules to setup testing environments.
However, some kernel versions require compatable gre modules being used.
This patch helps to skip tests that fail due to this reason. The new m4
functions will be used by later patches.

Signed-off-by: Yifeng Sun <pkusunyif...@gmail.com>
---
 tests/system-common-macros.at | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 64bf5ec..0bb4f8c 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -329,3 +329,23 @@ m4_define([OVS_CHECK_IPROUTE_ENCAP],
 # OVS_CHECK_CT_CLEAR()
 m4_define([OVS_CHECK_CT_CLEAR],
     [AT_SKIP_IF([! grep -q "Datapath supports ct_clear action" 
ovs-vswitchd.log])])
+
+# OVS_CHECK_KERNEL([version], [minsublevel], [maxsublevel])
+#
+# Check if kernel version falls between version.minsublevel and
+# version.maxsublevel, skip this test if it is not.
+m4_define([OVS_CHECK_KERNEL],
+    [version=$(uname -r | sed -e 's/\./ /g' | awk '{print $ 1}')
+     sublevel=$(uname -r | sed -e 's/\./ /g' | awk '{print $ 2}')
+     AT_SKIP_IF([test $version -ne $1 || test $sublevel -lt $2 || test 
$sublevel -gt $3])
+    ])
+
+# OVS_CHECK_KERNEL_EXCL([version], [minsublevel], [maxsublevel])
+#
+# Check that kernel version doesn't fall between version.minsublevel and
+# version.maxsublevel, skip this test if it is.
+m4_define([OVS_CHECK_KERNEL_EXCL],
+    [version=$(uname -r | sed -e 's/\./ /g' | awk '{print $ 1}')
+     sublevel=$(uname -r | sed -e 's/\./ /g' | awk '{print $ 2}')
+     AT_SKIP_IF([test $version -eq $1 && test $sublevel -ge $2 && test 
$sublevel -le $3])
+    ])
-- 
2.7.4

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

Reply via email to