diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:30:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:30:35 +0000 |
commit | 378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch) | |
tree | 44dfb6ca500d32cabd450649b322a42e70a30683 /tests/ts/fdisk/sunlabel | |
parent | Initial commit. (diff) | |
download | util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip |
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ts/fdisk/sunlabel')
-rwxr-xr-x | tests/ts/fdisk/sunlabel | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/ts/fdisk/sunlabel b/tests/ts/fdisk/sunlabel new file mode 100755 index 0000000..4c0d375 --- /dev/null +++ b/tests/ts/fdisk/sunlabel @@ -0,0 +1,104 @@ +#!/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="${0%/*}/../.." +TS_DESC="sunlabel tests" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_FDISK" +ts_check_test_command "$TS_HELPER_MD5" + +FDISK_CMD_INIT="s\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\n\n\n128\n" # create first partition +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\n4\n" # changes sysid to 4 (SunOS usr) +FDISK_CMD_CREATE_SECONDARY="n\n2\n128\n\n" # create secondary partition to the end of disk + +FDISK_OPTIONS="-H 1 -S 63 -u=cylinders" + +function print_layout { + $TS_CMD_FDISK ${FDISK_OPTIONS} -x ${TEST_IMAGE_NAME} >> $TS_OUTPUT + ts_fdisk_clean ${TEST_IMAGE_NAME} +} + +#set -x + +ts_init_subtest "empty-sun-pt" +TEST_IMAGE_NAME=$(ts_image_init 10) +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETEALL}${FDISK_CMD_WRITE_CLOSE}" \ + | $TS_CMD_FDISK --noauto-pt ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +print_layout +ts_finalize_subtest + + +ts_init_subtest "create-first-partition" +echo -e "${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +print_layout +ts_finalize_subtest + +ts_init_subtest "set-partition-sysid" +echo -e "${FDISK_CMD_CHANGE_SYSID}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +print_layout +ts_finalize_subtest + +ts_init_subtest "set-first-par-readonly" +echo -e "${FDISK_CMD_TOGGLE_READONLY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +print_layout +ts_finalize_subtest + +ts_init_subtest "set-first-par-mountable" +echo -e "${FDISK_CMD_TOGGLE_MOUNTABLE}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +print_layout +ts_finalize_subtest + +ts_init_subtest "create-second-partition" +echo -e "${FDISK_CMD_CREATE_SECONDARY}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG + +print_layout +ts_finalize_subtest + +ts_init_subtest "delete-all-partitions" +echo -e "${FDISK_CMD_DELETEALL}${FDISK_CMD_WRITE_CLOSE}" | \ + $TS_CMD_FDISK ${FDISK_OPTIONS} ${TEST_IMAGE_NAME} &> /dev/null +ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + + +ts_finalize |