zfs_share_002_pos.ksh revision d583b39bfb4e2571d3e41097c5c357ffe353ad45
286N/A#!/bin/ksh -p
286N/A#
286N/A# CDDL HEADER START
286N/A#
286N/A# The contents of this file are subject to the terms of the
286N/A# Common Development and Distribution License (the "License").
286N/A# You may not use this file except in compliance with the License.
286N/A#
286N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
286N/A# or http://www.opensolaris.org/os/licensing.
286N/A# See the License for the specific language governing permissions
286N/A# and limitations under the License.
286N/A#
286N/A# When distributing Covered Code, include this CDDL HEADER in each
286N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
286N/A# If applicable, add the following below this CDDL HEADER, with the
286N/A# fields enclosed by brackets "[]" replaced with your own identifying
286N/A# information: Portions Copyright [yyyy] [name of copyright owner]
286N/A#
286N/A# CDDL HEADER END
286N/A#
286N/A
286N/A#
286N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
286N/A# Use is subject to license terms.
286N/A#
286N/A
286N/A#
286N/A# Copyright (c) 2012 by Delphix. All rights reserved.
286N/A#
286N/A
286N/A. $STF_SUITE/include/libtest.shlib
286N/A. $STF_SUITE/tests/functional/cli_root/zfs_share/zfs_share.cfg
286N/A
286N/A#
286N/A# DESCRIPTION:
286N/A# Verify that "zfs share" with a non-existent file system fails.
286N/A#
286N/A# STRATEGY:
286N/A# 1. Make sure the NONEXISTFSNAME ZFS file system is not in 'zfs list'.
286N/A# 2. Invoke 'zfs share <file system>'.
286N/A# 3. Verify that share fails
286N/A#
286N/A
286N/Averify_runnable "both"
286N/A
286N/Afunction cleanup
286N/A{
286N/A typeset fs
286N/A for fs in $NONEXISTFSNAME $TESTFS ; do
286N/A log_must unshare_fs $TESTPOOL/$fs
286N/A done
286N/A}
286N/A
286N/Atypeset -i ret=0
286N/A
286N/Alog_assert "Verify that "zfs share" with a non-existent file system fails."
286N/A
286N/Alog_onexit cleanup
286N/A
286N/Alog_mustnot $ZFS list $TESTPOOL/$NONEXISTFSNAME
286N/A
286N/A$ZFS share $TESTPOOL/$NONEXISTFSNAME
286N/Aret=$?
286N/A(( ret == 1)) || \
286N/A log_fail "'$ZFS share $TESTPOOL/$NONEXISTFSNAME' " \
286N/A "failed with an unexpected return code of $ret."
286N/A
286N/Alog_note "Make sure the file system $TESTPOOL/$NONEXISTFSNAME is unshared"
286N/Anot_shared $TESTPOOL/$NONEXISTFSNAME || \
286N/A log_fail "File system $TESTPOOL/$NONEXISTFSNAME is unexpectedly shared."
286N/A
286N/Alog_pass "'$ZFS share' with a non-existent file system fails."
286N/A