[PATCH] reflect renaming: dm-utils.sh -> lvm-utils.sh

Jim Meyering meyering at redhat.com
Fri Jun 6 07:42:52 UTC 2008


* tests/test-lib.sh: s/dm-utils.sh/lvm-utils.sh/
* tests/dm-utils.sh: Rename this...
* tests/lvm-utils.sh: ...to this.
---
 tests/dm-utils.sh  |  142 ------------------------------------------------=
----
 tests/lvm-utils.sh |  142 ++++++++++++++++++++++++++++++++++++++++++++++++=
++++
 tests/test-lib.sh  |    2 +-
 3 files changed, 143 insertions(+), 143 deletions(-)
 delete mode 100644 tests/dm-utils.sh
 create mode 100644 tests/lvm-utils.sh

diff --git a/tests/dm-utils.sh b/tests/dm-utils.sh
deleted file mode 100644
index 2aba445..0000000
--- a/tests/dm-utils.sh
+++ /dev/null
@@ -1,142 +0,0 @@
-# Put lvm-related utilities here.
-# This file is sourced from test-lib.sh.
-
-# Copyright (C) 2007, 2008 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
-# of the GNU General Public License v.2.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-export LVM_SUPPRESS_FD_WARNINGS=3D1
-
-ME=3D$(basename "$0")
-warn() { echo >&2 "$ME: $@"; }
-
-unsafe_losetup_()
-{
-  f=3D$1
-
-  test -n "$G_dev_" \
-    || error "Internal error: unsafe_losetup_ called before init_root_dir_"
-
-  # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
-  for slash in '' /; do
-    for i in 0 1 2 3 4 5 6 7 8 9; do
-      dev=3D$G_dev_/loop$slash$i
-      losetup $dev > /dev/null 2>&1 && continue;
-      losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
-      break
-    done
-  done
-
-  return 1
-}
-
-loop_setup_()
-{
-  file=3D$1
-  dd if=3D/dev/zero of=3D"$file" bs=3D1M count=3D1 seek=3D1000 > /dev/null=
 2>&1 \
-    || { warn "loop_setup_ failed: Unable to create tmp file $file"; retur=
n 1; }
-
-  # NOTE: this requires a new enough version of losetup
-  dev=3D$(unsafe_losetup_ "$file" 2>/dev/null) \
-    || { warn "loop_setup_ failed: Unable to create loopback device"; retu=
rn 1; }
-
-  echo "$dev"
-  return 0;
-}
-
-compare_vg_field_()
-{
-if test "$verbose" =3D "t"
-then
-  echo "compare_vg_field_ VG1: `vgs --noheadings -o $3 $1` VG2: `vgs --noh=
eadings -o $3 $2`"
-fi
-  return $(test $(vgs --noheadings -o $3 $1) =3D=3D $(vgs --noheadings -o =
$3 $2) )
-}
-
-check_vg_field_()
-{
-if test "$verbose" =3D "t"
-then
-  echo "check_vg_field_ VG=3D$1, field=3D$2, actual=3D`vgs --noheadings -o=
 $2 $1`, expected=3D$3"
-fi
-  return $(test $(vgs --noheadings -o $2 $1) =3D=3D $3)
-}
-
-check_pv_field_()
-{
-if test "$verbose" =3D "t"
-then
-  echo "check_pv_field_ PV=3D$1, field=3D$2, actual=3D`pvs --noheadings -o=
 $2 $1`, expected=3D$3"
-fi
-  return $(test $(pvs --noheadings -o $2 $1) =3D=3D $3)
-}
-
-check_lv_field_()
-{
-if test "$verbose" =3D "t"
-then
-  echo "check_lv_field_ LV=3D$1, field=3D$2, actual=3D`lvs --noheadings -o=
 $2 $1`, expected=3D$3"
-fi
-  return $(test $(lvs --noheadings -o $2 $1) =3D=3D $3)
-}
-
-vg_validate_pvlv_counts_()
-{
-	local local_vg=3D$1
-	local num_pvs=3D$2
-	local num_lvs=3D$3
-	local num_snaps=3D$4
-
-	check_vg_field_ $local_vg pv_count $num_pvs &&
-	check_vg_field_ $local_vg lv_count $num_lvs &&
-	check_vg_field_ $local_vg snap_count $num_snaps
-}
-
-dmsetup_has_dm_devdir_support_()
-{
-  # Detect support for the envvar.  If it's supported, the
-  # following command will fail with the expected diagnostic.
-  out=3D$(DM_DEV_DIR=3Dj dmsetup version 2>&1)
-  test "$?:$out" =3D "1:Invalid DM_DEV_DIR envvar value." -o \
-       "$?:$out" =3D "1:Invalid DM_DEV_DIR environment variable value."
-}
-
-# set up private /dev and /etc
-init_root_dir_()
-{
-  test -n "$test_dir_rand_" \
-    || error "Internal error: called init_root_dir_ before" \
-      "defining \$test_dir_rand_"
-
-  # Define these two globals.
-  G_root_=3D$test_dir_rand_/root
-  G_dev_=3D$G_root_/dev
-
-  export LVM_SYSTEM_DIR=3D$G_root_/etc
-  export DM_DEV_DIR=3D$G_dev_
-
-  # Only the first caller does anything.
-  mkdir -p $G_root_/etc $G_dev_ $G_dev_/mapper
-  for i in 0 1 2 3 4 5 6 7; do
-    mknod $G_root_/dev/loop$i b 7 $i
-  done
-  cat > $G_root_/etc/lvm.conf <<-EOF
-  devices {
-    dir =3D "$G_dev_"
-    scan =3D "$G_dev_"
-    filter =3D [ "a/loop/", "a/mirror/", "a/mapper/", "r/.*/" ]
-    cache_dir =3D "$G_root_/etc"
-    sysfs_scan =3D 0
-  }
-EOF
-}
-
-if test $(this_test_) !=3D 000-basic; then
-  init_root_dir_
-fi
diff --git a/tests/lvm-utils.sh b/tests/lvm-utils.sh
new file mode 100644
index 0000000..2aba445
--- /dev/null
+++ b/tests/lvm-utils.sh
@@ -0,0 +1,142 @@
+# Put lvm-related utilities here.
+# This file is sourced from test-lib.sh.
+
+# Copyright (C) 2007, 2008 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+export LVM_SUPPRESS_FD_WARNINGS=3D1
+
+ME=3D$(basename "$0")
+warn() { echo >&2 "$ME: $@"; }
+
+unsafe_losetup_()
+{
+  f=3D$1
+
+  test -n "$G_dev_" \
+    || error "Internal error: unsafe_losetup_ called before init_root_dir_"
+
+  # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
+  for slash in '' /; do
+    for i in 0 1 2 3 4 5 6 7 8 9; do
+      dev=3D$G_dev_/loop$slash$i
+      losetup $dev > /dev/null 2>&1 && continue;
+      losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
+      break
+    done
+  done
+
+  return 1
+}
+
+loop_setup_()
+{
+  file=3D$1
+  dd if=3D/dev/zero of=3D"$file" bs=3D1M count=3D1 seek=3D1000 > /dev/null=
 2>&1 \
+    || { warn "loop_setup_ failed: Unable to create tmp file $file"; retur=
n 1; }
+
+  # NOTE: this requires a new enough version of losetup
+  dev=3D$(unsafe_losetup_ "$file" 2>/dev/null) \
+    || { warn "loop_setup_ failed: Unable to create loopback device"; retu=
rn 1; }
+
+  echo "$dev"
+  return 0;
+}
+
+compare_vg_field_()
+{
+if test "$verbose" =3D "t"
+then
+  echo "compare_vg_field_ VG1: `vgs --noheadings -o $3 $1` VG2: `vgs --noh=
eadings -o $3 $2`"
+fi
+  return $(test $(vgs --noheadings -o $3 $1) =3D=3D $(vgs --noheadings -o =
$3 $2) )
+}
+
+check_vg_field_()
+{
+if test "$verbose" =3D "t"
+then
+  echo "check_vg_field_ VG=3D$1, field=3D$2, actual=3D`vgs --noheadings -o=
 $2 $1`, expected=3D$3"
+fi
+  return $(test $(vgs --noheadings -o $2 $1) =3D=3D $3)
+}
+
+check_pv_field_()
+{
+if test "$verbose" =3D "t"
+then
+  echo "check_pv_field_ PV=3D$1, field=3D$2, actual=3D`pvs --noheadings -o=
 $2 $1`, expected=3D$3"
+fi
+  return $(test $(pvs --noheadings -o $2 $1) =3D=3D $3)
+}
+
+check_lv_field_()
+{
+if test "$verbose" =3D "t"
+then
+  echo "check_lv_field_ LV=3D$1, field=3D$2, actual=3D`lvs --noheadings -o=
 $2 $1`, expected=3D$3"
+fi
+  return $(test $(lvs --noheadings -o $2 $1) =3D=3D $3)
+}
+
+vg_validate_pvlv_counts_()
+{
+	local local_vg=3D$1
+	local num_pvs=3D$2
+	local num_lvs=3D$3
+	local num_snaps=3D$4
+
+	check_vg_field_ $local_vg pv_count $num_pvs &&
+	check_vg_field_ $local_vg lv_count $num_lvs &&
+	check_vg_field_ $local_vg snap_count $num_snaps
+}
+
+dmsetup_has_dm_devdir_support_()
+{
+  # Detect support for the envvar.  If it's supported, the
+  # following command will fail with the expected diagnostic.
+  out=3D$(DM_DEV_DIR=3Dj dmsetup version 2>&1)
+  test "$?:$out" =3D "1:Invalid DM_DEV_DIR envvar value." -o \
+       "$?:$out" =3D "1:Invalid DM_DEV_DIR environment variable value."
+}
+
+# set up private /dev and /etc
+init_root_dir_()
+{
+  test -n "$test_dir_rand_" \
+    || error "Internal error: called init_root_dir_ before" \
+      "defining \$test_dir_rand_"
+
+  # Define these two globals.
+  G_root_=3D$test_dir_rand_/root
+  G_dev_=3D$G_root_/dev
+
+  export LVM_SYSTEM_DIR=3D$G_root_/etc
+  export DM_DEV_DIR=3D$G_dev_
+
+  # Only the first caller does anything.
+  mkdir -p $G_root_/etc $G_dev_ $G_dev_/mapper
+  for i in 0 1 2 3 4 5 6 7; do
+    mknod $G_root_/dev/loop$i b 7 $i
+  done
+  cat > $G_root_/etc/lvm.conf <<-EOF
+  devices {
+    dir =3D "$G_dev_"
+    scan =3D "$G_dev_"
+    filter =3D [ "a/loop/", "a/mirror/", "a/mapper/", "r/.*/" ]
+    cache_dir =3D "$G_root_/etc"
+    sysfs_scan =3D 0
+  }
+EOF
+}
+
+if test $(this_test_) !=3D 000-basic; then
+  init_root_dir_
+fi
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index e78fd30..621d1b0 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -289,7 +289,7 @@ test_dir_rand_=3D$("$abs_top_srcdir/build-aux/mktempd" =
$test_dir_ \
     || error "failed to create temporary directory in $test_dir_"

 if test $skip_ =3D 0 && test "x$device_mapper_required_" !=3D 'x'; then
-  . "$abs_top_srcdir/tests/dm-utils.sh" || exit 1
+  . "$abs_top_srcdir/tests/lvm-utils.sh" || exit 1
 fi

 # Run each test from within a temporary sub-directory named after the
--=20
1.5.6.rc0.30.g7c3f3




More information about the parted-devel mailing list