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 2007 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_004_neg 34# 35# DESCRIPTION: 36# 37# Invalid pool names are rejected by zpool set bootfs 38# 39# STRATEGY: 40# 1. Try to set bootfs on some non-existent pools 41# 42# 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}" "pool%d123" "mirror" "c0t0d0s0" "pool*23*" "*po!l" \ 57 "%s££%^" 58typeset VDEV=$TMPDIR/bootfs_004.${TESTCASE_ID}.dat 59 60function cleanup { 61 typeset -i=0 62 while [ $i -lt "${#pools[@]}" ]; do 63 destroy_pool ${pools[$i]} 64 i=$(( $i + 1 )) 65 done 66 $RM $VDEV 67} 68 69 70$ZPOOL set 2>&1 | $GREP bootfs > /dev/null 71if [ $? -ne 0 ] 72then 73 log_unsupported "bootfs pool property not supported on this release." 74fi 75 76log_assert "Invalid pool names are rejected by zpool set bootfs" 77log_onexit cleanup 78 79# here, we build up a large string and add it to the list of pool names 80# a word to the ksh-wary, ${#array[@]} gives you the 81# total number of entries in an array, so array[${#array[@]}] 82# will index the last entry+1, ksh arrays start at index 0. 83COUNT=0 84while [ $COUNT -le 1025 ] 85do 86 bigname="${bigname}o" 87 COUNT=$(( $COUNT + 1 )) 88done 89pools[${#pools[@]}]="$bigname" 90 91 92create_vdevs $VDEV 93typeset -i i=0; 94 95while [ $i -lt "${#pools[@]}" ] 96do 97 POOL=${pools[$i]}/$FS 98 log_mustnot $ZPOOL create $POOL $VDEV 99 log_mustnot $ZFS create $POOL/$FS 100 log_mustnot $ZPOOL set bootfs=$POOL/$FS $POOL 101 102 i=$(( $i + 1 )) 103done 104 105log_pass "Invalid pool names are rejected by zpool set bootfs" 106