summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKarel Zak2019-02-27 12:03:28 +0100
committerKarel Zak2019-02-27 12:03:28 +0100
commitca614ef8c702f6d5a962bc07b3a590438da1b546 (patch)
treee3aa55bd0edcf0b369a836e0dcbdd02983a6fd2b /tests
parentMerge branch 'dana/column-x' of https://github.com/okdana/util-linux (diff)
downloadkernel-qcow2-util-linux-ca614ef8c702f6d5a962bc07b3a590438da1b546.tar.gz
kernel-qcow2-util-linux-ca614ef8c702f6d5a962bc07b3a590438da1b546.tar.xz
kernel-qcow2-util-linux-ca614ef8c702f6d5a962bc07b3a590438da1b546.zip
tests: add fdisk (dos) first sector dialog test
The test verifies that the "First sector" dialog offers relevant range in the begin of the device if the end of the device is already used. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/expected/fdisk/mbr-nondos-mode47
-rwxr-xr-xtests/ts/fdisk/mbr-nondos-mode18
2 files changed, 65 insertions, 0 deletions
diff --git a/tests/expected/fdisk/mbr-nondos-mode b/tests/expected/fdisk/mbr-nondos-mode
index 8833baa1c..28d98d22f 100644
--- a/tests/expected/fdisk/mbr-nondos-mode
+++ b/tests/expected/fdisk/mbr-nondos-mode
@@ -201,3 +201,50 @@ Disklabel type: dos
Disk identifier: <removed>
-------------------
+Create new DOS partition table (again)
+Create 1st primary at the end of device
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 20000 40959 20960 10.2M 83 Linux
+-------------------
+
+Create 2nd primary at the begin of device
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Partition type
+ p primary (1 primary, 0 extended, 3 free)
+ e extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (2048-19999, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-19999, default 19999):
+Created a new <removed>.
+
+Command (m for help): The partition table has been altered.
+Syncing disks.
+
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device Boot Start End Sectors Size Id Type
+<removed>1 20000 40959 20960 10.2M 83 Linux
+<removed>2 2048 19999 17952 8.8M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/ts/fdisk/mbr-nondos-mode b/tests/ts/fdisk/mbr-nondos-mode
index 7ac5dae1b..3ae25ba1f 100755
--- a/tests/ts/fdisk/mbr-nondos-mode
+++ b/tests/ts/fdisk/mbr-nondos-mode
@@ -149,6 +149,24 @@ ts_image_md5sum >> $TS_OUTPUT 2>&1
print_layout
+# Create a new layout
+#
+ts_log "Create new DOS partition table (again)"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_DOSLABEL}${FDISK_CMD_INIT}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+ts_log "Create 1st primary at the end of device"
+echo -e "n\np\n1\n20000\n\n${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_log "Create 2nd primary at the begin of device"
+echo -e "n\np\n2\n\n\n${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} >> $TS_OUTPUT
+
+print_layout
+
ts_fdisk_clean ${TEST_IMAGE_NAME}
ts_finalize