From: Karel Zak Date: Wed, 19 Jul 2017 13:34:35 +0000 (+0200) Subject: tests: check sfdisk resize on unsorted offsets X-Git-Tag: v2.31-rc1~178 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d9d3ee294ee68a891fa506f33c3865570425204;p=thirdparty%2Futil-linux.git tests: check sfdisk resize on unsorted offsets Signed-off-by: Karel Zak --- diff --git a/tests/expected/sfdisk/resize-dos-unsorted b/tests/expected/sfdisk/resize-dos-unsorted new file mode 100644 index 0000000000..21dbe5b12a --- /dev/null +++ b/tests/expected/sfdisk/resize-dos-unsorted @@ -0,0 +1,72 @@ +Disk : 100 MiB, 104857600 bytes, 204800 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / bytes + +>>> Script header accepted. +>>> Script header accepted. +>>> Script header accepted. +>>> Script header accepted. +>>> Created a new . +1: Created a new . +2: Created a new . +3: Created a new . +4: Created a new . +5: Created a new . +6: Created a new . +7: Done. + +New situation: +Disklabel type: dos +Disk identifier: + +Device Boot Start End Sectors Size Id Type +1 2048 4095 2048 1M 83 Linux +2 4096 6143 2048 1M 83 Linux +3 6144 108543 102400 50M 5 Extended +4 108544 110591 2048 1M 83 Linux +5 8192 10239 2048 1M 83 Linux +6 12288 108543 96256 47M 83 Linux + +Partition table entries are not in disk order. + +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +Disk : 100 MiB, 104857600 bytes, 204800 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / bytes +Disklabel type: dos +Disk identifier: + +Old situation: + +Device Boot Start End Sectors Size Id Type +1 2048 4095 2048 1M 83 Linux +2 4096 6143 2048 1M 83 Linux +3 6144 108543 102400 50M 5 Extended +4 108544 110591 2048 1M 83 Linux +5 8192 10239 2048 1M 83 Linux +6 12288 108543 96256 47M 83 Linux + +Partition table entries are not in disk order. + +4: +New situation: +Disklabel type: dos +Disk identifier: + +Device Boot Start End Sectors Size Id Type +1 2048 4095 2048 1M 83 Linux +2 4096 6143 2048 1M 83 Linux +3 6144 108543 102400 50M 5 Extended +4 108544 204799 96256 47M 83 Linux +5 8192 10239 2048 1M 83 Linux +6 12288 108543 96256 47M 83 Linux + +Partition table entries are not in disk order. + +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. diff --git a/tests/ts/sfdisk/resize b/tests/ts/sfdisk/resize index ff58e2de9b..308798d5ea 100755 --- a/tests/ts/sfdisk/resize +++ b/tests/ts/sfdisk/resize @@ -122,4 +122,32 @@ test_label_resize dos # GPT test_label_resize gpt + +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +udevadm settle + +ts_init_subtest "dos-unsorted" +# create layout where partition #4 is the last on disk (by offset) +# and there is freespace at the end of the disk. Note that #4 is not the last +# partno on the disk. The libfdisk has to be able to check for the free space +# independently on the partno, only offset+size matters. +$TS_CMD_SFDISK --no-reread ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + ts_finalize