1#!/usr/bin/ksh -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 28. $STF_SUITE/include/libtest.shlib 29 30# 31# DESCRIPTION: 32# 33# Valid pool names are accepted 34# 35# STRATEGY: 36# 1. Using a list of valid pool names 37# 2. Create a filesystem in that pool 38# 2. Verify we can set the bootfs to that filesystem 39# 40 41verify_runnable "global" 42 43set -A pools "pool.$$" "pool123" "mypool" 44 45function cleanup { 46 if poolexists $POOL ; then 47 log_must $ZPOOL destroy $POOL 48 fi 49 $RM /bootfs_003.$$.dat 50} 51 52 53$ZPOOL set 2>&1 | $GREP bootfs > /dev/null 54if [ $? -ne 0 ] 55then 56 log_unsupported "bootfs pool property not supported on this release." 57fi 58 59log_onexit cleanup 60 61log_assert "Valid pool names are accepted by zpool set bootfs" 62$MKFILE 64m /bootfs_003.$$.dat 63 64typeset -i i=0; 65 66while [ $i -lt "${#pools[@]}" ] 67do 68 POOL=${pools[$i]} 69 log_must $ZPOOL create $POOL /bootfs_003.$$.dat 70 log_must $ZFS create $POOL/$TESTFS 71 72 log_must $ZPOOL set bootfs=$POOL/$TESTFS $POOL 73 RES=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' ) 74 if [ $RES != "$POOL/$TESTFS" ] 75 then 76 log_fail "Expected $RES == $POOL/$TESTFS" 77 fi 78 log_must $ZPOOL destroy $POOL 79 i=$(( $i + 1 )) 80done 81 82log_pass "Valid pool names are accepted by zpool set bootfs" 83