CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-01-05 00:25:10 Modified files: test/lib : aux.sh Log message: Fix a couple of bugs in the new (test/lib/)aux.sh. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/test/lib/aux.sh 2011/01/05 00:16:21 1.1 +++ LVM2/test/lib/aux.sh 2011/01/05 00:25:07 1.2 @@ -43,7 +43,10 @@ fi # skip if we don't have our own dmeventd... - (which dmeventd | grep $abs_builddir) || exit 200 + (which dmeventd | grep $abs_builddir) || { + touch SKIP_THIS_TEST + exit 1 + } dmeventd -f & echo "$!" > LOCAL_DMEVENTD @@ -219,6 +222,7 @@ fi local size=$(($loopsz/$n)) + devs= init_udev_transaction for i in `seq 1 $n`; do
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-01-07 13:03:04 Modified files: test/lib : aux.sh Log message: In aux, exit 200 no longer works as skip -- replace with real skip call. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.2&r2=1.3 --- LVM2/test/lib/aux.sh 2011/01/05 00:25:07 1.2 +++ LVM2/test/lib/aux.sh 2011/01/07 13:03:04 1.3 @@ -10,6 +10,11 @@ . lib/utils +skip() { + touch SKIP_THIS_TEST + exit 1 +} + prepare_clvmd() { if test -z "$LVM_TEST_LOCKING" || test "$LVM_TEST_LOCKING" -ne 3 ; then return 0 # not needed @@ -17,22 +22,21 @@ if pgrep clvmd ; then echo "Cannot use fake cluster locking with real clvmd ($(pgrep clvmd)) running." - touch SKIP_THIS_TEST - exit 1 + skip fi # skip if we don't have our own clvmd... - (which clvmd | grep $abs_builddir) || exit 200 + (which clvmd | grep $abs_builddir) || skip # skip if we singlenode is not compiled in - (clvmd --help 2>&1 | grep "Available cluster managers" | grep singlenode) || exit 200 + (clvmd --help 2>&1 | grep "Available cluster managers" | grep singlenode) || skip clvmd -Isinglenode -d 1 & LOCAL_CLVMD="$!" # check that it is really running now sleep .1 - ps $LOCAL_CLVMD || exit 200 + ps $LOCAL_CLVMD || skip } prepare_dmeventd() { @@ -175,16 +179,16 @@ test -n "$DM_DEV_DIR" # Skip test if awk isn't available (required for get_sd_devs_) - which awk || exit 200 + which awk || skip # Skip test if scsi_debug module is unavailable or is already in use - modprobe --dry-run scsi_debug || exit 200 - lsmod | grep -q scsi_debug && exit 200 + modprobe --dry-run scsi_debug || skip + lsmod | grep -q scsi_debug && skip # Create the scsi_debug device and determine the new scsi device's name # 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 + modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1 || skip sleep 2 # allow for async Linux SCSI device registration local DEBUG_DEV=/dev/$(grep -H scsi_debug /sys/block/*/device/model | cut -f4 -d /) @@ -353,15 +357,12 @@ apitest() { t=$1 shift - test -x $abs_top_builddir/test/api/$t.t || { - touch SKIP_THIS_TEST - exit 200 - } + test -x $abs_top_builddir/test/api/$t.t || skip $abs_top_builddir/test/api/$t.t "$@" } api() { - test -x $abs_top_builddir/test/api/wrapper || exit 200 + test -x $abs_top_builddir/test/api/wrapper || skip $abs_top_builddir/test/api/wrapper "$@" }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-01-07 13:04:17 Modified files: test/lib : aux.sh Log message: Disable activation/monitoring in testing lvm.conf by default. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4 --- LVM2/test/lib/aux.sh 2011/01/07 13:03:04 1.3 +++ LVM2/test/lib/aux.sh 2011/01/07 13:04:17 1.4 @@ -52,7 +52,9 @@ exit 1 } - dmeventd -f & + lvmconf "activation/monitoring = 1" + + dmeventd -f "$@" & echo "$!" > LOCAL_DMEVENTD } @@ -335,6 +337,7 @@ activation/polling_interval = 0 activation/snapshot_autoextend_percent = 50 activation/snapshot_autoextend_threshold = 50 +activation/monitoring = 0 EOF }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-01-12 16:07:56 Modified files: test/lib : aux.sh Log message: Kill clvmd properly after locking_type 3 tests (using clvmd/singlenode). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/test/lib/aux.sh 2011/01/07 15:04:52 1.5 +++ LVM2/test/lib/aux.sh 2011/01/12 16:07:55 1.6 @@ -32,6 +32,7 @@ # check that it is really running now sleep .1 ps $LOCAL_CLVMD || skip + echo "$LOCAL_CLVMD" > LOCAL_CLVMD } prepare_dmeventd() { @@ -83,10 +84,10 @@ teardown() { echo -n "## teardown..." - test -n "$LOCAL_CLVMD" && { - kill "$LOCAL_CLVMD" + test -f LOCAL_CLVMD && { + kill "$(cat LOCAL_CLVMD)" sleep .1 - kill -9 "$LOCAL_CLVMD" || true + kill -9 "$(cat LOCAL_CLVMD)" || true } echo -n .
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-01-13 14:57:18 Modified files: test/lib : aux.sh Log message: Enable monitoring for cluster tests Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7 --- LVM2/test/lib/aux.sh 2011/01/12 16:07:55 1.6 +++ LVM2/test/lib/aux.sh 2011/01/13 14:57:18 1.7 @@ -26,6 +26,8 @@ # skip if we singlenode is not compiled in (clvmd --help 2>&1 | grep "Available cluster managers" | grep singlenode) || skip + lvmconf "activation/monitoring = 1" + clvmd -Isinglenode -d 1 & LOCAL_CLVMD="$!"
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-01-28 16:10:22 Modified files: test/lib : aux.sh Log message: Add command to wait for udevadm settle Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.7&r2=1.8 --- LVM2/test/lib/aux.sh 2011/01/13 14:57:18 1.7 +++ LVM2/test/lib/aux.sh 2011/01/28 16:10:21 1.8 @@ -1,3 +1,4 @@ +#!/bin/bash # Copyright (C) 2011 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, @@ -71,6 +72,7 @@ } + udev_wait # NOTE: SCSI_DEBUG_DEV test must come before the LOOP test because # prepare_scsi_debug_dev() also sets LOOP to short-circuit prepare_loop() if test -f SCSI_DEBUG_DEV; then @@ -367,6 +369,15 @@ $abs_top_builddir/test/api/wrapper "$@" } +udev_wait() { + pgrep udev >/dev/null || return + if test -n "$1" ; then + udevadm settle --exit-if-exists=$1 + else + udevadm settle --timeout=5 + fi +} + test -f DEVICES && devs=$(cat DEVICES) test -f LOOP && LOOP=$(cat LOOP)
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2011-03-01 22:28:27 Modified files: test/lib : aux.sh Log message: Fix tests if udevadm missing (old udev). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.8&r2=1.9 --- LVM2/test/lib/aux.sh 2011/01/28 16:10:21 1.8 +++ LVM2/test/lib/aux.sh 2011/03/01 22:28:27 1.9 @@ -371,6 +371,7 @@ udev_wait() { pgrep udev >/dev/null || return + which udevadm >/dev/null || return if test -n "$1" ; then udevadm settle --exit-if-exists=$1 else
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2011-03-01 23:44:08 Modified files: test/lib : aux.sh Log message: Rather return success if skipping udev wait. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.9&r2=1.10 --- LVM2/test/lib/aux.sh 2011/03/01 22:28:27 1.9 +++ LVM2/test/lib/aux.sh 2011/03/01 23:44:07 1.10 @@ -370,8 +370,8 @@ } udev_wait() { - pgrep udev >/dev/null || return - which udevadm >/dev/null || return + pgrep udev >/dev/null || return 0 + which udevadm >/dev/null || return 0 if test -n "$1" ; then udevadm settle --exit-if-exists=$1 else
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2011-03-04 14:19:18 Modified files: test/lib : aux.sh Log message: Wait until dmeventd properly starts in test. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/test/lib/aux.sh 2011/03/01 23:44:07 1.10 +++ LVM2/test/lib/aux.sh 2011/03/04 14:19:18 1.11 @@ -55,6 +55,9 @@ dmeventd -f "$@" & echo "$!" > LOCAL_DMEVENTD + + # FIXME wait for pipe in /var/run instead + sleep 1 } teardown_devs() {
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-28 00:11:46 Modified files: test/lib : aux.sh Log message: Selectively enable/disable udev rules. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.11&r2=1.12 --- LVM2/test/lib/aux.sh 2011/03/04 14:19:18 1.11 +++ LVM2/test/lib/aux.sh 2011/06/28 00:11:46 1.12 @@ -313,6 +313,11 @@ lvmconf() { if test -z "$LVM_TEST_LOCKING"; then LVM_TEST_LOCKING=1; fi + if test "$DM_DEV_DIR" = "/dev"; then + UDEV_RULES=1; + else + UDEV_RULES=0; + fi test -f CONFIG_VALUES || { cat > CONFIG_VALUES <<-EOF devices/dir = "$DM_DEV_DIR" @@ -336,7 +341,7 @@ global/si_unit_consistency = 1 global/fallback_to_local_locking = 0 activation/udev_sync = 1 -activation/udev_rules = 1 +activation/udev_rules = $UDEV_RULES activation/polling_interval = 0 activation/snapshot_autoextend_percent = 50 activation/snapshot_autoextend_threshold = 50
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-28 00:38:26 Modified files: test/lib : aux.sh Log message: Change to still sync with udev (to test waiting for rules) then to verify udev operations like it used to (which will perform them on systems with non-std dev dirs where test udev rules aren't installed). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.12&r2=1.13 --- LVM2/test/lib/aux.sh 2011/06/28 00:11:46 1.12 +++ LVM2/test/lib/aux.sh 2011/06/28 00:38:26 1.13 @@ -314,9 +314,9 @@ lvmconf() { if test -z "$LVM_TEST_LOCKING"; then LVM_TEST_LOCKING=1; fi if test "$DM_DEV_DIR" = "/dev"; then - UDEV_RULES=1; + VERIFY_UDEV=0; else - UDEV_RULES=0; + VERIFY_UDEV=1; fi test -f CONFIG_VALUES || { cat > CONFIG_VALUES <<-EOF @@ -341,7 +341,8 @@ global/si_unit_consistency = 1 global/fallback_to_local_locking = 0 activation/udev_sync = 1 -activation/udev_rules = $UDEV_RULES +activation/udev_rules = 1 +activation/verify_udev_operations = $VERIFY_UDEV activation/polling_interval = 0 activation/snapshot_autoextend_percent = 50 activation/snapshot_autoextend_threshold = 50
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-29 12:33:19 Modified files: test/lib : aux.sh Log message: use dmsetup remove -f as a better way of simulating a device "disappearing" Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.13&r2=1.14 --- LVM2/test/lib/aux.sh 2011/06/28 00:38:26 1.13 +++ LVM2/test/lib/aux.sh 2011/06/29 12:33:18 1.14 @@ -260,11 +260,7 @@ init_udev_transaction for dev in "$@"; do - # first we make the device inaccessible - 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 + dmsetup remove -f $dev done finish_udev_transaction
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-29 12:37:51 Modified files: test/lib : aux.sh Log message: Add uuids to dmsetup create cmds. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.14&r2=1.15 --- LVM2/test/lib/aux.sh 2011/06/29 12:33:18 1.14 +++ LVM2/test/lib/aux.sh 2011/06/29 12:37:51 1.15 @@ -116,7 +116,7 @@ } make_ioerror() { - echo 0 10000000 error | dmsetup create ioerror + echo 0 10000000 error | dmsetup create -u TEST-ioerror ioerror ln -s $DM_DEV_DIR/mapper/ioerror $DM_DEV_DIR/ioerror } @@ -239,7 +239,7 @@ local dev="$DM_DEV_DIR/mapper/$name" devs="$devs $dev" echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table - dmsetup create $name $name.table + dmsetup create -u TEST-$name $name $name.table done finish_udev_transaction @@ -271,7 +271,7 @@ init_udev_transaction for dev in "$@"; do local name=`echo "$dev" | sed -e 's,.*/,,'` - dmsetup create $name $name.table || dmsetup load $name $name.table + dmsetup create -u TEST-$name $name $name.table || dmsetup load $name $name.table dmsetup resume $dev done finish_udev_transaction
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-29 17:33:40 Modified files: test/lib : aux.sh Log message: remove any stray semaphores after tearing down devs Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.15&r2=1.16 --- LVM2/test/lib/aux.sh 2011/06/29 12:37:51 1.15 +++ LVM2/test/lib/aux.sh 2011/06/29 17:33:39 1.16 @@ -86,6 +86,9 @@ fi rm -f DEVICES # devs is set in prepare_devs() rm -f LOOP + + # Delete any remaining dm/udev semaphores + dmsetup udevcomplete_all -y } teardown() {
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-29 17:37:30 Modified files: test/lib : aux.sh Log message: print any loop devs that weren't torn down Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.16&r2=1.17 --- LVM2/test/lib/aux.sh 2011/06/29 17:33:39 1.16 +++ LVM2/test/lib/aux.sh 2011/06/29 17:37:30 1.17 @@ -89,6 +89,9 @@ # Delete any remaining dm/udev semaphores dmsetup udevcomplete_all -y + + # Display any loop devices that failed to get torn down + losetup -a } teardown() {
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-29 18:14:08 Modified files: test/lib : aux.sh Log message: teardown aborts if it hits an error, so better teardown semaphores earlier as we need them later in the teardown process Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.17&r2=1.18 --- LVM2/test/lib/aux.sh 2011/06/29 17:37:30 1.17 +++ LVM2/test/lib/aux.sh 2011/06/29 18:14:08 1.18 @@ -61,6 +61,9 @@ } teardown_devs() { + # Delete any remaining dm/udev semaphores + dmsetup udevcomplete_all -y + test -n "$PREFIX" && { rm -rf $TESTDIR/dev/$PREFIX* @@ -87,9 +90,6 @@ rm -f DEVICES # devs is set in prepare_devs() rm -f LOOP - # Delete any remaining dm/udev semaphores - dmsetup udevcomplete_all -y - # Display any loop devices that failed to get torn down losetup -a }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-30 01:17:38 Modified files: test/lib : aux.sh Log message: Try to remove any stray loop devices left behind by earlier aborted tests. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.20&r2=1.21 --- LVM2/test/lib/aux.sh 2011/06/30 00:57:29 1.20 +++ LVM2/test/lib/aux.sh 2011/06/30 01:17:37 1.21 @@ -90,10 +90,13 @@ rm -f DEVICES # devs is set in prepare_devs() rm -f LOOP - # Remove any loop devices that failed to get torn down - losetup -a - echo losetup -d `losetup -a | grep $COMMON_PREFIX | cut -d: -f1` 2>/dev/null || true - losetup -a + # Remove any loop devices that failed to get torn down if earlier tests aborted + STRAY_LOOPS=`losetup -a | grep $COMMON_PREFIX | cut -d: -f1` + if test -n "$STRAY_LOOPS"; then + echo "Removing stray loop devices containing $COMMON_PREFIX:" + losetup -a | grep $COMMON_PREFIX + losetup -d $STRAY_LOOPS 2>/dev/null || true + fi } teardown() {
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2011-06-30 08:50:10 Modified files: test/lib : aux.sh Log message: Try to force remove dm devices in after test fails. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.21&r2=1.22 --- LVM2/test/lib/aux.sh 2011/06/30 01:17:37 1.21 +++ LVM2/test/lib/aux.sh 2011/06/30 08:50:10 1.22 @@ -90,6 +90,27 @@ rm -f DEVICES # devs is set in prepare_devs() rm -f LOOP + # Try to remove test devices + # resume any linears to be sure we do not deadlock + STRAY_DEVS=$(dmsetup table | grep linear | sed 's/:.*//' | grep $COMMON_PREFIX | cut -d' ' -f 1) + for dm in $STRAY_DEVS ; do + # FIXME: only those really suspended + dmsetup resume $dm 2>/dev/null + done + + # Now try to remove devices + finish=0 + while [ $finish -eq 0 ] ; do + finish=1 + STRAY_DEVS=$(dmsetup table | sed 's/:.*//' | grep $COMMON_PREFIX | cut -d' ' -f 1) + for dm in $STRAY_DEVS ; do + echo "Trying to remove stalled $dm" + dmsetup remove $dm 2>/dev/null + # Sucessful remove means repeat the loop once more + [ $? -eq 0 ] && finish=0 + done + done + # Remove any loop devices that failed to get torn down if earlier tests aborted STRAY_LOOPS=`losetup -a | grep $COMMON_PREFIX | cut -d: -f1` if test -n "$STRAY_LOOPS"; then
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-06-30 09:08:22 Modified files: test/lib : aux.sh Log message: Use -f to remove device Since some test may leave devices in suspend mode which would require carefull order of resume operation - use '-f' to replace them with error targets For disable_dev - when 'error' target is used for open count - treat return code as ok (|| true) to avoid breaking futher test processing. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.22&r2=1.23 --- LVM2/test/lib/aux.sh 2011/06/30 08:50:10 1.22 +++ LVM2/test/lib/aux.sh 2011/06/30 09:08:22 1.23 @@ -71,7 +71,7 @@ while dmsetup table | grep -q ^$PREFIX; do for s in `dmsetup info -c -o name --noheading | grep ^$PREFIX`; do umount -fl $DM_DEV_DIR/mapper/$s >& /dev/null || true - dmsetup remove $s >& /dev/null || true + dmsetup remove -f $s >& /dev/null || true done done finish_udev_transaction @@ -292,7 +292,7 @@ init_udev_transaction for dev in "$@"; do - dmsetup remove -f $dev + dmsetup remove -f $dev || true done finish_udev_transaction
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-06-30 09:17:49 Modified files: test/lib : aux.sh Log message: use remove -f Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/test/lib/aux.sh 2011/06/30 09:15:53 1.24 +++ LVM2/test/lib/aux.sh 2011/06/30 09:17:49 1.25 @@ -117,7 +117,7 @@ dmsetup info -c | grep ^$COMMON_PREFIX for dm in $STRAY_DEVS ; do echo dmsetup remove $dm - dmsetup remove $dm || true + dmsetup remove -f $dm || true done NUM_REMAINING_DEVS=$NUM_DEVS done
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-07-08 10:05:43 Modified files: test/lib : aux.sh Log message: Increase timeout for udev settle For some unknown reason (atm) udev settle takes longer time on recent rawhide. To pass the test - inrease the settle timeout. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.26&r2=1.27 --- LVM2/test/lib/aux.sh 2011/07/01 14:09:20 1.26 +++ LVM2/test/lib/aux.sh 2011/07/08 10:05:43 1.27 @@ -426,7 +426,7 @@ if test -n "$1" ; then udevadm settle --exit-if-exists=$1 else - udevadm settle --timeout=5 + udevadm settle --timeout=15 fi }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-09-24 21:15:14 Modified files: test/lib : aux.sh Log message: Allow overwrite for VERIFY_UDEV When running tests it might be useful to have an override option when testing on real /dev and some broken system (i.e. Debian and its rules). So one can use: LVM_TEST_DEVDIR=/dev LVM_VERIFY_UDEV=1 make check Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.30&r2=1.31 --- LVM2/test/lib/aux.sh 2011/09/24 20:54:36 1.30 +++ LVM2/test/lib/aux.sh 2011/09/24 21:15:13 1.31 @@ -371,9 +371,9 @@ lvmconf() { if test -z "$LVM_TEST_LOCKING"; then LVM_TEST_LOCKING=1; fi if test "$DM_DEV_DIR" = "/dev"; then - VERIFY_UDEV=0; + LVM_VERIFY_UDEV=${LVM_VERIFY_UDEV:-0}; else - VERIFY_UDEV=1; + LVM_VERIFY_UDEV=${LVM_VERIFY_UDEV:-1}; fi test -f CONFIG_VALUES || { cat > CONFIG_VALUES <<-EOF @@ -401,7 +401,7 @@ activation/checks = 1 activation/udev_sync = 1 activation/udev_rules = 1 -activation/verify_udev_operations = $VERIFY_UDEV +activation/verify_udev_operations = $LVM_VERIFY_UDEV activation/polling_interval = 0 activation/snapshot_autoextend_percent = 50 activation/snapshot_autoextend_threshold = 50
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-10-23 15:40:15 Modified files: test/lib : aux.sh Log message: Do not make link in the real /dev Skip trying to make link when real /dev dir is used for test. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.31&r2=1.32 --- LVM2/test/lib/aux.sh 2011/09/24 21:15:13 1.31 +++ LVM2/test/lib/aux.sh 2011/10/23 15:40:15 1.32 @@ -265,7 +265,7 @@ echo "$SCSI_DEBUG_DEV" > SCSI_DEBUG_DEV echo "$SCSI_DEBUG_DEV" > LOOP # Setting $LOOP provides means for prepare_devs() override - ln -snf $DEBUG_DEV $SCSI_DEBUG_DEV + test "$LVM_TEST_DEVDIR" != "/dev" && ln -snf $DEBUG_DEV $SCSI_DEBUG_DEV return 0 }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-10-23 15:43:10 Modified files: test/lib : aux.sh Log message: Used device name instead of device path Udev is tricky here - since with udev the node does not exists until it resume happens. So we need to resume devices via its name. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.32&r2=1.33 --- LVM2/test/lib/aux.sh 2011/10/23 15:40:15 1.32 +++ LVM2/test/lib/aux.sh 2011/10/23 15:43:10 1.33 @@ -333,7 +333,8 @@ for dev in "$@"; do local name=`echo "$dev" | sed -e 's,.*/,,'` dmsetup create -u TEST-$name $name $name.table || dmsetup load $name $name.table - dmsetup resume $dev + # using device name (since device path does not exists yes with udev) + dmsetup resume $name done finish_udev_transaction }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@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)
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-12-12 00:01:13 Modified files: test/lib : aux.sh Log message: Use a more canonic regex escaping in the default lvm.conf file for testing. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.34&r2=1.35 --- LVM2/test/lib/aux.sh 2011/11/10 12:44:00 1.34 +++ LVM2/test/lib/aux.sh 2011/12/12 00:01:12 1.35 @@ -380,7 +380,7 @@ cat > CONFIG_VALUES <<-EOF devices/dir = "$DM_DEV_DIR" devices/scan = "$DM_DEV_DIR" -devices/filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ] +devices/filter = [ "a/dev\\\\/mirror/", "a/dev\\\\/mapper\\\\/.*pv[0-9_]*$/", "r/.*/" ] devices/cache_dir = "$TESTDIR/etc" devices/sysfs_scan = 0 devices/default_data_alignment = 1
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-01-26 18:25:47 Modified files: test/lib : aux.sh Log message: If clvmd is not started, die test instead of skipping it Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.35&r2=1.36 --- LVM2/test/lib/aux.sh 2011/12/12 00:01:12 1.35 +++ LVM2/test/lib/aux.sh 2012/01/26 18:25:46 1.36 @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2011 Red Hat, Inc. All rights reserved. +# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions @@ -34,8 +34,8 @@ # check that it is really running now sleep .1 - ps $LOCAL_CLVMD || skip - echo "$LOCAL_CLVMD" > LOCAL_CLVMD + ps $LOCAL_CLVMD || die + echo "$LOCAL_CLVMD" > LOCAL_CLVMD } prepare_dmeventd() {
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2012-03-06 02:54:31 Modified files: test/lib : aux.sh Log message: Change pvscan --cache syntax Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.40&r2=1.41 --- LVM2/test/lib/aux.sh 2012/03/02 18:09:47 1.40 +++ LVM2/test/lib/aux.sh 2012/03/06 02:54:31 1.41 @@ -334,7 +334,7 @@ min=$(($(stat --printf=0x%T $dev))) echo "disabling device $dev ($maj:$min)" dmsetup remove -f $dev || true - notify_lvmetad $maj:$min + notify_lvmetad --major $maj --minor $min done finish_udev_transaction
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-16 12:56:29 Modified files: test/lib : aux.sh Log message: Allow to use also special prefixed names for test Currently we could not test special prefixes in our test suite. As teardown will not find such device and basicaly busyloops here, as at cannot remove such names. This patch adds possibity to use: vgcreate V_$vg1 $dev Note: you still need to use $PREFIX somewhere in the name. (And of course, it's really bad idea to use $PREFIX (=LVMTEST) for normally used LVs) The only purpose of this patch is to allow testing cluster with special vg names that begins with V_ , P_.... Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.41&r2=1.42 --- LVM2/test/lib/aux.sh 2012/03/06 02:54:31 1.41 +++ LVM2/test/lib/aux.sh 2012/03/16 12:56:29 1.42 @@ -92,8 +92,8 @@ rm -rf $TESTDIR/dev/$PREFIX* init_udev_transaction - while dmsetup table | grep -q ^$PREFIX; do - for s in `dmsetup info -c -o name --noheading | grep ^$PREFIX`; do + while dmsetup table | grep -q $PREFIX; do + for s in `dmsetup info -c -o name --noheading | grep $PREFIX`; do umount -fl $DM_DEV_DIR/mapper/$s >& /dev/null || true dmsetup remove -f $s >& /dev/null || true done
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-16 12:57:28 Modified files: test/lib : aux.sh Log message: Test suite skip md_detection Not normally needed - lets' enable it only for test that really needs it. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.42&r2=1.43 --- LVM2/test/lib/aux.sh 2012/03/16 12:56:29 1.42 +++ LVM2/test/lib/aux.sh 2012/03/16 12:57:28 1.43 @@ -398,6 +398,7 @@ devices/cache_dir = "$TESTDIR/etc" devices/sysfs_scan = 0 devices/default_data_alignment = 1 +devices/md_component_detection = 0 log/syslog = 0 log/indent = 1 log/level = 9
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-16 13:44:52 Modified files: test/lib : aux.sh Log message: Switch condition for dmeventd check Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.44&r2=1.45 --- LVM2/test/lib/aux.sh 2012/03/16 12:59:02 1.44 +++ LVM2/test/lib/aux.sh 2012/03/16 13:44:51 1.45 @@ -197,7 +197,7 @@ echo "ok" - test -z "$RUNNING_DMEVENTD" && not pgrep dmeventd &>/dev/null + test -n "$RUNNING_DMEVENTD" || not pgrep dmeventd &>/dev/null } make_ioerror() {
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-16 19:08:09 Modified files: test/lib : aux.sh Log message: Longer sleep after clvmd start Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.45&r2=1.46 --- LVM2/test/lib/aux.sh 2012/03/16 13:44:51 1.45 +++ LVM2/test/lib/aux.sh 2012/03/16 19:08:09 1.46 @@ -36,7 +36,7 @@ test -z "$LVM_VALGRIND_CLVMD" || run_valgrind="run_valgrind" $run_valgrind lib/clvmd -Isinglenode -d 1 -f & local local_clvmd=$! - sleep .1 + sleep .3 # extra sleep for slow valgrind test -z "$LVM_VALGRIND_CLVMD" || sleep 5 # check that it is really running now @@ -176,7 +176,7 @@ kill -INT "$(cat LOCAL_CLVMD)" test -z "$LVM_VALGRIND_CLVMD" || sleep 1 sleep .1 - kill -9 "$(cat LOCAL_CLVMD)" || true + kill -9 "$(cat LOCAL_CLVMD)" &>/dev/null || true } echo -n . @@ -288,7 +288,7 @@ } cleanup_scsi_debug_dev() { - aux teardown_devs + teardown_devs rm -f SCSI_DEBUG_DEV LOOP }
CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-23 09:41:20 Modified files: test/lib : aux.sh Log message: Improve teardown_devs Try to avoid start of dmeventd during vgremove if the code has any bug inside. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.47&r2=1.48 --- LVM2/test/lib/aux.sh 2012/03/20 10:51:57 1.47 +++ LVM2/test/lib/aux.sh 2012/03/23 09:41:20 1.48 @@ -102,11 +102,6 @@ fi fi - if test "$stray" -eq 0; then - dmsetup table | not egrep -q "$vg|$vg1|$vg2|$vg3|$vg4" || \ - vgremove -ff $vg $vg1 $vg2 $vg3 $vg4 &>/dev/null || rm -f debug.log - fi - # Remove devices, start with closed (sorted by open count) local remfail=no local need_udev_wait=0 @@ -166,7 +161,14 @@ teardown() { echo -n "## teardown..." - test -f LOCAL_CLVMD && { + dmsetup table | not egrep -q "$vg|$vg1|$vg2|$vg3|$vg4" || { + # Avoid activation of dmeventd if there is no pid + cfg=$(test -s LOCAL_DMEVENTD || echo "--config 'activation { monitoring = 0 }'") + vgremove -ff $cfg \ + $vg $vg1 $vg2 $vg3 $vg4 &>/dev/null || rm -f debug.log + } + + test -s LOCAL_CLVMD && { kill -INT "$(cat LOCAL_CLVMD)" test -z "$LVM_VALGRIND_CLVMD" || sleep 1 sleep .1 @@ -176,8 +178,8 @@ echo -n . pgrep dmeventd || true - test -f LOCAL_DMEVENTD && kill -9 $(cat LOCAL_DMEVENTD) || true - test -f LOCAL_LVMETAD && kill -9 $(cat LOCAL_LVMETAD) || true + test ! -s LOCAL_DMEVENTD || kill -9 "$(cat LOCAL_DMEVENTD)" || true + test ! -s LOCAL_LVMETAD || kill -9 "$(cat LOCAL_LVMETAD)" || true echo -n .