mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
tests: add wipefs wrapper
which falls back to using dd on old systems without the wipefs command
This commit is contained in:
parent
c2ff8876f9
commit
d693041149
@ -797,6 +797,17 @@ wait_md_create() {
|
||||
echo "$md" > WAIT_MD_DEV
|
||||
}
|
||||
|
||||
wipefs_a() {
|
||||
local dev=$1
|
||||
shift
|
||||
|
||||
if wipefs -V >/dev/null; then
|
||||
wipefs -a "$dev"
|
||||
else
|
||||
dd if=/dev/zero of="$dev" bs=1024 || true
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_backing_dev() {
|
||||
local size=${1=32}
|
||||
shift
|
||||
|
@ -15,7 +15,6 @@ SKIP_WITH_LVMPOLLD=1
|
||||
. lib/inittest
|
||||
|
||||
losetup -h | grep sector-size || skip
|
||||
wipefs -V || skip
|
||||
|
||||
dd if=/dev/zero of=loopa bs=$((1024*1024)) count=2 2> /dev/null
|
||||
dd if=/dev/zero of=loopb bs=$((1024*1024)) count=2 2> /dev/null
|
||||
@ -32,8 +31,8 @@ not vgcreate --config 'devices {allow_mixed_block_sizes=0 scan="/dev"}' $vg $LOO
|
||||
vgcreate --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg $LOOP1 $LOOP2
|
||||
vgs --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg
|
||||
|
||||
wipefs -a $LOOP1
|
||||
wipefs -a $LOOP2
|
||||
aux wipefs_a $LOOP1
|
||||
aux wipefs_a $LOOP2
|
||||
|
||||
vgcreate --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg $LOOP1
|
||||
vgs --config 'devices {allow_mixed_block_sizes=1 scan="/dev"}' $vg
|
||||
|
@ -28,8 +28,6 @@ _clear_online_files() {
|
||||
|
||||
. lib/inittest
|
||||
|
||||
wipefs -V || skip
|
||||
|
||||
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
|
||||
modprobe raid0 || skip
|
||||
|
||||
@ -125,8 +123,8 @@ vgchange -an $vg
|
||||
vgremove -f $vg
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -197,8 +195,8 @@ vgchange -an $vg
|
||||
vgremove -f $vg
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -253,8 +251,8 @@ pvscan --cache -aay "$dev2"
|
||||
not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
|
||||
not ls "$RUNDIR/lvm/vgs_online/$vg"
|
||||
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
##########################################
|
||||
@ -311,8 +309,8 @@ not ls "$RUNDIR/lvm/vgs_online/$vg"
|
||||
lvs -o active $vg |tee out || true
|
||||
not grep "active" out
|
||||
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -372,8 +370,8 @@ cat /proc/mdstat
|
||||
# for some reason enabling dev2 starts an odd md dev
|
||||
mdadm --stop "$mddev" || true
|
||||
cat /proc/mdstat
|
||||
wipefs -a "$dev1" || true
|
||||
wipefs -a "$dev2" || true
|
||||
aux wipefs_a "$dev1" || true
|
||||
aux wipefs_a "$dev2" || true
|
||||
aux udev_wait
|
||||
|
||||
##########################################
|
||||
@ -437,6 +435,6 @@ cat /proc/mdstat
|
||||
# for some reason enabling dev2 starts an odd md dev
|
||||
mdadm --stop "$mddev" || true
|
||||
cat /proc/mdstat
|
||||
wipefs -a "$dev1" || true
|
||||
wipefs -a "$dev2" || true
|
||||
aux wipefs_a "$dev1" || true
|
||||
aux wipefs_a "$dev2" || true
|
||||
aux udev_wait
|
||||
|
@ -33,8 +33,6 @@ _clear_online_files() {
|
||||
|
||||
. lib/inittest
|
||||
|
||||
wipefs -V || skip
|
||||
|
||||
test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
|
||||
modprobe raid1 || skip
|
||||
|
||||
@ -130,8 +128,8 @@ vgchange -an $vg
|
||||
vgremove -f $vg
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -216,8 +214,8 @@ vgchange -an $vg
|
||||
vgremove -f $vg
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -272,8 +270,8 @@ pvscan --cache -aay "$dev2"
|
||||
not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
|
||||
not ls "$RUNDIR/lvm/vgs_online/$vg"
|
||||
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -340,8 +338,8 @@ not pvscan --cache -aay "$dev1"
|
||||
ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
|
||||
ls "$RUNDIR/lvm/vgs_online/$vg"
|
||||
|
||||
wipefs -a "$dev1" || true
|
||||
wipefs -a "$dev2" || true
|
||||
aux wipefs_a "$dev1" || true
|
||||
aux wipefs_a "$dev2" || true
|
||||
|
||||
|
||||
##########################################
|
||||
@ -419,8 +417,8 @@ cat /proc/mdstat
|
||||
# for some reason enabling dev2 starts an odd md dev
|
||||
mdadm --stop "$mddev" || true
|
||||
cat /proc/mdstat
|
||||
wipefs -a "$dev1" || true
|
||||
wipefs -a "$dev2" || true
|
||||
aux wipefs_a "$dev1" || true
|
||||
aux wipefs_a "$dev2" || true
|
||||
|
||||
##########################################
|
||||
# PV on an md raid1 device, auto+stopped
|
||||
@ -483,8 +481,8 @@ cat /proc/mdstat
|
||||
# for some reason enabling dev2 starts an odd md dev
|
||||
mdadm --stop "$mddev" || true
|
||||
cat /proc/mdstat
|
||||
wipefs -a "$dev1" || true
|
||||
wipefs -a "$dev2" || true
|
||||
aux wipefs_a "$dev1" || true
|
||||
aux wipefs_a "$dev2" || true
|
||||
|
||||
|
||||
##########################################
|
||||
@ -545,9 +543,9 @@ pvscan --cache -aay "$dev4"
|
||||
not ls "$RUNDIR/lvm/pvs_online/$PVIDMD"
|
||||
not ls "$RUNDIR/lvm/vgs_online/$vg"
|
||||
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
wipefs -a "$dev4"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux wipefs_a "$dev4"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -621,7 +619,7 @@ cat /proc/mdstat
|
||||
# for some reason enabling dev2 starts an odd md dev
|
||||
mdadm --stop "$mddev" || true
|
||||
cat /proc/mdstat
|
||||
wipefs -a "$dev1" || true
|
||||
wipefs -a "$dev2" || true
|
||||
wipefs -a "$dev4" || true
|
||||
aux wipefs_a "$dev1" || true
|
||||
aux wipefs_a "$dev2" || true
|
||||
aux wipefs_a "$dev4" || true
|
||||
|
||||
|
@ -28,8 +28,6 @@ _clear_online_files() {
|
||||
|
||||
. lib/inittest
|
||||
|
||||
wipefs -V || skip
|
||||
|
||||
test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
|
||||
modprobe raid1 || skip
|
||||
|
||||
@ -168,8 +166,8 @@ vgremove -f $vg
|
||||
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -293,8 +291,8 @@ vgremove -f $vg
|
||||
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
||||
@ -461,7 +459,7 @@ vgremove -f $vg
|
||||
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
|
@ -18,8 +18,6 @@ SKIP_WITH_LVMPOLLD=1
|
||||
# skip this test if mdadm or sfdisk (or others) aren't available
|
||||
which sfdisk || skip
|
||||
|
||||
wipefs -V || skip
|
||||
|
||||
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
|
||||
modprobe raid0 || skip
|
||||
mddev="/dev/md33"
|
||||
@ -115,8 +113,8 @@ fi
|
||||
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
# Test newer topology-aware alignment detection w/ --dataalignment override
|
||||
@ -142,8 +140,8 @@ if aux kernel_at_least 2 6 33 ; then
|
||||
|
||||
mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipefs -a "$dev1"
|
||||
wipefs -a "$dev2"
|
||||
aux wipefs_a "$dev1"
|
||||
aux wipefs_a "$dev2"
|
||||
aux udev_wait
|
||||
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user