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 # 'zfs get -d <n>' should get expected output.
40 # 1. Create a multiple depth filesystem.
41 # 2. 'zfs get -d <n>' to get the output.
42 # 3. 'zfs get -r|egrep' to get the expected output.
43 # 4. Compare the two outputs, they should be same.
46 verify_runnable
"both"
49 log_unsupported
"Test case runs slowly when kmemleak is enabled"
52 log_assert
"'zfs get -d <n>' should get expected output."
53 log_onexit depth_fs_cleanup
55 set -A all_props
type used available creation volsize referenced \
56 compressratio mounted origin recordsize quota reservation mountpoint \
57 sharenfs checksum compression atime devices
exec readonly setuid \
58 snapdir aclinherit canmount primarycache secondarycache \
59 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
60 userquota@root groupquota@root userused@root groupused@root
62 set -A all_props
${all_props[*]} jailed aclmode
64 set -A all_props
${all_props[*]} zoned acltype
67 zfs upgrade
-v > /dev
/null
2>&1
68 if [[ $?
-eq 0 ]]; then
69 set -A all_props
${all_props[*]} version
74 mntpnt
=$
(get_prop mountpoint
$DEPTH_FS)
75 DEPTH_OUTPUT
="$mntpnt/depth_output"
76 EXPECT_OUTPUT
="$mntpnt/expect_output"
77 typeset
-i prop_numb
=16
80 typeset eg_opt
="$DEPTH_FS"$
81 for dp
in ${depth_array[@]}; do
83 while (( j
<=dp
&& j
<=MAX_DEPTH
)); do
84 eg_opt
="$eg_opt""|depth""$j"$
87 for prop
in $
(gen_option_str
"${all_props[*]}" "" "," $prop_numb); do
88 log_must
eval "zfs get -H -d $dp -o name $prop $DEPTH_FS > $DEPTH_OUTPUT"
89 log_must
eval "zfs get -rH -o name $prop $DEPTH_FS | egrep -e '$eg_opt' > $EXPECT_OUTPUT"
90 log_must
diff $DEPTH_OUTPUT $EXPECT_OUTPUT
95 # Ensure 'zfs get -t snapshot <dataset>' works as though -d 1 was specified
96 log_must
eval "zfs get -H -t snapshot -o name creation $DEPTH_FS > $DEPTH_OUTPUT"
97 log_must
eval "zfs get -H -t snapshot -d 1 -o name creation $DEPTH_FS > $EXPECT_OUTPUT"
98 log_must
diff $DEPTH_OUTPUT $EXPECT_OUTPUT
100 # Ensure 'zfs get -t snap' works as a shorthand for 'zfs get -t snapshot'
101 log_must
eval "zfs get -H -t snap -d 1 -o name creation $DEPTH_FS > $DEPTH_OUTPUT"
102 log_must
eval "zfs get -H -t snapshot -d 1 -o name creation $DEPTH_FS > $EXPECT_OUTPUT"
103 log_must
diff $DEPTH_OUTPUT $EXPECT_OUTPUT
105 # Ensure 'zfs get -t bookmark <dataset>' works as though -d 1 was specified
106 log_must
eval "zfs get -H -t bookmark -o name creation $DEPTH_FS > $DEPTH_OUTPUT"
107 log_must
eval "zfs get -H -t bookmark -d 1 -o name creation $DEPTH_FS > $EXPECT_OUTPUT"
108 log_must
diff $DEPTH_OUTPUT $EXPECT_OUTPUT
111 log_pass
"'zfs get -d <n>' should get expected output."