I mistakenly pushed a version of t3200-type-change.sh that
didn't work at all.  Now it detects the problem.

>From 10befaeedc49c0e92ee4a09f2a9184051e6978c5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Tue, 17 Nov 2009 12:15:30 +0100
Subject: [PATCH 1/2] tests: provide a new function: fail_

* tests/t-lib.sh (fail_): New function.
---
 tests/t-lib.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

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)
--
1.6.6.rc0.236.ge0b94


>From 359bb89b040e035124223f94c452cde034d7c9b7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Tue, 17 Nov 2009 11:27:29 +0100
Subject: [PATCH 2/2] tests: correct t3200-type-change.sh

* tests/t3200-type-change.sh: The initial version was incomplete.
---
 tests/t3200-type-change.sh |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

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
--
1.6.6.rc0.236.ge0b94

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to