# $NetBSD: t_gpt.sh,v 1.17 2022/11/21 16:06:00 kre Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Christos Zoulas
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Calling this from tests does not work. BUG!
check_2part() {
file "$src/gpt.2part.show.normal" gpt show "$disk"
file "$src/gpt.2part.show.uuid" gpt show -u "$disk"
}
atf_test_case change_attr_2part
change_attr_2part_head() {
atf_set "descr" "Change the attribute of 2 partition disk"
}
change_attr_2part_body() {
prepare_2part
match "$(attrmsg 1)" gpt set -i 1 -a biosboot,bootme "$disk"
save attr gpt show -i 1 "$disk"
match "^Attributes: biosboot, bootme\$" tail -1 attr
match "$(attrmsg 1)" gpt unset -i 1 -a biosboot,bootme "$disk"
save attr gpt show -i 1 "$disk"
match "^Attributes: None\$" tail -1 attr
}
atf_test_case change_type_2part
change_type_2part_head() {
atf_set "descr" "Change the partition type type of 2 partition disk"
}
change_type_2part_body() {
prepare_2part
match "$(typemsg 1)" gpt type -i 1 -T apple "$disk"
save type gpt show -i 1 "$disk"
inline "Type: apple (48465300-0000-11aa-aa11-00306543ecac)\n" \
grep "^Type:" type
match "$(typemsg 1)" gpt type -i 1 -T efi "$disk"
save type gpt show -i 1 "$disk"
inline "Type: efi (c12a7328-f81f-11d2-ba4b-00a0c93ec93b)\n" \
grep "^Type:" type
}