[ovs-dev,2/8] system-common-macros.at: Skip tests for certain kernel versions

Message ID 1533753171-11730-2-git-send-email-pkusunyifeng@gmail.com
State New
Headers show
Series
  • [ovs-dev,1/8] ip6_gre: Fix a bug that clears address bits
Related show

Commit Message

Yifeng Sun Aug. 8, 2018, 6:32 p.m.
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 <pkusunyifeng@gmail.com>
---
 tests/system-common-macros.at | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch

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])
+    ])