public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/test test-utils.sh
@ 2010-08-27  7:59 mbroz
  0 siblings, 0 replies; 28+ messages in thread
From: mbroz @ 2010-08-27  7:59 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-08-27 07:59:40

Modified files:
	test           : test-utils.sh 

Log message:
	Currently tests require SI units enabled and data alignment to 1MiB.
	
	For now force it in lvm.conf (otherwise it fails on older systems like RHEL5
	where are these options disabled by default).
	
	FIXME: it should test and detect both versions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.48&r2=1.49

--- LVM2/test/test-utils.sh	2010/08/12 04:11:50	1.48
+++ LVM2/test/test-utils.sh	2010/08/27 07:59:40	1.49
@@ -366,6 +366,7 @@
     filter = $filter
     cache_dir = "$TESTDIR/etc"
     sysfs_scan = 0
+    default_data_alignment = 1
   }
   log {
     syslog = 0
@@ -384,6 +385,7 @@
     library_dir = "$TESTDIR/lib"
     locking_dir = "$TESTDIR/var/lock/lvm"
     $locktype
+    si_unit_consistency = 1
   }
   activation {
     udev_sync = 1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-12-09 11:19 mbroz
  0 siblings, 0 replies; 28+ messages in thread
From: mbroz @ 2010-12-09 11:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-12-09 11:19:21

Modified files:
	test           : test-utils.sh 

Log message:
	Try to detect fail in clvmd startup in tests.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.55&r2=1.56

--- LVM2/test/test-utils.sh	2010/10/29 16:43:52	1.55
+++ LVM2/test/test-utils.sh	2010/12/09 11:19:21	1.56
@@ -77,6 +77,10 @@
 
 	clvmd -Isinglenode -d 1 &
 	LOCAL_CLVMD="$!"
+
+	# check that it is really running now
+	sleep .1
+	ps $LOCAL_CLVMD || exit 200
 }
 
 prepare_dmeventd() {
@@ -396,6 +400,7 @@
     locking_dir = "$TESTDIR/var/lock/lvm"
     $locktype
     si_unit_consistency = 1
+    fallback_to_local_locking = 0
   }
   activation {
     udev_sync = 1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-10-26  1:25 snitzer
  0 siblings, 0 replies; 28+ messages in thread
From: snitzer @ 2010-10-26  1:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2010-10-26 01:25:47

Modified files:
	test           : test-utils.sh 

Log message:
	Explicitly have grep print the matching filenames (needed to
	successfully determine scsi_debug device).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.53&r2=1.54

--- LVM2/test/test-utils.sh	2010/10/20 15:14:13	1.53
+++ LVM2/test/test-utils.sh	2010/10/26 01:25:46	1.54
@@ -245,7 +245,7 @@
     modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1 || exit 200
     sleep 2 # allow for async Linux SCSI device registration
 
-    local DEBUG_DEV=/dev/$(grep scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+    local DEBUG_DEV=/dev/$(grep -H scsi_debug /sys/block/*/device/model | cut -f4 -d /)
     [ -b $DEBUG_DEV ] || exit 1 # should not happen
 
     # Create symlink to scsi_debug device in $DM_DEV_DIR


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-10-12 16:13 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-10-12 16:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-10-12 16:13:43

Modified files:
	test           : test-utils.sh 

Log message:
	test-utils: Fix a slight bug in the dmeventd-already-running error message.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.50&r2=1.51

--- LVM2/test/test-utils.sh	2010/08/27 08:52:54	1.50
+++ LVM2/test/test-utils.sh	2010/10/12 16:13:43	1.51
@@ -81,7 +81,7 @@
 
 prepare_dmeventd() {
 	if pgrep dmeventd ; then
-		echo "Cannot test dmeventd with real dmeventd ($(pgrep clvmd)) running."
+		echo "Cannot test dmeventd with real dmeventd ($(pgrep dmeventd)) running."
 		exit 200
 	fi
 


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-08-27  8:52 mbroz
  0 siblings, 0 replies; 28+ messages in thread
From: mbroz @ 2010-08-27  8:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-08-27 08:52:55

Modified files:
	test           : test-utils.sh 

Log message:
	Do not run singlenode clvmd tests if support for singlenode not compiled in.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.49&r2=1.50

--- LVM2/test/test-utils.sh	2010/08/27 07:59:40	1.49
+++ LVM2/test/test-utils.sh	2010/08/27 08:52:54	1.50
@@ -70,6 +70,9 @@
 	# skip if we don't have our own clvmd...
 	(which clvmd | grep $abs_builddir) || exit 200
 
+	# skip if we singlenode is not compiled in
+	(clvmd --help 2>&1 | grep "Available cluster managers" | grep singlenode) || exit 200
+
 	trap_teardown
 
 	clvmd -Isinglenode -d 1 &


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-08-02 13:18 zkabelac
  0 siblings, 0 replies; 28+ messages in thread
From: zkabelac @ 2010-08-02 13:18 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-08-02 13:18:42

Modified files:
	test           : test-utils.sh 

Log message:
	Using count=0 is sufficient for creation of zeroed files.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.46&r2=1.47

--- LVM2/test/test-utils.sh	2010/05/24 17:19:50	1.46
+++ LVM2/test/test-utils.sh	2010/08/02 13:18:42	1.47
@@ -186,7 +186,7 @@
 	done
 
 	LOOPFILE="$PWD/test.img"
-	dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=1 seek=$(($size-1))
+	dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size-1))
 	if LOOP=`losetup -s -f "$LOOPFILE" 2>/dev/null`; then
 		return 0
 	elif LOOP=`losetup -f` && losetup $LOOP "$LOOPFILE"; then


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-05-24 17:19 mbroz
  0 siblings, 0 replies; 28+ messages in thread
From: mbroz @ 2010-05-24 17:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-05-24 17:19:50

Modified files:
	test           : test-utils.sh 

Log message:
	Use mv -f for replace config in test.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.45&r2=1.46

--- LVM2/test/test-utils.sh	2010/05/24 17:18:05	1.45
+++ LVM2/test/test-utils.sh	2010/05/24 17:19:50	1.46
@@ -392,7 +392,7 @@
   }
 EOF
 	# FIXME remove this workaround after mmap & truncating file problems solved
-	mv $TESTDIR/etc/lvm.conf.new $TESTDIR/etc/lvm.conf
+	mv -f $TESTDIR/etc/lvm.conf.new $TESTDIR/etc/lvm.conf
 	cat $TESTDIR/etc/lvm.conf
 }
 


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-05-24 17:18 mbroz
  0 siblings, 0 replies; 28+ messages in thread
From: mbroz @ 2010-05-24 17:18 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-05-24 17:18:12

Modified files:
	test           : test-utils.sh 

Log message:
	Replace lvm.conf instead of truncating it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.44&r2=1.45

--- LVM2/test/test-utils.sh	2010/05/24 15:32:21	1.44
+++ LVM2/test/test-utils.sh	2010/05/24 17:18:05	1.45
@@ -358,7 +358,7 @@
 		filter='[ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ]'
         locktype=
 	if test -n "$LVM_TEST_LOCKING"; then locktype="locking_type = $LVM_TEST_LOCKING"; fi
-	cat > $TESTDIR/etc/lvm.conf <<-EOF
+	cat > $TESTDIR/etc/lvm.conf.new <<-EOF
   $LVM_TEST_CONFIG
   devices {
     dir = "$DM_DEV_DIR"
@@ -391,6 +391,8 @@
     polling_interval = 0
   }
 EOF
+	# FIXME remove this workaround after mmap & truncating file problems solved
+	mv $TESTDIR/etc/lvm.conf.new $TESTDIR/etc/lvm.conf
 	cat $TESTDIR/etc/lvm.conf
 }
 


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-05-12 11:58 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-05-12 11:58 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-05-12 11:58:54

Modified files:
	test           : test-utils.sh 

Log message:
	Bump the debug.log level from 4 to 9 (the numbering is different from verbose).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.41&r2=1.42

--- LVM2/test/test-utils.sh	2010/05/12 11:23:16	1.41
+++ LVM2/test/test-utils.sh	2010/05/12 11:58:51	1.42
@@ -371,7 +371,7 @@
   log {
     syslog = 0
     indent = 1
-    level = 4
+    level = 9
     file = "$TESTDIR/debug.log"
     overwrite = 1
   }


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-20 18:19 snitzer
  0 siblings, 0 replies; 28+ messages in thread
From: snitzer @ 2010-04-20 18:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2010-04-20 18:18:59

Modified files:
	test           : test-utils.sh 

Log message:
	Re-enable t-topology-support.sh
	
	Reintroduce split teardown (teardown() calls teardown_devs()) because
	t-topology-support.sh only needs the teardown_devs() subset of the full
	teardown() between each iteration of the topology tests -- in particular
	the $TESTDIR must not get removed between each topology test iteration.
	
	prepare_loop() must return if prepare_scsi_debug_dev() already
	established $LOOP.
	
	Also fix (and simplify) the unsafe scsi-debug device discovery in
	prepare_scsi_debug_dev().

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.37&r2=1.38

--- LVM2/test/test-utils.sh	2010/04/14 12:04:23	1.37
+++ LVM2/test/test-utils.sh	2010/04/20 18:18:59	1.38
@@ -92,16 +92,7 @@
 	done
 }
 
-teardown() {
-	echo $LOOP
-	echo $PREFIX
-
-	test -n "$LOCAL_CLVMD" && {
-		kill "$LOCAL_CLVMD"
-		sleep .1
-		kill -9 "$LOCAL_CLVMD" || true
-	}
-
+teardown_devs() {
 	test -n "$PREFIX" && {
 		rm -rf $TESTDIR/dev/$PREFIX*
 
@@ -124,6 +115,19 @@
 		test -n "$LOOPFILE" && rm -f $LOOPFILE
 	fi
 	unset devs # devs is set in prepare_devs()
+}
+
+teardown() {
+	echo $LOOP
+	echo $PREFIX
+
+	test -n "$LOCAL_CLVMD" && {
+		kill "$LOCAL_CLVMD"
+		sleep .1
+		kill -9 "$LOCAL_CLVMD" || true
+	}
+
+	teardown_devs
 
 	test -n "$TESTDIR" && {
 		cd $OLDPWD
@@ -145,6 +149,11 @@
 	size=$1
 	test -n "$size" || size=32
 
+	# skip if prepare_scsi_debug_dev() was used
+	if [ -n "$SCSI_DEBUG_DEV" -a -n "$LOOP" ]; then
+		return 0
+	fi
+
 	test -z "$LOOP"
 	test -n "$DM_DEV_DIR"
 
@@ -183,71 +192,50 @@
 	exit 1 # should not happen
 }
 
-get_sd_devs_()
-{
-    # prepare_scsi_debug_dev() requires the ability to lookup
-    # the scsi_debug created SCSI device in /dev/
-    local _devs=$(lvmdiskscan --config 'devices { filter = [ "a|/dev/sd.*|", "r|.*|" ] scan = "/dev/" }' | grep /dev/sd | awk '{ print $1 }')
-    echo $_devs
-}
-
 # A drop-in replacement for prepare_loop() that uses scsi_debug to create
 # a ramdisk-based SCSI device upon which all LVM devices will be created
 # - scripts must take care not to use a DEV_SIZE that will enduce OOM-killer
 prepare_scsi_debug_dev()
 {
-    # FIXME this is extremely fragile and can cause data loss if an unrelated
-    # SCSI device appears at a wrong time... we need the code to reliably
-    # identify the scsi_debug device it has created before we can re-include
-    # this in the testsuite
-    exit 200
-
     local DEV_SIZE="$1"
     shift
     local SCSI_DEBUG_PARAMS="$@"
 
     test -n "$SCSI_DEBUG_DEV" && return 0
+    test -z "$LOOP"
+    test -n "$DM_DEV_DIR"
+
     trap_teardown
 
     # Skip test if awk isn't available (required for get_sd_devs_)
     which awk || exit 200
 
     # Skip test if scsi_debug module is unavailable or is already in use
-    modinfo scsi_debug || exit 200
+    modprobe --dry-run scsi_debug || exit 200
     lsmod | grep -q scsi_debug && exit 200
 
     # Create the scsi_debug device and determine the new scsi device's name
-    local devs_before=`get_sd_devs_`
     # NOTE: it will _never_ make sense to pass num_tgts param;
     # last param wins.. so num_tgts=1 is imposed
     modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1 || exit 200
     sleep 2 # allow for async Linux SCSI device registration
 
-    local devs_after=`get_sd_devs_`
-    for dev1 in $devs_after; do
-	FOUND=0
-	for dev2 in $devs_before; do
-	    if [ "$dev1" = "$dev2" ]; then
-		FOUND=1
-		break
-	    fi
-	done
-	if [ $FOUND -eq 0 ]; then
-	    # Create symlink to scsi_debug device in $DM_DEV_DIR
-	    SCSI_DEBUG_DEV=$DM_DEV_DIR/$(basename $dev1)
-	    # Setting $LOOP provides means for prepare_devs() override
-	    LOOP=$SCSI_DEBUG_DEV
-	    ln -snf $dev1 $SCSI_DEBUG_DEV
-	    return 0
-	fi
-    done
-    exit 1 # should not happen
+    local DEBUG_DEV=/dev/$(grep scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+    [ -b $DEBUG_DEV ] || exit 1 # should not happen
+
+    # Create symlink to scsi_debug device in $DM_DEV_DIR
+    SCSI_DEBUG_DEV=$DM_DEV_DIR/$(basename $DEBUG_DEV)
+    # Setting $LOOP provides means for prepare_devs() override
+    LOOP=$SCSI_DEBUG_DEV
+    ln -snf $DEBUG_DEV $SCSI_DEBUG_DEV
+    return 0
 }
 
 cleanup_scsi_debug_dev()
 {
-    aux teardown
+    aux teardown_devs
     unset SCSI_DEBUG_DEV
+    unset LOOP
 }
 
 prepare_devs() {


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-14 12:04 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-14 12:04 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-14 12:04:24

Modified files:
	test           : test-utils.sh 

Log message:
	SIGTERM testing clvmd before SIGKILL-ing it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.36&r2=1.37

--- LVM2/test/test-utils.sh	2010/04/13 08:01:53	1.36
+++ LVM2/test/test-utils.sh	2010/04/14 12:04:23	1.37
@@ -96,7 +96,11 @@
 	echo $LOOP
 	echo $PREFIX
 
-	test -n "$LOCAL_CLVMD" && kill -9 "$LOCAL_CLVMD"
+	test -n "$LOCAL_CLVMD" && {
+		kill "$LOCAL_CLVMD"
+		sleep .1
+		kill -9 "$LOCAL_CLVMD" || true
+	}
 
 	test -n "$PREFIX" && {
 		rm -rf $TESTDIR/dev/$PREFIX*


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-13  8:01 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-13  8:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-13 08:01:53

Modified files:
	test           : test-utils.sh 

Log message:
	Process all core dumps that exist upon a test failure (this would hopefully
	include eg. clvmd cores, apart from the usual lvm ones).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.35&r2=1.36

--- LVM2/test/test-utils.sh	2010/04/13 07:02:14	1.35
+++ LVM2/test/test-utils.sh	2010/04/13 08:01:53	1.36
@@ -22,19 +22,17 @@
 		i=$(($i + 1));
 	done
 
-	# Attempt to get a stacktrace if a core file exists
-	# and the lvm binary was built with debugging
+	# Get backtraces from coredumps
 	TEST_LVM_BINARY=$(dirname $(which lvm))/../../tools/lvm
-	TEST_LVM_CORE=`ls core* | head -1`
-	GDB_BINARY=`which gdb`
-	READELF_BINARY=`which readelf`
-	if [ -n "$TEST_LVM_CORE" -a -n "$GDB_BINARY" -a -n "$READELF_BINARY" ]; then
-		if $READELF_BINARY -S $TEST_LVM_BINARY 2>&1 | grep -q .debug_info; then
-			echo bt full > gdb_commands.txt
-			echo l >> gdb_commands.txt
-			echo quit >> gdb_commands.txt
-			$GDB_BINARY -batch -c $TEST_LVM_CORE -x gdb_commands.txt $TEST_LVM_BINARY
-		fi
+	if which gdb >& /dev/null; then
+		echo bt full > gdb_commands.txt
+		echo l >> gdb_commands.txt
+		echo quit >> gdb_commands.txt
+		for core in core*; do
+			bin=$(gdb -batch -c $core 2>&1 | grep "generated by" | \
+				sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
+			gdb -batch -c $core -x gdb_commands.txt `which $bin`
+		done
 	fi
 }
 
@@ -130,7 +128,7 @@
 }
 
 trap_teardown() {
-	trap 'set +vex; STACKTRACE; set -vex' ERR
+	trap 'set +vx; STACKTRACE; set -vx' ERR
 	trap 'aux teardown' EXIT # don't forget to clean up
 }
 
@@ -387,6 +385,8 @@
 
 prepare() {
 	ulimit -c unlimited
+	# FIXME any way to set this just for our children?
+	# echo 1 > /proc/sys/kernel/core_uses_pid
 	prepare_testroot
 	prepare_lvmconf
 	prepare_clvmd


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-13  7:02 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-13  7:02 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-13 07:02:15

Modified files:
	test           : test-utils.sh 

Log message:
	Disable the rather-dangerous prepare_scsi_debug_dev in the testsuite.

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

--- LVM2/test/test-utils.sh	2010/04/13 06:24:20	1.34
+++ LVM2/test/test-utils.sh	2010/04/13 07:02:14	1.35
@@ -194,6 +194,12 @@
 # - scripts must take care not to use a DEV_SIZE that will enduce OOM-killer
 prepare_scsi_debug_dev()
 {
+    # FIXME this is extremely fragile and can cause data loss if an unrelated
+    # SCSI device appears at a wrong time... we need the code to reliably
+    # identify the scsi_debug device it has created before we can re-include
+    # this in the testsuite
+    exit 200
+
     local DEV_SIZE="$1"
     shift
     local SCSI_DEBUG_PARAMS="$@"


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-13  6:24 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-13  6:24 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-13 06:24:21

Modified files:
	test           : test-utils.sh 

Log message:
	For the testsuite, set a default polling interval to 0 in lvm.conf. Cuts down
	testing time considerably.

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

--- LVM2/test/test-utils.sh	2010/04/07 21:38:01	1.33
+++ LVM2/test/test-utils.sh	2010/04/13 06:24:20	1.34
@@ -373,6 +373,7 @@
   activation {
     udev_sync = 1
     udev_rules = 1
+    polling_interval = 0
   }
 EOF
 	cat $TESTDIR/etc/lvm.conf


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-07 21:38 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-07 21:38 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-07 21:38:01

Modified files:
	test           : test-utils.sh 

Log message:
	Don't forget to cd into $TESTDIR in test-utils.sh / prepare_testdir.

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

--- LVM2/test/test-utils.sh	2010/04/07 21:19:20	1.32
+++ LVM2/test/test-utils.sh	2010/04/07 21:38:01	1.33
@@ -86,6 +86,8 @@
 	export DM_DEV_DIR=$TESTDIR/dev
 	mkdir $LVM_SYSTEM_DIR $DM_DEV_DIR $DM_DEV_DIR/mapper $TESTDIR/lib
 
+	cd $TESTDIR
+
 	for i in `find $abs_top_builddir/daemons/dmeventd/plugins/ -name \*.so`; do
 		echo Setting up symlink from $i to $TESTDIR/lib
 		ln -s $i $TESTDIR/lib
@@ -381,7 +383,6 @@
 	prepare_testroot
 	prepare_lvmconf
 	prepare_clvmd
-	source ./lvm-utils.sh
 }
 
 LANG=C
@@ -390,6 +391,7 @@
 unset CDPATH
 
 . ./init.sh || { echo >&2 you must run make first; exit 1; }
+. ./lvm-utils.sh
 
 set -vexE -o pipefail
 aux prepare


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-07 21:19 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-07 21:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-07 21:19:21

Modified files:
	test           : test-utils.sh 

Log message:
	Fix a mis-override of $PWD in test-utils.sh.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.31&r2=1.32

--- LVM2/test/test-utils.sh	2010/04/07 16:04:22	1.31
+++ LVM2/test/test-utils.sh	2010/04/07 21:19:20	1.32
@@ -75,7 +75,7 @@
 }
 
 prepare_testroot() {
-	PWD="`pwd`"
+	OLDPWD="`pwd`"
 	PREFIX="LVMTEST$$"
 
 	trap_teardown
@@ -122,7 +122,7 @@
 	unset devs # devs is set in prepare_devs()
 
 	test -n "$TESTDIR" && {
-		cd $PWD
+		cd $OLDPWD
 		rm -rf $TESTDIR || echo BLA
 	}
 }


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-07 16:04 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-04-07 16:04 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-07 16:04:23

Modified files:
	test           : test-utils.sh 

Log message:
	Set ulimit -c to unlimited to allow coredumps to be collected and analysed in
	the testsuite.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.30&r2=1.31

--- LVM2/test/test-utils.sh	2010/04/07 14:46:27	1.30
+++ LVM2/test/test-utils.sh	2010/04/07 16:04:22	1.31
@@ -377,6 +377,7 @@
 }
 
 prepare() {
+	ulimit -c unlimited
 	prepare_testroot
 	prepare_lvmconf
 	prepare_clvmd


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-04-06 14:25 agk
  0 siblings, 0 replies; 28+ messages in thread
From: agk @ 2010-04-06 14:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2010-04-06 14:25:08

Modified files:
	test           : test-utils.sh 

Log message:
	Display PVs created during tests

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.27&r2=1.28

--- LVM2/test/test-utils.sh	2010/03/31 22:18:17	1.27
+++ LVM2/test/test-utils.sh	2010/04/06 14:25:07	1.28
@@ -307,6 +307,7 @@
 prepare_vg() {
 	prepare_pvs "$@"
 	vgcreate -c n $vg $devs
+	pvs -v
 }
 
 prepare_lvmconf() {


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-03-28 15:52 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-03-28 15:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-03-28 15:52:04

Modified files:
	test           : test-utils.sh 

Log message:
	When a scsi_debug modprobe fails, skip the test instead of failing it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.25&r2=1.26

--- LVM2/test/test-utils.sh	2010/03/23 14:47:35	1.25
+++ LVM2/test/test-utils.sh	2010/03/28 15:52:04	1.26
@@ -188,7 +188,7 @@
     local devs_before=`get_sd_devs_`
     # NOTE: it will _never_ make sense to pass num_tgts param;
     # last param wins.. so num_tgts=1 is imposed
-    modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1
+    modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1 || exit 200
     sleep 2 # allow for async Linux SCSI device registration
 
     local devs_after=`get_sd_devs_`


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-03-18  9:27 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2010-03-18  9:27 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-03-18 09:27:40

Modified files:
	test           : test-utils.sh 

Log message:
	Skip locking_type 3 tests instead of failing when system-wide clvmd is running.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.23&r2=1.24

--- LVM2/test/test-utils.sh	2010/03/18 09:19:33	1.23
+++ LVM2/test/test-utils.sh	2010/03/18 09:27:39	1.24
@@ -61,7 +61,7 @@
 
 	if pgrep clvmd ; then
 		echo "Cannot use fake cluster locking with real clvmd ($(pgrep clvmd)) running."
-		exit 1
+		exit 200
 	fi
 
 	# skip if we don't have our own clvmd...


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2010-02-01 19:43 wysochanski
  0 siblings, 0 replies; 28+ messages in thread
From: wysochanski @ 2010-02-01 19:43 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-02-01 19:43:23

Modified files:
	test           : test-utils.sh 

Log message:
	Remove unnecessary "dmsetup resume" after "dmsetup create".
	
	It is not necessary to resume after a create since the create will
	create the table and make it active.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.18&r2=1.19

--- LVM2/test/test-utils.sh	2010/01/19 16:44:57	1.18
+++ LVM2/test/test-utils.sh	2010/02/01 19:43:22	1.19
@@ -59,7 +59,6 @@
 
 make_ioerror() {
 	echo 0 10000000 error | dmsetup create ioerror
-	dmsetup resume ioerror
 	ln -s $G_dev_/mapper/ioerror $G_dev_/ioerror
 }
 
@@ -188,7 +187,6 @@
 		devs="$devs $dev"
 		echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table
 		dmsetup create $name $name.table
-		dmsetup resume $name
 	done
 
     # set up some default names


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2009-05-13 19:18 wysochanski
  0 siblings, 0 replies; 28+ messages in thread
From: wysochanski @ 2009-05-13 19:18 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-05-13 19:18:47

Modified files:
	test           : test-utils.sh 

Log message:
	Update test-utils to cope with ":" in device names and allow configurable names.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.11&r2=1.12

--- LVM2/test/test-utils.sh	2009/04/24 08:00:48	1.11
+++ LVM2/test/test-utils.sh	2009/05/13 19:18:47	1.12
@@ -33,7 +33,7 @@
 	test -n "$PREFIX" && {
 		rm -rf $G_root_/dev/$PREFIX*
 		while dmsetup table | grep -q ^$PREFIX; do
-			for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do
+			for s in `dmsetup table | grep ^$PREFIX| awk '{ print substr($1,1,length($1)-1) }'`; do
 				dmsetup resume $s 2>/dev/null > /dev/null || true
 				dmsetup remove $s 2>/dev/null > /dev/null || true
 			done
@@ -99,6 +99,8 @@
 	test -z "$n" && n=3
 	local devsize="$2"
 	test -z "$devsize" && devsize=33
+	local pvname="$3"
+	test -z "$pvname" && pvname="pv"
 
 	prepare_loop $(($n*$devsize))
 
@@ -111,7 +113,7 @@
 	local size=$(($loopsz/$n))
 
 	for i in `seq 1 $n`; do
-		local name="${PREFIX}pv$i"
+		local name="${PREFIX}$pvname$i"
 		local dev="$G_dev_/mapper/$name"
 		eval "dev$i=$dev"
 		devs="$devs $dev"


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2009-04-24  8:00 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2009-04-24  8:00 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2009-04-24 08:00:48

Modified files:
	test           : test-utils.sh 

Log message:
	Avoid scanning non-PV devices in functional tests, otherwise lvconvert --repair
	breaks for some reason -- possibly needs investagation, but this should fix it
	in the meantime.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11

--- LVM2/test/test-utils.sh	2009/01/12 18:45:44	1.10
+++ LVM2/test/test-utils.sh	2009/04/24 08:00:48	1.11
@@ -179,7 +179,7 @@
   devices {
     dir = "$G_dev_"
     scan = "$G_dev_"
-    filter = [ "a/dev\/mirror/", "a/dev\/mapper/", "r/.*/" ]
+    filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ]
     cache_dir = "$G_root_/etc"
     sysfs_scan = 0
   }


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2008-12-10 16:16 zkabelac
  0 siblings, 0 replies; 28+ messages in thread
From: zkabelac @ 2008-12-10 16:16 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2008-12-10 16:16:54

Modified files:
	test           : test-utils.sh 

Log message:
	operate on test subdirectory instead on main /dev

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.7&r2=1.8

--- LVM2/test/test-utils.sh	2008/12/05 05:03:23	1.7
+++ LVM2/test/test-utils.sh	2008/12/10 16:16:53	1.8
@@ -33,7 +33,7 @@
 	echo $PREFIX
 
 	test -n "$PREFIX" && {
-		rm -rf /dev/$PREFIX*
+		rm -rf $G_root_/dev/$PREFIX*
 		while dmsetup table | grep -q ^$PREFIX; do
 			for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do
 				dmsetup resume $s 2>/dev/null > /dev/null || true
@@ -52,7 +52,7 @@
 make_ioerror() {
 	echo 0 10000000 error | dmsetup create ioerror
 	dmsetup resume ioerror
-	ln -s /dev/mapper/ioerror /dev/ioerror
+	ln -s $G_dev_/mapper/ioerror $G_dev_/ioerror
 }
 
 prepare_loop() {


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2008-12-05  5:03 wysochanski
  0 siblings, 0 replies; 28+ messages in thread
From: wysochanski @ 2008-12-05  5:03 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-12-05 05:03:24

Modified files:
	test           : test-utils.sh 

Log message:
	Fix test-utils.h for rhel4 backward compatability.
	
	for losetup, break out of the loop when successful setup of loop device,
	and only look at 7 loop devices (default loop module setting)
	for blockdev, use old option if new one is not available

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/test/test-utils.sh	2008/11/10 12:36:23	1.6
+++ LVM2/test/test-utils.sh	2008/12/05 05:03:23	1.7
@@ -73,15 +73,19 @@
 		return 0
 	else
 		# no -f support 
-		# Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
+		# Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7}
 		for slash in '' /; do
-			for i in 0 1 2 3 4 5 6 7 8 9; do
+			for i in 0 1 2 3 4 5 6 7; do
 				local dev=$G_dev_/loop$slash$i
 				! losetup $dev >/dev/null 2>&1 || continue
 				# got a free
 				losetup "$dev" "$LOOPFILE"
 				LOOP=$dev
+				break
 			done
+			if [ -n "$LOOP" ]; then 
+				break
+			fi
 		done
 		test -n "$LOOP" # confirm or fail
 		return 0
@@ -99,7 +103,10 @@
 
 	PREFIX="LVMTEST$$"
 
-	local loopsz=`blockdev --getsz $LOOP`
+	if ! loopsz=`blockdev --getsz $LOOP 2>/dev/null`; then
+  		loopsz=`blockdev --getsize $LOOP 2>/dev/null`
+	fi
+
 	local size=$(($loopsz/$n))
 
 	for i in `seq 1 $n`; do


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2008-11-10 12:36 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2008-11-10 12:36 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-11-10 12:36:23

Modified files:
	test           : test-utils.sh 

Log message:
	Use separate locking directory for each of the tests, as they never share a
	volume group, or physical devices for that matter. Hopefully fixes occasional
	test errors due to locking failures. Patch by jstava.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.5&r2=1.6

--- LVM2/test/test-utils.sh	2008/11/04 14:38:53	1.5
+++ LVM2/test/test-utils.sh	2008/11/10 12:36:23	1.6
@@ -170,6 +170,7 @@
   }
   global {
     library_dir = "$G_root_/lib"
+     locking_dir = "$G_root_/var/lock/lvm"
   }
 EOF
 }


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2008-11-04 14:38 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2008-11-04 14:38 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-11-04 14:38:53

Modified files:
	test           : test-utils.sh 

Log message:
	Fix typo.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/test/test-utils.sh	2008/10/14 19:48:01	1.4
+++ LVM2/test/test-utils.sh	2008/11/04 14:38:53	1.5
@@ -83,9 +83,10 @@
 				LOOP=$dev
 			done
 		done
-		test -n "LOOP" # confirm or fail
+		test -n "$LOOP" # confirm or fail
+		return 0
 	fi
-	exit 1 # should not be accesible
+	exit 1 # should not happen
 }
 
 prepare_devs() {


^ permalink raw reply	[flat|nested] 28+ messages in thread

* LVM2/test test-utils.sh
@ 2008-10-14 19:48 mornfall
  0 siblings, 0 replies; 28+ messages in thread
From: mornfall @ 2008-10-14 19:48 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-10-14 19:48:02

Modified files:
	test           : test-utils.sh 

Log message:
	Re-indent test-utils.sh consistently, using tabs.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4

--- LVM2/test/test-utils.sh	2008/10/06 16:55:30	1.3
+++ LVM2/test/test-utils.sh	2008/10/14 19:48:01	1.4
@@ -12,8 +12,8 @@
 . ./test-lib.sh
 
 aux() {
-    # use just "$@" for verbose operation
-    "$@" > /dev/null 2> /dev/null
+        # use just "$@" for verbose operation
+	"$@" > /dev/null 2> /dev/null
 	#"$@"
 }
 
@@ -29,37 +29,37 @@
 }	
 
 teardown() {
-    echo $LOOP
-    echo $PREFIX
+	echo $LOOP
+	echo $PREFIX
 
-    test -n "$PREFIX" && {
-	rm -rf /dev/$PREFIX*
-	while dmsetup table | grep -q ^$PREFIX; do
-            for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do
-		dmsetup resume $s 2>/dev/null > /dev/null || true
-		dmsetup remove $s 2>/dev/null > /dev/null || true
-            done
-	done
-    }
+	test -n "$PREFIX" && {
+		rm -rf /dev/$PREFIX*
+		while dmsetup table | grep -q ^$PREFIX; do
+			for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do
+				dmsetup resume $s 2>/dev/null > /dev/null || true
+				dmsetup remove $s 2>/dev/null > /dev/null || true
+			done
+		done
+	}
 
-    test -n "$LOOP" && losetup -d $LOOP
-    test -n "$LOOPFILE" && rm -f $LOOPFILE
+	test -n "$LOOP" && losetup -d $LOOP
+	test -n "$LOOPFILE" && rm -f $LOOPFILE
 
-    cleanup_ # user-overridable cleanup
-    testlib_cleanup_ # call test-lib cleanup routine, too
+	cleanup_ # user-overridable cleanup
+	testlib_cleanup_ # call test-lib cleanup routine, too
 }
 
 make_ioerror() {
-    echo 0 10000000 error | dmsetup create ioerror
-    dmsetup resume ioerror
-    ln -s /dev/mapper/ioerror /dev/ioerror
+	echo 0 10000000 error | dmsetup create ioerror
+	dmsetup resume ioerror
+	ln -s /dev/mapper/ioerror /dev/ioerror
 }
 
 prepare_loop() {
-    size=$1
-    test -n "$size" || size=32
+	size=$1
+	test -n "$size" || size=32
 
-    test -n "$LOOP" && return 0
+	test -n "$LOOP" && return 0
 	trap 'aux teardown' EXIT # don't forget to clean up
 	trap 'set +vex; STACKTRACE; set -vex' ERR
 	#trap - ERR
@@ -89,68 +89,68 @@
 }
 
 prepare_devs() {
-    local n="$1"
-    test -z "$n" && n=3
-    local devsize="$2"
-    test -z "$devsize" && devsize=33
-
-    prepare_loop $(($n*$devsize))
-
-    PREFIX="LVMTEST$$"
-
-    local loopsz=`blockdev --getsz $LOOP`
-    local size=$(($loopsz/$n))
-
-    for i in `seq 1 $n`; do
-	local name="${PREFIX}pv$i"
-	local dev="$G_dev_/mapper/$name"
-	eval "dev$i=$dev"
-	devs="$devs $dev"
-	echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table
-	dmsetup create $name $name.table
-	dmsetup resume $name
-    done
+	local n="$1"
+	test -z "$n" && n=3
+	local devsize="$2"
+	test -z "$devsize" && devsize=33
+
+	prepare_loop $(($n*$devsize))
+
+	PREFIX="LVMTEST$$"
+
+	local loopsz=`blockdev --getsz $LOOP`
+	local size=$(($loopsz/$n))
+
+	for i in `seq 1 $n`; do
+		local name="${PREFIX}pv$i"
+		local dev="$G_dev_/mapper/$name"
+		eval "dev$i=$dev"
+		devs="$devs $dev"
+		echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table
+		dmsetup create $name $name.table
+		dmsetup resume $name
+	done
 
     # set up some default names
-    vg=${PREFIX}vg
-    vg1=${PREFIX}vg1
-    vg2=${PREFIX}vg2
-    lv=LV
-    lv1=LV1
-    lv2=LV2
-    lv3=LV3
+	vg=${PREFIX}vg
+	vg1=${PREFIX}vg1
+	vg2=${PREFIX}vg2
+	lv=LV
+	lv1=LV1
+	lv2=LV2
+	lv3=LV3
 }
 
 disable_dev() {
-    for dev in "$@"; do
+	for dev in "$@"; do
         # first we make the device inaccessible
-	echo 0 10000000 error | dmsetup load $dev
-	dmsetup resume $dev
+		echo 0 10000000 error | dmsetup load $dev
+		dmsetup resume $dev
         # now let's try to get rid of it if it's unused
         #dmsetup remove $dev
-    done
+	done
 }
 
 enable_dev() {
-    for dev in "$@"; do
-	local name=`echo "$dev" | sed -e 's,.*/,,'`
-	dmsetup create $name $name.table || dmsetup load $name $name.table
-	dmsetup resume $dev
-    done
+	for dev in "$@"; do
+		local name=`echo "$dev" | sed -e 's,.*/,,'`
+		dmsetup create $name $name.table || dmsetup load $name $name.table
+		dmsetup resume $dev
+	done
 }
 
 prepare_pvs() {
-    prepare_devs "$@"
-    pvcreate $devs
+	prepare_devs "$@"
+	pvcreate $devs
 }
 
 prepare_vg() {
-    prepare_pvs "$@"
-    vgcreate $vg $devs
+	prepare_pvs "$@"
+	vgcreate $vg $devs
 }
 
 prepare_lvmconf() {
-  cat > $G_root_/etc/lvm.conf <<-EOF
+	cat > $G_root_/etc/lvm.conf <<-EOF
   devices {
     dir = "$G_dev_"
     scan = "$G_dev_"


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2010-12-09 11:19 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-27  7:59 LVM2/test test-utils.sh mbroz
  -- strict thread matches above, loose matches on Subject: below --
2010-12-09 11:19 mbroz
2010-10-26  1:25 snitzer
2010-10-12 16:13 mornfall
2010-08-27  8:52 mbroz
2010-08-02 13:18 zkabelac
2010-05-24 17:19 mbroz
2010-05-24 17:18 mbroz
2010-05-12 11:58 mornfall
2010-04-20 18:19 snitzer
2010-04-14 12:04 mornfall
2010-04-13  8:01 mornfall
2010-04-13  7:02 mornfall
2010-04-13  6:24 mornfall
2010-04-07 21:38 mornfall
2010-04-07 21:19 mornfall
2010-04-07 16:04 mornfall
2010-04-06 14:25 agk
2010-03-28 15:52 mornfall
2010-03-18  9:27 mornfall
2010-02-01 19:43 wysochanski
2009-05-13 19:18 wysochanski
2009-04-24  8:00 mornfall
2008-12-10 16:16 zkabelac
2008-12-05  5:03 wysochanski
2008-11-10 12:36 mornfall
2008-11-04 14:38 mornfall
2008-10-14 19:48 mornfall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).