summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-11-27 17:55:08 +0000
committerBryn M. Reeves <bmr@redhat.com>2016-02-25 16:40:58 +0000
commit3dae4162293e385083025c85ec0e6307c48eb48e (patch)
treefb854570f538c0a8f49b456e9d4dc314e8a5353d
parent1f8fd5a1522b607255eb8e45572a22de85d6f2ae (diff)
downloadlvm2-3dae4162293e385083025c85ec0e6307c48eb48e.tar.gz
tests: add driver_at_least() to aux.sh
Add a function to test whether the running device-mapper driver version is at least equal to some given version.
-rw-r--r--test/lib/aux.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index cfd362015..e517bc025 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1232,6 +1232,21 @@ target_at_least() {
}
}
+# Check whether the kernel driver version is greater or equal
+# to the specified version. This can be used to skip tests on
+# kernels where they are known to not be supported.
+#
+# e.g. driver_at_least 4 33
+#
+driver_at_least() {
+ local version=$(dmsetup version | tail -1 2>/dev/null)
+ version=${version##*:}
+ version_at_least "$version" "$@" || {
+ echo "Found driver version $version, but requested $@." >&2
+ return 1
+ }
+}
+
have_thin() {
test "$THIN" = shared -o "$THIN" = internal || {
echo "Thin is not built-in." >&2