1#!/usr/local/bin/ksh93 -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/include/libtest.kshlib 28 29################################################################################ 30# 31# __stc_assertion_start 32# 33# ID: bootfs_003_pos 34# 35# DESCRIPTION: 36# 37# Valid pool names are accepted 38# 39# STRATEGY: 40# 1. Using a list of valid pool names 41# 2. Create a filesystem in that pool 42# 2. Verify we can set the bootfs to that filesystem 43# 44# TESTABILITY: explicit 45# 46# TEST_AUTOMATION_LEVEL: automated 47# 48# CODING_STATUS: COMPLETED (2007-03-05) 49# 50# __stc_assertion_end 51# 52################################################################################ 53 54verify_runnable "global" 55 56set -A pools "pool.${TESTCASE_ID}" "pool123" "mypool" 57typeset VDEV=$TMPDIR/bootfs_003.${TESTCASE_ID}.dat 58 59function cleanup { 60 typeset -i i=0 61 while [ $i -lt "${#pools[@]}" ]; do 62 destroy_pool ${pools[$i]} 63 i=$(( $i + 1 )) 64 done 65 $RM $VDEV 66} 67 68 69$ZPOOL set 2>&1 | $GREP bootfs > /dev/null 70if [ $? -ne 0 ] 71then 72 log_unsupported "bootfs pool property not supported on this release." 73fi 74 75log_onexit cleanup 76 77log_assert "Valid pool names are accepted by zpool set bootfs" 78create_vdevs $VDEV 79 80typeset -i i=0; 81 82while [ $i -lt "${#pools[@]}" ] 83do 84 POOL=${pools[$i]} 85 log_must $ZPOOL create $POOL $VDEV 86 log_must $ZFS create $POOL/$FS 87 88 enc=$(get_prop encryption $POOL/$FS) 89 if [[ $? -eq 0 ]] && [[ -n "$enc" ]] && [[ "$enc" != "off" ]]; then 90 log_unsupported "bootfs pool property not supported \ 91when encryption is set to on." 92 fi 93 94 log_must $ZPOOL set bootfs=$POOL/$FS $POOL 95 RES=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' ) 96 if [ $RES != "$POOL/$FS" ] 97 then 98 log_fail "Expected $RES == $POOL/$FS" 99 fi 100 log_must $ZPOOL destroy -f $POOL 101 i=$(( $i + 1 )) 102done 103 104log_pass "Valid pool names are accepted by zpool set bootfs" 105