diff options
author | Karel Zak | 2012-07-31 17:34:15 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-31 17:34:15 +0200 |
commit | 1d188d0052af9e26a945c4f9050ae49453ccb026 (patch) | |
tree | 49e1eb895494203d331f006d4a3a9a9edd4e8089 /tests/ts/fdisk/mbr-dos-mode | |
parent | docs: update howto-tests.txt (diff) | |
download | kernel-qcow2-util-linux-1d188d0052af9e26a945c4f9050ae49453ccb026.tar.gz kernel-qcow2-util-linux-1d188d0052af9e26a945c4f9050ae49453ccb026.tar.xz kernel-qcow2-util-linux-1d188d0052af9e26a945c4f9050ae49453ccb026.zip |
tests: rename doslabel test
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts/fdisk/mbr-dos-mode')
-rwxr-xr-x | tests/ts/fdisk/mbr-dos-mode | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/tests/ts/fdisk/mbr-dos-mode b/tests/ts/fdisk/mbr-dos-mode new file mode 100755 index 000000000..c2b0baa8a --- /dev/null +++ b/tests/ts/fdisk/mbr-dos-mode @@ -0,0 +1,101 @@ +#!/bin/bash + +# +# This file is part of util-linux. +# +# 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="MBR - dos mode" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +# cmd to change number of cylinders to 1024 and changes system id to 0x1 +FDISK_CMD_INIT="x\nc\n1024\ni\n0x1\nr\n" +FDISK_CMD_WRITE_CLOSE="w\nq\n" +FDISK_CMD_CREATE_DOSLABEL="o\n" #create dos label +FDISK_CMD_CREATE_PRIMARY="n\np\n1\n\n+1M\n" # create primary partition 1 of size 1MB +FDISK_CMD_CHANGE_PARTTYPE="t\nbf\n" # change partition type to "bf - solaris", this requires that there is only one partition to change +FDISK_CMD_SET_ACTIVE="a\n1\n" # set first partition active +FDISK_CMD_CREATE_EXTENDED="n\ne\n2\n\n+10\n" # create extended partition 2 of size 11 cylinders +FDISK_CMD_CREATE_LOGICAL="n\nl\n\n+1\n" # create next logical partition of size 2 cyl +FDISK_CMD_DELETE_LOGICALS="d\n6\nd\n5\nd\n6\d5\n" # delete middle, head, tail, last partitions +FDISK_CMD_DELETE_PRIMARY="d\n1\n" # delete first primary +FDISK_CMD_DELETE_EXTENDED="d\n2\n" # delete second primary + +#set -x + +ts_log "Initialize empty image" +TEST_IMAGE_NAME=$(ts_image_init 10) +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +# need to run init twice, to change system ID after new label, otherwise system +# ID will be random and will screw up md5's +ts_log "Create new DOS partition table" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_DOSLABEL}${FDISK_CMD_INIT}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Create primary partition" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Set partition type" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CHANGE_PARTTYPE}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Set primary partition active" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_SET_ACTIVE}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Re-create primary partition" +echo -e "${FDISK_CMD_INIT}d\n${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Create extended partition" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Create logical partitions" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Delete logical partitions" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_LOGICALS}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Create another logical partition" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Delete primary partition" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_log "Delete extended partition" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>&1 + +ts_finalize |