[PATCH 2/2] tests: exercise new align-check command
Jim Meyering
meyering at redhat.com
Fri Nov 27 11:30:21 UTC 2009
* tests/t9030-align-check.sh: New file.
* tests/Makefile.am (TESTS): Add it.
---
tests/Makefile.am | 3 +-
tests/t9030-align-check.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 1 deletions(-)
create mode 100644 tests/t9030-align-check.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f47a6e2..b6d8ca2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,7 +30,8 @@ TESTS = \
t7000-scripting.sh \
t8000-loop.sh \
t9010-big-sector.sh \
- t9020-alignment.sh
+ t9020-alignment.sh \
+ t9030-align-check.sh
EXTRA_DIST = \
$(TESTS) test-lib.sh t-lib.sh lvm-utils.sh t-local.sh t-lvm.sh
diff --git a/tests/t9030-align-check.sh b/tests/t9030-align-check.sh
new file mode 100644
index 0000000..12c6c77
--- /dev/null
+++ b/tests/t9030-align-check.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+# exercise the new align-check command
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ parted --version
+fi
+
+: ${srcdir=.}
+. $srcdir/t-lib.sh
+
+require_root_
+require_scsi_debug_module_
+
+# check for scsi_debug module
+modprobe -n scsi_debug ||
+ skip_test_ "you lack the scsi_debug kernel module"
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_test_ 'this system lacks a new-enough libblkid'
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=550 physblk_exp=3 lowest_aligned=7 > dev-name ||
+ skip_test_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+p1=${scsi_dev}1
+
+fail=0
+
+parted -s $scsi_dev mklabel gpt || fail=1
+
+i=60
+while :; do
+ parted -s $scsi_dev mkpart p1 ext2 ${i}s 80000s || fail=1
+ wait_for_dev_to_appear_ $p1 || fail=1
+ parted -s $scsi_dev align-check min 1 > out 2>&1
+ result=$?
+
+ test $(expr $i % 8) = 7 && exp_result=0 || exp_result=1
+ test $result = $exp_result || fail=1
+ compare out /dev/null || fail=1
+
+ parted -s $scsi_dev rm 1
+ i=$(expr $i + 1)
+ test $i = 70 && break
+done
+
+Exit $fail
--
1.6.6.rc0.285.g73651
More information about the parted-devel
mailing list