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_002_pos.ksh 1.1 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_002_pos 40# 41# DESCRIPTION: 42# If ZFS is currently managing the file system but it is currently unmoutned, 43# and the mountpoint property is changed, the file system remains unmounted. 44# 45# STRATEGY: 46# 1. Setup a pool and create fs, ctr within it. 47# 2. Unmount that dataset 48# 2. Change the mountpoint to the valid mountpoint value. 49# 3. Check the file system remains unmounted. 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 63set -A dataset "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTCTR" 64 65set -A values "$TESTDIR2" "$TESTDIR_NOTEXISTING" 66 67function cleanup 68{ 69 log_must $ZFS set mountpoint=$old_ctr_mpt $TESTPOOL/$TESTCTR 70 log_must $ZFS set mountpoint=$old_fs_mpt $TESTPOOL/$TESTFS 71 log_must $ZFS mount -a 72 [[ -d $TESTDIR2 ]] && log_must $RM -r $TESTDIR2 73 [[ -d $TESTDIR_NOTEXISTING ]] && log_must $RM -r $TESTDIR_NOTEXISTING 74} 75 76log_assert "Setting a valid mountpoint for an unmounted file system, \ 77 it remains unmounted." 78log_onexit cleanup 79 80old_fs_mpt=$(get_prop mountpoint $TESTPOOL/$TESTFS) 81[[ $? != 0 ]] && \ 82 log_fail "Unable to get the mountpoint property for $TESTPOOL/$TESTFS" 83old_ctr_mpt=$(get_prop mountpoint $TESTPOOL/$TESTCTR) 84[[ $? != 0 ]] && \ 85 log_fail "Unable to get the mountpoint property for $TESTPOOL/$TESTCTR" 86 87if [[ ! -d $TESTDIR2 ]]; then 88 log_must $MKDIR $TESTDIR2 89fi 90 91typeset -i i=0 92typeset -i j=0 93while (( i < ${#dataset[@]} )); do 94 j=0 95 if ismounted ${dataset[i]} ; then 96 log_must $ZFS unmount ${dataset[i]} 97 fi 98 log_mustnot ismounted ${dataset[i]} 99 while (( j < ${#values[@]} )); do 100 set_n_check_prop "${values[j]}" "mountpoint" \ 101 "${dataset[i]}" 102 log_mustnot ismounted ${dataset[i]} 103 (( j += 1 )) 104 done 105 cleanup 106 (( i += 1 )) 107done 108 109log_pass "Setting a valid mountpoint for an unmounted file system, \ 110 it remains unmounted." 111