1#!/usr/local/bin/ksh93 -p 2# 3# CDDL HEADER START 4# 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. 8# 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. 13# 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] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/tests/cli_root/zfs_get/zfs_get_common.kshlib 28. $STF_SUITE/tests/cli_root/zfs_get/zfs_get_list_d.kshlib 29 30############################################################################### 31# 32# __stc_assertion_start 33# 34# ID: zfs_get_008_pos 35# 36# DESCRIPTION: 37# Verify "-d <n>" can work with other options 38# 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. 44# 45# TESTABILITY: explicit 46# 47# TEST_AUTOMATION_LEVEL: automated 48# 49# CODING_STATUS: COMPLETED (2009-05-22) 50# 51# __stc_assertion_end 52# 53################################################################################ 54 55verify_runnable "both" 56 57if ! zfs_get_list_d_supported ; then 58 log_unsupported "'zfs get -d' is not supported." 59fi 60 61set -A options " " "-r" "-H" "-p" "-rHp" "-o name" \ 62 "-s local,default,temporary,inherited,none" \ 63 "-o name -s local,default,temporary,inherited,none" \ 64 "-rHp -o name -s local,default,temporary,inherited,none" 65 66set -A props type used available creation volsize referenced compressratio \ 67 mounted origin recordsize quota reservation mountpoint sharenfs \ 68 checksum compression atime devices exec readonly setuid snapdir \ 69 aclmode aclinherit canmount primarycache secondarycache \ 70 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \ 71 userquota@root groupquota@root userused@root groupused@root 72 73$ZFS upgrade -v > /dev/null 2>&1 74if [[ $? -eq 0 ]]; then 75 set -A all_props ${all_props[*]} version 76fi 77 78set -A dataset $TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \ 79 $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTVOL@$TESTSNAP 80 81log_assert "Verify '-d <n>' can work with other options" 82log_onexit cleanup 83 84# Create volume and filesystem's snapshot 85create_snapshot $TESTPOOL/$TESTFS $TESTSNAP 86create_snapshot $TESTPOOL/$TESTVOL $TESTSNAP 87 88typeset -i opt_numb=16 89typeset -i prop_numb=16 90typeset -i i=0 91typeset -i item=0 92typeset -i depth_item=0 93 94for dst in ${dataset[@]}; do 95 (( i=0 )) 96 while (( i < opt_numb )); do 97 (( item = $RANDOM % ${#options[@]} )) 98 (( depth_item = $RANDOM % ${#depth_options[@]} )) 99 for prop in $(gen_option_str "${props[*]}" "" "," $prop_numb) 100 do 101 log_must eval "$ZFS get -${depth_options[depth_item]} ${options[item]} $prop $dst > /dev/null 2>&1" 102 done 103 (( i += 1 )) 104 done 105done 106 107log_pass "Verify '-d <n>' can work with other options" 108 109