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.
29 # Copyright (c) 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/tests/functional/cli_root/zfs_get/zfs_get_common.kshlib
33 . $STF_SUITE/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib
37 # Verify "-d <n>" can work with other options
40 # 1. Create pool, filesystem, dataset, volume, snapshot, and bookmark.
41 # 2. Getting an -d option, other options and properties random combination.
42 # 3. Using the combination as the parameters of 'zfs get' to check the
43 # command line return value.
46 verify_runnable "both"
48 set -A options " " "-r" "-H" "-p" "-rHp" "-o name" \
49 "-s local,default,temporary,inherited,none" \
50 "-o name -s local,default,temporary,inherited,none" \
51 "-rHp -o name -s local,default,temporary,inherited,none"
53 set -A props type used available creation volsize referenced compressratio \
54 mounted origin recordsize quota reservation mountpoint sharenfs \
55 checksum compression atime devices exec readonly setuid snapdir \
56 aclinherit canmount primarycache secondarycache \
57 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
58 userquota@root groupquota@root userused@root groupused@root
60 set -A props ${props[*]} jailed aclmode
62 set -A props ${props[*]} zoned acltype
65 zfs upgrade -v > /dev/null 2>&1
66 if [[ $? -eq 0 ]]; then
67 set -A props ${props[*]} version
70 set -A dataset $TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
71 $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTVOL@$TESTSNAP
73 set -A bookmark_props creation
74 set -A bookmark $TESTPOOL/$TESTFS#$TESTBKMARK $TESTPOOL/$TESTVOL#$TESTBKMARK
76 log_assert "Verify '-d <n>' can work with other options"
79 # Create volume and filesystem's snapshot
80 create_snapshot $TESTPOOL/$TESTFS $TESTSNAP
81 create_snapshot $TESTPOOL/$TESTVOL $TESTSNAP
83 # Create filesystem and volume's bookmark
84 create_bookmark $TESTPOOL/$TESTFS $TESTSNAP $TESTBKMARK
85 create_bookmark $TESTPOOL/$TESTVOL $TESTSNAP $TESTBKMARK
87 typeset -i opt_numb=16
88 typeset -i prop_numb=16
91 typeset -i depth_item=0
93 for dst in ${dataset[@]}; do
95 while (( i < opt_numb )); do
96 (( item = $RANDOM % ${#options[@]} ))
97 (( depth_item = $RANDOM % ${#depth_options[@]} ))
98 for prop in $(gen_option_str "${props[*]}" "" "," $prop_numb)
100 log_must eval "zfs get -${depth_options[depth_item]} ${options[item]} $prop $dst > /dev/null 2>&1"
106 for dst in ${bookmark[@]}; do
108 while (( i < opt_numb )); do
109 (( item = $RANDOM % ${#options[@]} ))
110 (( depth_item = $RANDOM % ${#depth_options[@]} ))
111 log_must eval "zfs get -${depth_options[depth_item]} ${options[item]} $bookmark_props $dst > /dev/null 2>&1"
116 log_pass "Verify '-d <n>' can work with other options"