summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/expected/fdisk/gpt113
-rwxr-xr-xtests/ts/fdisk/gpt84
2 files changed, 197 insertions, 0 deletions
diff --git a/tests/expected/fdisk/gpt b/tests/expected/fdisk/gpt
new file mode 100644
index 000000000..2206392e6
--- /dev/null
+++ b/tests/expected/fdisk/gpt
@@ -0,0 +1,113 @@
+Initialize empty image
+Create new GPT partition table
+
+---layout----------
+WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
+
+
+__ts_dev__: 10 MB, 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
+Disk label type: gpt
+
+
+# Start End Size Type Name
+-------------------
+
+Create partitions
+Change partition type by number
+
+---layout----------
+WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
+
+
+__ts_dev__: 10 MB, 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
+Disk label type: gpt
+
+
+# Start End Size Type Name
+ 1 2048 4095 1M EFI System
+ 2 4096 6143 1M Linux filesyste
+ 3 6144 8191 1M Linux filesyste
+ 4 8192 10239 1M Linux filesyste
+ 5 10240 12287 1M Linux filesyste
+ 6 12288 14335 1M Linux filesyste
+ 7 14336 16383 1M Linux filesyste
+ 8 16384 18431 1M Linux filesyste
+-------------------
+
+Change partition type by UUID
+
+---layout----------
+WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
+
+
+__ts_dev__: 10 MB, 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
+Disk label type: gpt
+
+
+# Start End Size Type Name
+ 1 2048 4095 1M EFI System
+ 2 4096 6143 1M Linux filesyste
+ 3 6144 8191 1M Linux filesyste
+ 4 8192 10239 1M Linux filesyste
+ 5 10240 12287 1M Linux swap
+ 6 12288 14335 1M Linux filesyste
+ 7 14336 16383 1M Linux filesyste
+ 8 16384 18431 1M Linux filesyste
+-------------------
+
+Delete partition
+
+---layout----------
+WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
+
+
+__ts_dev__: 10 MB, 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
+Disk label type: gpt
+
+
+# Start End Size Type Name
+ 1 2048 4095 1M EFI System
+ 3 6144 8191 1M Linux filesyste
+ 4 8192 10239 1M Linux filesyste
+ 5 10240 12287 1M Linux swap
+ 6 12288 14335 1M Linux filesyste
+ 7 14336 16383 1M Linux filesyste
+ 8 16384 18431 1M Linux filesyste
+-------------------
+
+Create again partition
+
+---layout----------
+WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
+
+
+__ts_dev__: 10 MB, 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
+Disk label type: gpt
+
+
+# Start End Size Type Name
+ 1 2048 4095 1M EFI System
+ 2 4096 6143 1M Linux filesyste
+ 3 6144 8191 1M Linux filesyste
+ 4 8192 10239 1M Linux filesyste
+ 5 10240 12287 1M Linux swap
+ 6 12288 14335 1M Linux filesyste
+ 7 14336 16383 1M Linux filesyste
+ 8 16384 18431 1M Linux filesyste
+-------------------
+
diff --git a/tests/ts/fdisk/gpt b/tests/ts/fdisk/gpt
new file mode 100755
index 000000000..179e9387f
--- /dev/null
+++ b/tests/ts/fdisk/gpt
@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# This file is part of util-linux.
+#
+# Copyright (C) 2013 Karel Zak <kzak@redhat.com>
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="GPT"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+FDISK_CMD_CREATE_GPTLABEL="g\n" # create GPT label
+FDISK_CMD_WRITE_CLOSE="w\nq\n" # write to image
+
+FDISK_CMD_CHANGE_TYPE_BY_NUM="t\n1\n1\n" # set 1st partition to EFI System
+ # set 5th partition to Linux swap
+FDISK_CMD_CHANGE_TYPE_BY_UUID="t\n5\n0657FD6D-A4AB-43C4-84E5-0933C84B4F4F\n"
+
+FDISK_CMD_DELETE_PART="d\n2\n" # delete 2nd partition
+FDISK_CMD_CREATE_PART="n\n2\n\n\n" # create 2nd partition
+
+#set -x
+
+function print_layout {
+ echo -ne "\n---layout----------" >> $TS_OUTPUT
+ $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} | \
+ sed 's/^.*\.img/__ts_dev__/g;
+ s/^[[:blank:]]*Device Boot/ Device Boot/g' >> $TS_OUTPUT 2>&1
+ echo -ne "-------------------\n\n" >> $TS_OUTPUT
+}
+
+ts_log "Initialize empty image"
+TEST_IMAGE_NAME=$(ts_image_init 10)
+
+ts_log "Create new GPT partition table"
+echo -e "${FDISK_CMD_CREATE_GPTLABEL}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_log "Create partitions"
+for i in {1..8}; do
+ echo -e "n\n${i}\n\n+1M\n${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+done
+
+ts_log "Change partition type by number"
+echo -e "${FDISK_CMD_CHANGE_TYPE_BY_NUM}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_log "Change partition type by UUID"
+echo -e "${FDISK_CMD_CHANGE_TYPE_BY_UUID}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_log "Delete partition"
+echo -e "${FDISK_CMD_DELETE_PART}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_log "Create again partition"
+echo -e "${FDISK_CMD_CREATE_PART}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+
+print_layout
+
+ts_finalize