diff options
author | Jim Meyering <meyering@redhat.com> | 2009-11-17 11:27:29 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-11-17 11:27:29 +0100 |
commit | a50520d9fc11a455498ef2e3ab9eb0908b002415 (patch) | |
tree | ad4f2c5698f4e63ce9a1a218826b3e381c1e0716 /tests/t3200-type-change.sh | |
parent | 71bea9d928ea871abc81da0165dabfa997cd31c5 (diff) | |
download | parted-a50520d9fc11a455498ef2e3ab9eb0908b002415.tar.gz |
test for partition-type-changing bug
* tests/t3200-type-change.sh: New file.
* tests/Makefile.am (TESTS): Add it.
Diffstat (limited to 'tests/t3200-type-change.sh')
-rwxr-xr-x | tests/t3200-type-change.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh new file mode 100755 index 0000000..5f77f8b --- /dev/null +++ b/tests/t3200-type-change.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Ensure parted doesn't change the type of a partition to match its FS. + +# 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 > dev-name || + skip_test_ 'failed to create scsi_debug device' +scsi_dev=$(cat dev-name) + +# Create an empty partition of "type fat32", and then create an actual +# ext2 partition in it. Then "unset" the already unset LVM flag on that +# partition and ensure that parted doesn't "helpfully" change the partition +# type to match the newly-detected FS type. + +fail=0 +parted -s $scsi_dev mklabel msdos mkpart primary fat32 64s 80000s || fail=1 + +compare out exp || fail=1 + +Exit $fail |