From e0bb63d84c0fd4cd10ddb46c228d8a775665cdd1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 19 Jun 2017 16:10:33 +0200 Subject: [PATCH] tests: add MBR resize tests Signed-off-by: Karel Zak --- .../expected/sfdisk/dos-reduce-empty-extended | 25 +++++++ .../expected/sfdisk/dos-resize-empty-extended | 25 +++++++ tests/expected/sfdisk/dos-resize-extended | 33 +++++++++ tests/expected/sfdisk/dos-resize-logical | 33 +++++++++ tests/ts/sfdisk/dos | 67 +++++++++++++++++++ 5 files changed, 183 insertions(+) create mode 100644 tests/expected/sfdisk/dos-reduce-empty-extended create mode 100644 tests/expected/sfdisk/dos-resize-empty-extended create mode 100644 tests/expected/sfdisk/dos-resize-extended create mode 100644 tests/expected/sfdisk/dos-resize-logical diff --git a/tests/expected/sfdisk/dos-reduce-empty-extended b/tests/expected/sfdisk/dos-reduce-empty-extended new file mode 100644 index 0000000000..7c6f8beab9 --- /dev/null +++ b/tests/expected/sfdisk/dos-reduce-empty-extended @@ -0,0 +1,25 @@ +Disk : 50 MiB, 52428800 bytes, 102400 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 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 14335 10240 5M 5 Extended + +2: +New situation: +Disklabel type: dos +Disk identifier: + +Device Boot Start End Sectors Size Id Type +1 2048 4095 2048 1M 83 Linux +2 4096 10239 6144 3M 5 Extended + +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. diff --git a/tests/expected/sfdisk/dos-resize-empty-extended b/tests/expected/sfdisk/dos-resize-empty-extended new file mode 100644 index 0000000000..4a2759c7cb --- /dev/null +++ b/tests/expected/sfdisk/dos-resize-empty-extended @@ -0,0 +1,25 @@ +Disk : 50 MiB, 52428800 bytes, 102400 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 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 8191 4096 2M 5 Extended + +2: +New situation: +Disklabel type: dos +Disk identifier: + +Device Boot Start End Sectors Size Id Type +1 2048 4095 2048 1M 83 Linux +2 4096 102399 98304 48M 5 Extended + +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. diff --git a/tests/expected/sfdisk/dos-resize-extended b/tests/expected/sfdisk/dos-resize-extended new file mode 100644 index 0000000000..6b7b099e70 --- /dev/null +++ b/tests/expected/sfdisk/dos-resize-extended @@ -0,0 +1,33 @@ +Disk : 50 MiB, 52428800 bytes, 102400 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 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 8191 2048 1M 83 Linux +4 8192 18431 10240 5M 5 Extended +5 10240 12287 2048 1M 83 Linux +6 14336 16383 2048 1M 83 Linux + +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 8191 2048 1M 83 Linux +4 8192 102399 94208 46M 5 Extended +5 10240 12287 2048 1M 83 Linux +6 14336 16383 2048 1M 83 Linux + +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. diff --git a/tests/expected/sfdisk/dos-resize-logical b/tests/expected/sfdisk/dos-resize-logical new file mode 100644 index 0000000000..9ceb9a3275 --- /dev/null +++ b/tests/expected/sfdisk/dos-resize-logical @@ -0,0 +1,33 @@ +Disk : 50 MiB, 52428800 bytes, 102400 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 4096 bytes +I/O size (minimum/optimal): 4096 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 8191 2048 1M 83 Linux +4 8192 28671 20480 10M 5 Extended +5 10240 12287 2048 1M 83 Linux +6 14336 16383 2048 1M 83 Linux + +6: +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 8191 2048 1M 83 Linux +4 8192 28671 20480 10M 5 Extended +5 10240 12287 2048 1M 83 Linux +6 14336 26623 12288 6M 83 Linux + +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. diff --git a/tests/ts/sfdisk/dos b/tests/ts/sfdisk/dos index ba9d5ccc43..7d8cfbe092 100755 --- a/tests/ts/sfdisk/dos +++ b/tests/ts/sfdisk/dos @@ -146,6 +146,73 @@ udevadm settle ts_finalize_subtest +ts_init_subtest "resize-empty-extended" +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +udevadm settle +$TS_CMD_SFDISK ${TS_DEVICE} > /dev/null 2>&1 <> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + +ts_init_subtest "reduce-empty-extended" +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +udevadm settle +$TS_CMD_SFDISK ${TS_DEVICE} > /dev/null 2>&1 <> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + +ts_init_subtest "resize-extended" +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +udevadm settle +$TS_CMD_SFDISK ${TS_DEVICE} > /dev/null 2>&1 <> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + +ts_init_subtest "resize-logical" +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +udevadm settle +$TS_CMD_SFDISK ${TS_DEVICE} > /dev/null 2>&1 <> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + ts_init_subtest "dump-old" $TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null udevadm settle -- 2.47.3