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. $STF_SUITE/include/libtest.kshlib 27. $STF_SUITE/tests/cli_root/zfs_mount/zfs_mount.kshlib 28 29################################################################################ 30# 31# __stc_assertion_start 32# 33# ID: zfs_mount_009_neg 34# 35# DESCRIPTION: 36# Try each 'zfs mount' with inapplicable scenarios to make sure 37# it returns an error. include: 38# * Multiple filesystems specified 39# * '-a', but also with a specific filesystem. 40# 41# STRATEGY: 42# 1. Create an array of parameters 43# 2. For each parameter in the array, execute the sub-command 44# 3. Verify an error is returned. 45# 46# TESTABILITY: explicit 47# 48# TEST_AUTOMATION_LEVEL: automated 49# 50# CODING_STATUS: COMPLETED (2005-07-07) 51# 52# __stc_assertion_end 53# 54################################################################################ 55 56verify_runnable "both" 57 58multifs="$TESTFS $TESTFS1" 59datasets="" 60 61for fs in $multifs ; do 62 datasets="$datasets $TESTPOOL/$fs" 63done 64 65set -A args "$mountall $TESTPOOL/$TESTFS" \ 66 "$mountcmd $datasets" 67 68function setup_all 69{ 70 typeset fs 71 72 for fs in $multifs ; do 73 setup_filesystem "$DISKS" "$TESTPOOL" \ 74 "$fs" \ 75 "${TEST_BASE_DIR%%/}/testroot${TESTCASE_ID}/$TESTPOOL/$fs" 76 done 77 return 0 78} 79 80function cleanup_all 81{ 82 typeset fs 83 84 cleanup_filesystem "$TESTPOOL" "$TESTFS1" 85 log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS 86 87 [[ -d ${TEST_BASE_DIR%%/}/testroot${TESTCASE_ID} ]] && \ 88 $RM -rf ${TEST_BASE_DIR%%/}/testroot${TESTCASE_ID} 89 90 91 return 0 92} 93 94function verify_all 95{ 96 typeset fs 97 98 for fs in $multifs ; do 99 log_must unmounted $TESTPOOL/$fs 100 done 101 return 0 102} 103 104log_assert "Badly-formed 'zfs $mountcmd' with inapplicable scenarios " \ 105 "should return an error." 106 107log_onexit cleanup_all 108 109log_must setup_all 110 111log_must $ZFS $unmountall 112 113typeset -i i=0 114while (( i < ${#args[*]} )); do 115 log_mustnot $ZFS ${args[i]} 116 ((i = i + 1)) 117done 118 119log_must verify_all 120 121log_pass "Badly formed 'zfs $mountcmd' with inapplicable scenarios " \ 122 "fail as expected." 123