[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Tue Nov 24 21:23:46 UTC 2009
tests/t-lib.sh | 7 +++++++
tests/t0001-tiny.sh | 6 +++++-
tests/t3200-type-change.sh | 34 +++++++++++++++++++++++++++++++++-
3 files changed, 45 insertions(+), 2 deletions(-)
New commits:
commit 359bb89b040e035124223f94c452cde034d7c9b7
Author: Jim Meyering <meyering at redhat.com>
Date: Tue Nov 17 11:27:29 2009 +0100
tests: correct t3200-type-change.sh
* tests/t3200-type-change.sh: The initial version was incomplete.
diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh
index 5f77f8b..d1c6a59 100755
--- a/tests/t3200-type-change.sh
+++ b/tests/t3200-type-change.sh
@@ -47,6 +47,38 @@ scsi_dev=$(cat dev-name)
fail=0
parted -s $scsi_dev mklabel msdos mkpart primary fat32 64s 80000s || fail=1
-compare out exp || fail=1
+parted -s $scsi_dev u s p
+
+p1=${scsi_dev}1
+wait_for_dev_to_appear_ $p1 || fail=1
+mkfs.ext2 $p1 || fail=1
+
+# print as hex, the type of the first partition
+msdos_p1_type() { od -An --skip=450 -N1 -tx1 "$1"; }
+
+# Initially, it is 0x0c (FAT32).
+type=$(msdos_p1_type $scsi_dev) || fail=1
+type=${type# } # remove leading space
+case $type in
+ 0c) ;;
+ *) fail_ "expected initial type of 0c (FAT32)";;
+esac
+
+parted -s $scsi_dev u s p
+parted -s $scsi_dev set 1 lvm off || fail=1
+
+# Before parted-2.1, the above would mistakenly change it to 0x83,
+# to match the file system now residing in that partition.
+type=$(msdos_p1_type $scsi_dev) || fail=1
+type=${type# } # remove leading space
+case $type in
+ 0c) ;;
+ *) fail_ "parted changed the type of partition 1 from 0c to $type";;
+esac
+
+# Ensure that setting the "lvm" flag still works.
+parted -s $scsi_dev set 1 lvm on || fail=1
+parted -s $scsi_dev u s p > out || fail=1
+grep lvm out || { fail=1; cat out; }
Exit $fail
commit 10befaeedc49c0e92ee4a09f2a9184051e6978c5
Author: Jim Meyering <meyering at redhat.com>
Date: Tue Nov 17 12:15:30 2009 +0100
tests: provide a new function: fail_
* tests/t-lib.sh (fail_): New function.
diff --git a/tests/t-lib.sh b/tests/t-lib.sh
index 76b6159..83efdf9 100644
--- a/tests/t-lib.sh
+++ b/tests/t-lib.sh
@@ -30,6 +30,13 @@ skip_test_()
Exit 77
}
+fail_()
+{
+ echo "$0: failed test: $@" | head -1 1>&9
+ echo "$0: failed test: $@" 1>&2
+ Exit 1
+}
+
getlimits_()
{
eval $(getlimits)
commit dd35d7248e77917d9c3ad665360b9cd70f59a2f1
Author: Jim Meyering <meyering at redhat.com>
Date: Tue Nov 17 15:39:00 2009 +0100
tests: t0001-tiny.sh: avoid spurious failure when run as root.
* tests/t0001-tiny.sh: Control characters were getting in the way.
Filter them out.
diff --git a/tests/t0001-tiny.sh b/tests/t0001-tiny.sh
index 373a68d..c2ea128 100755
--- a/tests/t0001-tiny.sh
+++ b/tests/t0001-tiny.sh
@@ -40,7 +40,11 @@ for opt in '' -s; do
parted $opt $dev mklabel msdos ---pretend-input-tty </dev/null > out 2>&1 \
|| fail=1
# expect no output
- sed 's/.*WARNING: You are not superuser.*//;/^$/d' out > k && mv k out || fail=1
+ sed 's/.*WARNING: You are not superuser.*//;/^$/d' out > k && mv k out \
+ || fail=1
+ # When run as root, there are just curses-related control chars. Remove them.
+ sed 's/^.\{1,12\}$//;/^$/d' out > k && mv k out \
+ || fail=1
compare out /dev/null || fail=1
parted -s $dev p || fail=1
More information about the Parted-commits
mailing list