All of lore.kernel.org
 help / color / mirror / Atom feed
From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/test/lib aux.sh
Date: 10 Nov 2011 12:44:01 -0000	[thread overview]
Message-ID: <20111110124401.8290.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at sourceware.org	2011-11-10 12:44:00

Modified files:
	test/lib       : aux.sh 

Log message:
	Add generic function to check for target version
	
	So the test script may use a simple line like i.e.:
	
	aux target_at_least dm-thin-pool 1 0 0 || skip
	aux target_at_least snapshot-origin 1 6 || skip

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.33&r2=1.34

--- LVM2/test/lib/aux.sh	2011/10/23 15:43:10	1.33
+++ LVM2/test/lib/aux.sh	2011/11/10 12:44:00	1.34
@@ -448,6 +448,39 @@
 	fi
 }
 
+#
+# Check wheter kernel [dm module] target exist
+# at least in expected version
+#
+# [dm-]target-name major minor revision
+#
+# i.e.   dm_target_at_least  dm-thin-pool  1 0
+target_at_least()
+{
+	case "$1" in
+	  dm-*) modprobe "$1" ;;
+	esac
+
+	version=$(dmsetup targets 2>/dev/null | grep "${1##dm-} " 2>/dev/null)
+	version=${version##* v}
+	shift
+	major=$(echo $version | cut -d. -f1)
+	minor=$(echo $version | cut -d. -f2)
+	revision=$(echo $version | cut -d. -f3)
+
+	test -z "$1" && return 0
+	test -z "$major" && return 1
+	test "$major" -gt "$1" && return 0
+	test "$major" -lt "$1" && return 1
+	test -z "$2" && return 0
+	test -z "$minor" && return 1
+	test "$minor" -gt "$2" && return 0
+	test "$minor" -lt "$2" && return 1
+	test -z "$4" && return 0
+	test -z "$revision" && return 1
+	test "$revision" -lt "$3" && return 1
+}
+
 test -f DEVICES && devs=$(cat DEVICES)
 test -f LOOP && LOOP=$(cat LOOP)
 



             reply	other threads:[~2011-11-10 12:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 12:44 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-23  9:41 LVM2/test/lib aux.sh zkabelac
2012-03-16 19:08 zkabelac
2012-03-16 13:44 zkabelac
2012-03-16 12:57 zkabelac
2012-03-16 12:56 zkabelac
2012-03-06  2:54 agk
2012-01-26 18:25 zkabelac
2011-12-12  0:01 mornfall
2011-10-23 15:43 zkabelac
2011-10-23 15:40 zkabelac
2011-09-24 21:15 zkabelac
2011-07-08 10:05 zkabelac
2011-07-08 11:36 ` Zdenek Kabelac
2011-06-30  9:17 agk
2011-06-30  9:08 zkabelac
2011-06-30  8:50 mbroz
2011-06-30  1:17 agk
2011-06-29 18:14 agk
2011-06-29 17:37 agk
2011-06-29 17:33 agk
2011-06-29 12:37 agk
2011-06-29 12:33 agk
2011-06-28  0:38 agk
2011-06-28  0:11 agk
2011-03-04 14:19 mbroz
2011-03-01 23:44 mbroz
2011-03-01 22:28 mbroz
2011-01-28 16:10 zkabelac
2011-01-13 14:57 zkabelac
2011-01-12 16:07 mornfall
2011-01-07 13:04 mornfall
2011-01-07 13:03 mornfall
2011-01-05  0:25 mornfall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111110124401.8290.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.