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# $FreeBSD$ 24 25# 26# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 27# Use is subject to license terms. 28# 29# ident "@(#)cachefile_001_pos.ksh 1.1 08/02/29 SMI" 30# 31 32. $STF_SUITE/include/libtest.kshlib 33. $STF_SUITE/tests/cachefile/cachefile.kshlib 34 35################################################################################ 36# 37# __stc_assertion_start 38# 39# ID: cachefile_001_pos 40# 41# DESCRIPTION: 42# 43# Creating a pool with "cachefile" set doesn't update zpool.cache 44# 45# STRATEGY: 46# 1. Create a pool with the cachefile property set 47# 2. Verify that the pool doesn't have an entry in zpool.cache 48# 3. Verify the cachefile property is set 49# 4. Create a pool without the cachefile property 50# 5. Verify the cachefile property isn't set 51# 6. Verify that zpool.cache contains an entry for the pool 52# 53# TESTABILITY: explicit 54# 55# TEST_AUTOMATION_LEVEL: automated 56# 57# CODING_STATUS: COMPLETED (2007-09-05) 58# 59# __stc_assertion_end 60# 61################################################################################ 62 63function cleanup 64{ 65 typeset file 66 67 destroy_pool $TESTPOOL 68 for file in $CPATH1 $CPATH2 ; do 69 if [[ -f $file ]] ; then 70 log_must $RM $file 71 fi 72 done 73} 74 75verify_runnable "global" 76 77log_assert "Creating a pool with \"cachefile\" set doesn't update zpool.cache" 78log_onexit cleanup 79 80CPATHARG="-" 81set -A opts "none" "false" "none" \ 82 "$CPATH" "true" "$CPATHARG" \ 83 "$CPATH1" "true" "$CPATH1" \ 84 "$CPATH2" "true" "$CPATH2" 85 86typeset -i i=0 87 88while (( i < ${#opts[*]} )); do 89 log_must $ZPOOL create -o cachefile=${opts[i]} $TESTPOOL $DISKS 90 case ${opts[((i+1))]} in 91 false) log_mustnot pool_in_cache $TESTPOOL 92 ;; 93 true) log_must pool_in_cache $TESTPOOL ${opts[i]} 94 ;; 95 esac 96 97 PROP=$(get_pool_prop cachefile $TESTPOOL) 98 if [[ $PROP != ${opts[((i+2))]} ]]; then 99 log_fail "cachefile property not set as expected. " \ 100 "Expect: ${opts[((i+2))]}, Current: $PROP" 101 fi 102 log_must $ZPOOL destroy $TESTPOOL 103 (( i = i + 3 )) 104done 105 106log_pass "Creating a pool with \"cachefile\" set doesn't update zpool.cache" 107 108