diff options
author | Zdenek Behan | 2009-08-12 23:55:16 +0200 |
---|---|---|
committer | Karel Zak | 2009-08-17 12:25:28 +0200 |
commit | d7c966543315a1a7e1d2cff8885f409f5c468c4d (patch) | |
tree | 094e03076659848db6fa613c68ad064eac70f637 /tests/ts/fdisk/sunlabel | |
parent | tests: fdisk doslabel test also checks setting partition active (diff) | |
download | kernel-qcow2-util-linux-d7c966543315a1a7e1d2cff8885f409f5c468c4d.tar.gz kernel-qcow2-util-linux-d7c966543315a1a7e1d2cff8885f409f5c468c4d.tar.xz kernel-qcow2-util-linux-d7c966543315a1a7e1d2cff8885f409f5c468c4d.zip |
tests: test for basic functionality of sun labels
Tests the following:
* Creation and deletion of first two partitions
* setting sysid to one (randomly chosen) value
* setting readonly/mountable flags
Signed-off-by: Zdenek Behan <rain@matfyz.cz>
Diffstat (limited to 'tests/ts/fdisk/sunlabel')
-rwxr-xr-x | tests/ts/fdisk/sunlabel | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/ts/fdisk/sunlabel b/tests/ts/fdisk/sunlabel new file mode 100755 index 000000000..9c2b01889 --- /dev/null +++ b/tests/ts/fdisk/sunlabel @@ -0,0 +1,74 @@ +#!/bin/bash + +# +# This file is part of util-linux-ng. +# +# 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="sunlabel tests" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +FDISK_CMD_INIT="s\n1\n1\n1024\n" # create new sunlabel +FDISK_CMD_WRITE_CLOSE="w\nq\n" +FDISK_CMD_DELETEALL="d\n1\nd\n2\nd\n3\nd\n4\nd\n5\nd\n6\nd\n7\nd\n8\n" # delete all partitions + +FDISK_CMD_CREATE_PRIMARY="n\n1\n0\n128\n" # create first partition, cylinders 0 through 128 +FDISK_CMD_TOGGLE_READONLY="a\n1\n" # sets first partition as read-only +FDISK_CMD_TOGGLE_MOUNTABLE="c\n1\n" # sets first partition as mountable +FDISK_CMD_CHANGE_SYSID="t\n1\n4\n" # changes sysid to 4 (SunOS usr) +FDISK_CMD_CREATE_SECONDARY="n\n2\n128\n\n" # create secondary partition cylinders 128 to the end of disk + +#set -x + +ts_log "Initialize empty image" +TEST_IMAGE_NAME=$(ts_image_init 10) +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Create new SUN partition table" +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETEALL}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Create first partition" +echo -e "${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Set partition sysid" +echo -e "${FDISK_CMD_CHANGE_SYSID}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Set first partition readonly" +echo -e "${FDISK_CMD_TOGGLE_READONLY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Set first partition mountable" +echo -e "${FDISK_CMD_TOGGLE_MOUNTABLE}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Create second partition" +echo -e "${FDISK_CMD_CREATE_SECONDARY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_log "Delete all partitions" +echo -e "${FDISK_CMD_DELETEALL}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum 2>&1 >> $TS_OUTPUT + +ts_finalize |