d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Use is subject to license terms.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# Copyright (c) 2016 by Delphix. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_get/zfs_get_common.kshlib
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Setting the valid option and properties 'zfs get' return correct value.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# It should be successful.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 1. Create pool, filesystem, dataset, volume and snapshot.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 2. Getting the options and properties random combination.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 3. Using the combination as the parameters of 'zfs get' to check the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# command line return value.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset zfs_props=("type" used available creation volsize referenced \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy compressratio mounted origin recordsize quota reservation mountpoint \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy sharenfs checksum compression atime devices exec readonly setuid zoned \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy snapdir aclmode aclinherit canmount primarycache secondarycache \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy usedbychildren usedbydataset usedbyrefreservation usedbysnapshots version)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset userquota_props=(userquota@root groupquota@root userused@root \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset props=("${zfs_props[@]}" "${userquota_props[@]}")
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset dataset=($TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTVOL@$TESTSNAP)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_assert "Setting the valid options and properties 'zfs get' return " \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "correct value. It should be successful."
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Create volume and filesystem's snapshot
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedycreate_snapshot $TESTPOOL/$TESTFS $TESTSNAP
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedycreate_snapshot $TESTPOOL/$TESTVOL $TESTSNAP
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Begin to test 'get [-prH] <property[,property]...>
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# <filesystem|dataset|volume|snapshot>'
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 'get [-prH] <-a|-d> <filesystem|dataset|volume|snapshot>"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy # option can be empty, so "" is necessary.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy for opt in "" $(gen_option_str "${options[*]}" "-" "" $opt_numb); do
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy for prop in $(gen_option_str "${props[*]}" "" "," $prop_numb)
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_fail "zfs get $opt $prop $dst (Code: $ret)"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_pass "Setting the valid options to dataset, 'zfs get' pass."