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 2007 Sun Microsystems, Inc. All rights reserved. 27# Use is subject to license terms. 28# 29# ident "@(#)mountpoint_001_pos.ksh 1.2 07/01/09 SMI" 30# 31 32. $STF_SUITE/include/libtest.kshlib 33. $STF_SUITE/tests/cli_root/zfs_set/zfs_set_common.kshlib 34 35############################################################################### 36# 37# __stc_assertion_start 38# 39# ID: mountpoint_001_pos 40# 41# DESCRIPTION: 42# Setting valid mountpoint to filesystem, it is successful. 43# Whatever is set to volume, it is failed. 44# 'zfs set mountpoint=<path>|legacy|none <fs|ctr|vol>' 45# 46# STRATEGY: 47# 1. Setup a pool and create fs, ctr within it. 48# 2. Loop all the valid mountpoint value. 49# 3. Check the return value. 50# 51# TESTABILITY: explicit 52# 53# TEST_AUTOMATION_LEVEL: automated 54# 55# CODING_STATUS: COMPLETED (2005-07-04) 56# 57# __stc_assertion_end 58# 59################################################################################ 60 61verify_runnable "both" 62 63if is_global_zone ; then 64 set -A dataset \ 65 "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" "$TESTPOOL/$TESTVOL" 66else 67 set -A dataset "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" 68fi 69 70set -A values "$TESTDIR2" "legacy" "none" "$TESTDIR_NOTEXISTING" 71 72function cleanup 73{ 74 log_must $ZFS set mountpoint=$old_ctr_mpt $TESTPOOL/$TESTCTR 75 log_must $ZFS set mountpoint=$old_fs_mpt $TESTPOOL/$TESTFS 76 [[ -d $TESTDIR2 ]] && log_must $RM -r $TESTDIR2 77 [[ -d $TESTDIR_NOTEXISTING ]] && log_must $RM -r $TESTDIR_NOTEXISTING 78} 79 80log_assert "Setting a valid mountpoint to file system, it must be successful." 81log_onexit cleanup 82 83old_fs_mpt=$(get_prop mountpoint $TESTPOOL/$TESTFS) 84[[ $? != 0 ]] && \ 85 log_fail "Get the $TESTPOOL/$TESTFS mountpoint error." 86old_ctr_mpt=$(get_prop mountpoint $TESTPOOL/$TESTCTR) 87[[ $? != 0 ]] && \ 88 log_fail "Get the $TESTPOOL/$TESTCTR mountpoint error." 89 90if [[ ! -d $TESTDIR2 ]]; then 91 log_must $MKDIR $TESTDIR2 92fi 93 94typeset -i i=0 95typeset -i j=0 96while (( i < ${#dataset[@]} )); do 97 j=0 98 while (( j < ${#values[@]} )); do 99 if [[ ${dataset[i]} == "$TESTPOOL/$TESTVOL" ]]; then 100 set_n_check_prop "${values[j]}" "mountpoint" \ 101 "${dataset[i]}" "false" 102 else 103 set_n_check_prop "${values[j]}" "mountpoint" \ 104 "${dataset[i]}" 105 fi 106 (( j += 1 )) 107 done 108 cleanup 109 (( i += 1 )) 110done 111 112log_pass "Setting mountpoint to filesystem pass." 113