1#!/bin/ksh -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 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27 28# 29# Copyright (c) 2016 by Delphix. All rights reserved. 30# 31 32. $STF_SUITE/include/libtest.shlib 33. $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib 34 35# 36# DESCRIPTION: 37# 'zfs inherit' should return an error with bad parameters in one command. 38# 39# STRATEGY: 40# 1. Set an array of bad options and invalid properties to 'zfs inherit' 41# 2. Execute 'zfs inherit' with bad options and passing invalid properties 42# 3. Verify an error is returned. 43# 44 45verify_runnable "both" 46 47function cleanup 48{ 49 for ds in $TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL ; do 50 snapexists $ds@$TESTSNAP && destroy_dataset $ds@$TESTSNAP 51 done 52 cleanup_user_prop $TESTPOOL 53} 54 55log_assert "'zfs inherit' should inherit user property." 56log_onexit cleanup 57 58for ds in $TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL ; do 59 typeset prop_name=$(valid_user_property 10) 60 typeset value=$(user_property_value 16) 61 62 log_must eval "zfs set $prop_name='$value' $ds" 63 64 log_must zfs snapshot $ds@$TESTSNAP 65 66 typeset snapvalue=$(get_prop $prop_name $ds@$TESTSNAP) 67 68 if [[ "$snapvalue" != "$value" ]] ; then 69 log_fail "The '$ds@$TESTSNAP '$prop_name' value '$snapvalue' " \ 70 "not equal to the expected value '$value'." 71 fi 72 73 snapvalue=$(user_property_value 16) 74 log_must eval "zfs set $prop_name='$snapvalue' $ds@$TESTSNAP" 75 76 log_must zfs inherit $prop_name $ds@$TESTSNAP 77 78 snapvalue=$(get_prop $prop_name $ds@$TESTSNAP) 79 80 if [[ "$snapvalue" != "$value" ]] ; then 81 log_fail "The '$ds@$TESTSNAP '$prop_name' value '$snapvalue' " \ 82 "not equal to the expected value '$value'." 83 fi 84 85 86done 87 88log_pass "'zfs inherit' inherit user property." 89