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.
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.
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]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_get
/zfs_get_common.kshlib
32 # Setting the valid option and properties 'zfs get' return correct value.
33 # It should be successful.
36 # 1. Create pool, filesystem, dataset, volume and snapshot.
37 # 2. Getting the options and properties random combination.
38 # 3. Using the combination as the parameters of 'zfs get' to check the
39 # command line return value.
42 verify_runnable
"both"
44 typeset options
=(" " p r H
)
46 typeset zfs_props
=("type" used available creation volsize referenced \
47 compressratio mounted origin recordsize quota reservation mountpoint \
48 sharenfs checksum compression atime devices
exec readonly setuid zoned \
49 snapdir acltype aclinherit canmount primarycache secondarycache \
50 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots version
)
52 typeset userquota_props
=(userquota@root groupquota@root userused@root \
54 typeset props
=("${zfs_props[@]}" "${userquota_props[@]}")
55 typeset dataset
=($TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
56 $TESTPOOL/$TESTFS@
$TESTSNAP $TESTPOOL/$TESTVOL@
$TESTSNAP)
58 log_assert
"Setting the valid options and properties 'zfs get' return " \
59 "correct value. It should be successful."
62 # Create volume and filesystem's snapshot
63 create_snapshot
$TESTPOOL/$TESTFS $TESTSNAP
64 create_snapshot
$TESTPOOL/$TESTVOL $TESTSNAP
67 # Begin to test 'get [-prH] <property[,property]...>
68 # <filesystem|dataset|volume|snapshot>'
69 # 'get [-prH] <-a|-d> <filesystem|dataset|volume|snapshot>"
72 typeset
-i prop_numb
=20
73 for dst
in ${dataset[@]}; do
74 # option can be empty, so "" is necessary.
75 for opt
in "" $
(gen_option_str
"${options[*]}" "-" "" $opt_numb); do
76 for prop
in $
(gen_option_str
"${props[*]}" "" "," $prop_numb)
78 $ZFS get
$opt $prop $dst > /dev
/null
2>&1
80 if [[ $ret != 0 ]]; then
81 log_fail
"$ZFS get $opt $prop $dst (Code: $ret)"
87 log_pass
"Setting the valid options to dataset, 'zfs get' pass."