[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Otavio Salvador
otavio at alioth.debian.org
Wed Jun 30 12:23:32 UTC 2010
tests/Makefile.am | 1
tests/t1101-busy-partition.sh | 85 ++++++++++++++++++++++++
tests/t2310-dos-extended-2-sector-min-offset.sh | 4 -
tests/t3000-resize-fs.sh | 8 --
tests/t3200-type-change.sh | 4 -
tests/t9020-alignment.sh | 4 -
tests/t9030-align-check.sh | 4 -
tests/t9040-many-partitions.sh | 4 -
8 files changed, 87 insertions(+), 27 deletions(-)
New commits:
commit 58961f0a305b8444d098713f234785152dc9f9e1
Author: Otavio Salvador <otavio at ossystems.com.br>
Date: Tue Jun 29 14:22:34 2010 -0300
tests: update resize-fs to use wait_for_dev_to_appear_
* t3000-resize-fs.sh: rely on wait_for_dev_to_appear_ to wait for the
device to be crated.
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
index 5cc46d3..f93de4b 100755
--- a/tests/t3000-resize-fs.sh
+++ b/tests/t3000-resize-fs.sh
@@ -79,13 +79,7 @@ for fs_type in hfs+ fat32; do
# as $dev, the loop below typically iterates 7-20 times.
# wait for new partition device to appear
- i=0
- while :; do
- test -e "${dev}1" && break; test $i = 90 && break;
- i=$(expr $i + 1)
- sleep .01 2>/dev/null || sleep 1
- done
- test $i = 90 && fail=1
+ wait_for_dev_to_appear_ ${dev}1
case $fs_type in
fat32) mkfs_cmd='mkfs.vfat -F 32';;
commit 49468e447c23338bd7670741c47b72facdb904f7
Author: Otavio Salvador <otavio at ossystems.com.br>
Date: Tue Jun 29 09:51:03 2010 -0300
tests: rely on require_scsi_debug_module_ to modprobe scsi_debug module
* t2310-dos-extended-2-sector-min-offset.sh: remove explicit modprobe
since it is done by require_scsi_debug_module_.
* t3200-type-change.sh: likewise.
* t9020-alignment.sh: likewise.
* t9030-align-check.sh: likewise.
* t9040-many-partitions.sh: likewise.
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
index 6d4b23c..399d0ef 100644
--- a/tests/t2310-dos-extended-2-sector-min-offset.sh
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -30,10 +30,6 @@ fi
require_root_
require_scsi_debug_module_
-# check for scsi_debug module
-modprobe -n scsi_debug ||
- skip_test_ "you lack the scsi_debug kernel module"
-
# create memory-backed device
scsi_debug_setup_ dev_size_mb=1 > dev-name ||
skip_test_ 'failed to create scsi_debug device'
diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh
index e64e6c7..0a92426 100755
--- a/tests/t3200-type-change.sh
+++ b/tests/t3200-type-change.sh
@@ -27,10 +27,6 @@ fi
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'
diff --git a/tests/t9020-alignment.sh b/tests/t9020-alignment.sh
index b43acbc..88ac231 100755
--- a/tests/t9020-alignment.sh
+++ b/tests/t9020-alignment.sh
@@ -27,10 +27,6 @@ fi
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'
diff --git a/tests/t9030-align-check.sh b/tests/t9030-align-check.sh
index 76b359a..1839bf9 100644
--- a/tests/t9030-align-check.sh
+++ b/tests/t9030-align-check.sh
@@ -27,10 +27,6 @@ fi
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'
diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
index 4c0b7ea..c094c02 100644
--- a/tests/t9040-many-partitions.sh
+++ b/tests/t9040-many-partitions.sh
@@ -27,10 +27,6 @@ fi
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'
commit 0e2fce0232467fad49a9097a887033e8f2984209
Author: Otavio Salvador <otavio at ossystems.com.br>
Date: Mon Jun 28 19:45:51 2010 -0300
tests: add one: try to remove a busy partition
This test tries to reproduce the issue reported in Debian bug #582818[1].
1. http://bugs.debian.org/582818
Basically it does:
* create two primary partitions
* mount the second one
* remove the first (must work)
* try to remove the second (must fail)
* tests/t1101-busy-partition.sh: new file.
* tests/Makefile.am (TESTS): add the new test in check target.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aa67f99..a1ab0d8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,6 +19,7 @@ TESTS = \
t0400-loop-clobber-infloop.sh \
t0500-dup-clobber.sh \
t1100-busy-label.sh \
+ t1101-busy-partition.sh \
t1700-ext-probe.sh \
t2100-mkswap.sh \
t2200-dos-label-recog.sh \
diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh
new file mode 100755
index 0000000..a132275
--- /dev/null
+++ b/tests/t1101-busy-partition.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# test for Debian bug #582818 (http://bugs.debian.org/582818); forbid
+# the removal of a mounted partition.
+
+# Copyright (C) 2010 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_
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=80 > dev-name ||
+ skip_test_ 'failed to create scsi_debug device'
+dev=$(cat dev-name)
+
+cat <<EOF > exp-warning || framework_failure
+WARNING: you are attempting to use parted to operate on (mkpartfs) a file system.
+parted's file system manipulation code is not as robust as what you'll find in
+dedicated, file-system-specific packages like e2fsprogs. We recommend
+you use parted only to manipulate partition tables, whenever possible.
+Support for performing most operations on most types of file systems
+will be removed in an upcoming release.
+EOF
+
+cat <<EOF > exp-error || framework_failure
+Error: Partition ${dev}2 is being used. You must unmount it before you modify it with Parted.
+EOF
+
+fail=0
+
+parted -s "$dev" mklabel msdos > out 2>&1 || fail=1
+
+# expect no output
+compare out /dev/null || fail=1
+
+parted -s "$dev" mkpartfs primary fat32 1 40 > out 2>&1 || fail=1
+
+# expect warning
+compare out exp-warning || fail=1
+
+parted -s "$dev" mkpartfs primary fat32 40 80 > out 2>&1 || fail=1
+
+# wait for new partition device to appear
+wait_for_dev_to_appear_ ${dev}2
+
+# expect warning
+compare out exp-warning || fail=1
+
+# be sure to unmount upon interrupt, failure, etc.
+cleanup_() { umount "${dev}2" > /dev/null 2>&1; }
+
+mount_point=$(pwd)/mnt
+
+mkdir $mount_point || fail=1
+mount "${dev}2" "$mount_point" || fail=1
+
+# removal of unmounted partition, must work.
+parted -s "$dev" rm 1 > out 2>&1 || fail=1
+
+parted -s "$dev" rm 2 > out 2>&1 && fail=1
+
+# expect error
+compare out exp-error
+
+Exit $fail
More information about the Parted-commits
mailing list