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