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# 28# ident "@(#)mounttest.ksh 1.2 07/01/09 SMI" 29# 30. $STF_SUITE/include/libtest.kshlib 31 32################################################################################ 33# 34# __stc_assertion_start 35# 36# ID: mounttest 37# 38# DESCRIPTION: 39# zfs mount and unmount commands should mount and unmount existing 40# file systems. 41# 42# STRATEGY: 43# 1. Call zfs mount command 44# 2. Make sure the file systems were mounted 45# 3. Call zfs unmount command 46# 4. Make sure the file systems were unmounted 47# 48# TESTABILITY: explicit 49# 50# TEST_AUTOMATION_LEVEL: automated 51# 52# CODING_STATUS: COMPLETED (2005-07-04) 53# 54# __stc_assertion_end 55# 56################################################################################ 57 58 59unmountcmd="" 60while getopts u: OPT ; do 61 case $OPT in 62 u) unmountcmd=$OPTARG 63 ;; 64 ?) log_fail Usage: $0 [-u unmountcmd] 65 ;; 66 esac 67done 68 69log_note Mount file systems 70typeset -i i=1 71for fs in $TESTFSS ; do 72 log_must $ZFS mount $fs 73 ((i = i + 1)) 74done 75 76log_note Make sure the file systems were mounted 77for fs in $TESTFSS ; do 78 mounted $fs || log_fail File system $fs not mounted 79done 80 81log_note Unmount the file systems 82if [[ $unmountcmd = *all ]] ; then 83 log_must $ZFS $unmountcmd -F zfs 84else 85 if [[ $unmountcmd = *-a ]] ; then 86 log_must $ZFS $unmountcmd 87 else 88 for fs in $TESTFSS ; do 89 log_must $ZFS $unmountcmd $fs 90 done 91 fi 92fi 93 94log_note Make sure the file systems were unmounted 95for fs in $TESTFSS ; do 96 unmounted $fs || log_fail File system $fs not unmounted 97done 98 99log_pass All file systems are unmounted 100