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 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27# ident "@(#)zpool_create_018_pos.ksh 1.4 09/06/22 SMI" 28# 29 30. $STF_SUITE/include/libtest.kshlib 31. $STF_SUITE/tests/cli_root/zpool_create/zpool_create.kshlib 32 33################################################################################ 34# 35# __stc_assertion_start 36# 37# ID: zpool_create_018_pos 38# 39# DESCRIPTION: 40# 41# zpool create can create pools with specified properties 42# 43# STRATEGY: 44# 1. Create a pool with all editable properties 45# 2. Verify those properties are set 46# 3. Create a pool with two properties set 47# 4. Verify both properties are set correctly 48# 49# TESTABILITY: explicit 50# 51# TEST_AUTOMATION_LEVEL: automated 52# 53# CODING_STATUS: COMPLETED (2007-07-27) 54# 55# __stc_assertion_end 56# 57################################################################################ 58 59function cleanup 60{ 61 destroy_pool $TESTPOOL 62 63 if [[ -f $CPATH ]] ; then 64 log_must $RM $CPATH 65 fi 66} 67 68log_onexit cleanup 69log_assert "zpool create can create pools with specified properties" 70 71if [[ -n $DISK ]]; then 72 disk=$DISK 73else 74 disk=$DISK0 75fi 76 77# we don't include "root" property in this list, as it requires both "cachefile" 78# and "root" to be set at the same time. A test for this is included in 79# ../../root. 80set -A props "autoreplace" "delegation" "cachefile" "version" 81set -A vals "off" "off" "$CPATH" "3" 82 83if pool_prop_exist autoexpand ; then 84 set -A props ${props[*]} "autoexpand" 85 set -A vals ${vals[*]} "on" 86fi 87 88typeset -i i=0; 89while [ $i -lt "${#props[@]}" ] 90do 91 log_must $ZPOOL create -o ${props[$i]}=${vals[$i]} $TESTPOOL $disk 92 RESULT=$(get_pool_prop ${props[$i]} $TESTPOOL) 93 if [[ $RESULT != ${vals[$i]} ]] 94 then 95 $ZPOOL get all $TESTPOOL 96 log_fail "Pool was created without setting the ${props[$i]} property" 97 fi 98 destroy_pool $TESTPOOL 99 (( i = i + 1 )) 100done 101 102# pick two properties, and verify we can create with those as well 103log_must $ZPOOL create -o delegation=off -o cachefile=$CPATH $TESTPOOL $disk 104RESULT=$(get_pool_prop delegation $TESTPOOL) 105if [[ $RESULT != off ]] 106then 107 $ZPOOL get all $TESTPOOL 108 log_fail "Pool created without the delegation prop." 109fi 110 111RESULT=$(get_pool_prop cachefile $TESTPOOL) 112if [[ $RESULT != $CPATH ]] 113then 114 $ZPOOL get all $TESTPOOL 115 log_fail "Pool created without the cachefile prop." 116fi 117 118log_pass "zpool create can create pools with specified properties" 119