]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: test corruted GPT headers
authorKarel Zak <kzak@redhat.com>
Wed, 23 Oct 2013 08:44:58 +0000 (10:44 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Oct 2013 08:46:10 +0000 (10:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/fdisk/gpt
tests/ts/fdisk/gpt

index db0d92ff2dc920e72216ea4efa19fa9c4b64e048..5a3ecdf083110a6150ba135e507f3bf5f31ea7e8 100644 (file)
@@ -100,3 +100,46 @@ Device             Start          End Size Type
 
 -------------------
 
+Corrupt primary table
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device             Start          End Size Type
+<removed>1         2048         4095   1M EFI System
+<removed>2         4096         6143   1M Linux filesystem
+<removed>3         6144         8191   1M Linux filesystem
+<removed>4         8192        10239   1M Linux filesystem
+<removed>5        10240        12287   1M Linux swap
+<removed>6        12288        14335   1M Linux filesystem
+<removed>7        14336        16383   1M Linux filesystem
+<removed>8        16384        18431   1M Linux filesystem
+
+-------------------
+
+Corrupt backup table
+
+---layout----------
+Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disklabel type: gpt
+Disk identifier: <removed>
+
+Device             Start          End Size Type
+<removed>1         2048         4095   1M EFI System
+<removed>2         4096         6143   1M Linux filesystem
+<removed>3         6144         8191   1M Linux filesystem
+<removed>4         8192        10239   1M Linux filesystem
+<removed>5        10240        12287   1M Linux swap
+<removed>6        12288        14335   1M Linux filesystem
+<removed>7        14336        16383   1M Linux filesystem
+<removed>8        16384        18431   1M Linux filesystem
+
+-------------------
index e725f6d54dffd2d12abe1be0ffa395e00b5d18a3..25079070ecdf913016bb6d10f56784be91541896 100755 (executable)
@@ -34,7 +34,7 @@ FDISK_CMD_CREATE_PART="n\n2\n\n\n"           # create 2nd partition
 
 function print_layout {
        echo -ne "\n---layout----------" >> $TS_OUTPUT
-       $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT
+       $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} &>> $TS_OUTPUT
        echo -ne   "-------------------\n\n" >> $TS_OUTPUT
 }
 
@@ -77,5 +77,18 @@ echo -e "${FDISK_CMD_CREATE_PART}${FDISK_CMD_WRITE_CLOSE}" \
 
 print_layout
 
+ts_log "Corrupt primary table"
+dd if=/dev/zero of=${TEST_IMAGE_NAME} bs=512 count=1 seek=1 conv=notrunc &> /dev/null
+echo -e "w\n" | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_log "Corrupt backup table"
+dd if=/dev/zero of=${TEST_IMAGE_NAME} bs=512 count=1 \
+       seek=$(( 1024 * 1024 * 10 / 512 - 1)) conv=notrunc &> /dev/null
+echo -e "w\n" | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
 ts_fdisk_clean ${TEST_IMAGE_NAME}
 ts_finalize