[PATCH] tests: fdisk doslabel test also checks changing partition type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Changed apostrophes around test commands to quotes, this makes vim
syntax highlighting more happy, and makes the newlines stand out.

* Added check for changing partition type. After the change is done and
checked, the partition is deleted and re-created to not mess with the
other md5's already in place...
---
 tests/expected/fdisk/doslabel |    4 ++++
 tests/ts/fdisk/doslabel       |   29 ++++++++++++++++++++---------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/tests/expected/fdisk/doslabel b/tests/expected/fdisk/doslabel
index 1d987f6..6f76360 100644
--- a/tests/expected/fdisk/doslabel
+++ b/tests/expected/fdisk/doslabel
@@ -4,6 +4,10 @@ Create new DOS partition table
 57e721e38d1266c2df055067c18f2cf9 doslabel.img
 Create primary partition
 ae4f9b12f4a768849f72ea36938c30c7 doslabel.img
+Set partition type
+4a5dba818f9962a82a086d8b99b89a17 doslabel.img
+Re-create primary partition
+ae4f9b12f4a768849f72ea36938c30c7 doslabel.img
 Create extended partition
 76987a00b353687cd1dba3ddea9d66f9 doslabel.img
 Create logical partitions
diff --git a/tests/ts/fdisk/doslabel b/tests/ts/fdisk/doslabel
index a7ea576..5aba492 100755
--- a/tests/ts/fdisk/doslabel
+++ b/tests/ts/fdisk/doslabel
@@ -21,15 +21,16 @@ TS_DESC="doslabel tests"
 ts_init "$*"
 
 # cmd to change number of cylinders to 1024 and changes system id to 0x1
-FDISK_CMD_INIT='x\nc\n1024\ni\n0x1\nr\n'
-FDISK_CMD_WRITE_CLOSE='w\nq\n'
-FDISK_CMD_CREATE_DOSLABEL='o\n' #create dos label
-FDISK_CMD_CREATE_PRIMARY='n\np\n1\n\n+1M\n' # create primary partition 1 of size 1MB
-FDISK_CMD_CREATE_EXTENDED='n\ne\n2\n\n+10\n' # create extended partition 2 of size 11 cylinders
-FDISK_CMD_CREATE_LOGICAL='n\nl\n\n+1\n' # create next logical partition of size 2 cyl
-FDISK_CMD_DELETE_LOGICALS='d\n6\nd\n5\nd\n6\d5\n' # delete middle, head, tail, last partitions
-FDISK_CMD_DELETE_PRIMARY='d\n1\n' # delete first primary
-FDISK_CMD_DELETE_EXTENDED='d\n2\n' # delete second primary
+FDISK_CMD_INIT="x\nc\n1024\ni\n0x1\nr\n"
+FDISK_CMD_WRITE_CLOSE="w\nq\n"
+FDISK_CMD_CREATE_DOSLABEL="o\n" #create dos label
+FDISK_CMD_CREATE_PRIMARY="n\np\n1\n\n+1M\n" # create primary partition 1 of size 1MB
+FDISK_CMD_CHANGE_PARTTYPE="t\nbf\n" # change partition type to "bf - solaris", this requires that there is only one partition to change
+FDISK_CMD_CREATE_EXTENDED="n\ne\n2\n\n+10\n" # create extended partition 2 of size 11 cylinders
+FDISK_CMD_CREATE_LOGICAL="n\nl\n\n+1\n" # create next logical partition of size 2 cyl
+FDISK_CMD_DELETE_LOGICALS="d\n6\nd\n5\nd\n6\d5\n" # delete middle, head, tail, last partitions
+FDISK_CMD_DELETE_PRIMARY="d\n1\n" # delete first primary
+FDISK_CMD_DELETE_EXTENDED="d\n2\n" # delete second primary
 
 #set -x 
 
@@ -49,6 +50,16 @@ echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" |
 	$TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum 2>&1 >> $TS_OUTPUT
 
+ts_log "Set partition type"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CHANGE_PARTTYPE}${FDISK_CMD_WRITE_CLOSE}" | \
+	$TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum 2>&1 >> $TS_OUTPUT
+
+ts_log "Re-create primary partition"
+echo -e "${FDISK_CMD_INIT}d\n${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+	$TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum 2>&1 >> $TS_OUTPUT
+
 ts_log "Create extended partition"
 echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" | \
 	$TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
-- 
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux