7290 ZFS test suite needs to control what utilities it can run
[unleashed.git] / usr / src / test / zfs-tests / tests / functional / cli_root / zfs_get / zfs_get_008_pos.ksh
blob976beb7ab929eccf8ee1141a730ae8f613e6452a
1 #!/bin/ksh -p
3 # CDDL HEADER START
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]
20 # CDDL HEADER END
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
36 # DESCRIPTION:
37 # Verify "-d <n>" can work with other options
39 # STRATEGY:
40 # 1. Create pool, filesystem, dataset, volume and snapshot.
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 zoned snapdir \
56 aclmode aclinherit canmount primarycache secondarycache \
57 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
58 userquota@root groupquota@root userused@root groupused@root
60 zfs upgrade -v > /dev/null 2>&1
61 if [[ $? -eq 0 ]]; then
62 set -A all_props ${all_props[*]} version
65 set -A dataset $TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
66 $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTVOL@$TESTSNAP
68 log_assert "Verify '-d <n>' can work with other options"
69 log_onexit cleanup
71 # Create volume and filesystem's snapshot
72 create_snapshot $TESTPOOL/$TESTFS $TESTSNAP
73 create_snapshot $TESTPOOL/$TESTVOL $TESTSNAP
75 typeset -i opt_numb=16
76 typeset -i prop_numb=16
77 typeset -i i=0
78 typeset -i item=0
79 typeset -i depth_item=0
81 for dst in ${dataset[@]}; do
82 (( i=0 ))
83 while (( i < opt_numb )); do
84 (( item = $RANDOM % ${#options[@]} ))
85 (( depth_item = $RANDOM % ${#depth_options[@]} ))
86 for prop in $(gen_option_str "${props[*]}" "" "," $prop_numb)
88 log_must eval "zfs get -${depth_options[depth_item]} ${options[item]} $prop $dst > /dev/null 2>&1"
89 done
90 (( i += 1 ))
91 done
92 done
94 log_pass "Verify '-d <n>' can work with other options"