]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add MBR resize tests
authorKarel Zak <kzak@redhat.com>
Mon, 19 Jun 2017 14:10:33 +0000 (16:10 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 19 Jun 2017 14:25:46 +0000 (16:25 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/sfdisk/dos-reduce-empty-extended [new file with mode: 0644]
tests/expected/sfdisk/dos-resize-empty-extended [new file with mode: 0644]
tests/expected/sfdisk/dos-resize-extended [new file with mode: 0644]
tests/expected/sfdisk/dos-resize-logical [new file with mode: 0644]
tests/ts/sfdisk/dos

diff --git a/tests/expected/sfdisk/dos-reduce-empty-extended b/tests/expected/sfdisk/dos-reduce-empty-extended
new file mode 100644 (file)
index 0000000..7c6f8be
--- /dev/null
@@ -0,0 +1,25 @@
+Disk <removed>: 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 / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1        2048  4095    2048   1M 83 Linux
+<removed>2        4096 14335   10240   5M  5 Extended
+
+<removed>2: 
+New situation:
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1        2048  4095    2048   1M 83 Linux
+<removed>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 (file)
index 0000000..4a2759c
--- /dev/null
@@ -0,0 +1,25 @@
+Disk <removed>: 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 / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1        2048  4095    2048   1M 83 Linux
+<removed>2        4096  8191    4096   2M  5 Extended
+
+<removed>2: 
+New situation:
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start    End Sectors Size Id Type
+<removed>1        2048   4095    2048   1M 83 Linux
+<removed>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 (file)
index 0000000..6b7b099
--- /dev/null
@@ -0,0 +1,33 @@
+Disk <removed>: 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 / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1        2048  4095    2048   1M 83 Linux
+<removed>2        4096  6143    2048   1M 83 Linux
+<removed>3        6144  8191    2048   1M 83 Linux
+<removed>4        8192 18431   10240   5M  5 Extended
+<removed>5       10240 12287    2048   1M 83 Linux
+<removed>6       14336 16383    2048   1M 83 Linux
+
+<removed>4: 
+New situation:
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start    End Sectors Size Id Type
+<removed>1        2048   4095    2048   1M 83 Linux
+<removed>2        4096   6143    2048   1M 83 Linux
+<removed>3        6144   8191    2048   1M 83 Linux
+<removed>4        8192 102399   94208  46M  5 Extended
+<removed>5       10240  12287    2048   1M 83 Linux
+<removed>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 (file)
index 0000000..9ceb9a3
--- /dev/null
@@ -0,0 +1,33 @@
+Disk <removed>: 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 / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Old situation:
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1        2048  4095    2048   1M 83 Linux
+<removed>2        4096  6143    2048   1M 83 Linux
+<removed>3        6144  8191    2048   1M 83 Linux
+<removed>4        8192 28671   20480  10M  5 Extended
+<removed>5       10240 12287    2048   1M 83 Linux
+<removed>6       14336 16383    2048   1M 83 Linux
+
+<removed>6: 
+New situation:
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1        2048  4095    2048   1M 83 Linux
+<removed>2        4096  6143    2048   1M 83 Linux
+<removed>3        6144  8191    2048   1M 83 Linux
+<removed>4        8192 28671   20480  10M  5 Extended
+<removed>5       10240 12287    2048   1M 83 Linux
+<removed>6       14336 26623   12288   6M 83 Linux
+
+The partition table has been altered.
+Calling ioctl() to re-read partition table.
+Syncing disks.
index ba9d5ccc43e1560b27bd27dceddcfa8f9217616e..7d8cfbe09232c43764077285ddb3a087f88c0402 100755 (executable)
@@ -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 <<EOF
+label: dos
+,1M
+,2M,E
+EOF
+udevadm settle
+echo ',+' | $TS_CMD_SFDISK --no-reread -N2 ${TS_DEVICE} >> $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 <<EOF
+label: dos
+,1M
+,5M,E
+EOF
+udevadm settle
+echo ',-2M' | $TS_CMD_SFDISK --no-reread -N2 ${TS_DEVICE} >> $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 <<EOF
+label: dos
+,1M
+,1M
+,1M
+,5M,E
+,1M
+,1M
+EOF
+udevadm settle
+echo ',+' | $TS_CMD_SFDISK --no-reread -N4 ${TS_DEVICE} >> $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 <<EOF
+label: dos
+,1M
+,1M
+,1M
+,10M,E
+,1M
+,1M
+EOF
+udevadm settle
+echo ',+' | $TS_CMD_SFDISK --no-reread -N6 ${TS_DEVICE} >> $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