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_009_pos 35# 36# DESCRIPTION: 37# 'zfs get -d <n>' should get expected output. 38# 39# STRATEGY: 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 shoud be same. 44# 45# TESTABILITY: explicit 46# 47# TEST_AUTOMATION_LEVEL: automated 48# 49# CODING_STATUS: COMPLETED (2009-05-20) 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 61log_assert "'zfs get -d <n>' should get expected output." 62log_onexit depth_fs_cleanup 63 64set -A all_props type used available creation volsize referenced \ 65 compressratio mounted origin recordsize quota reservation mountpoint \ 66 sharenfs checksum compression atime devices exec readonly setuid \ 67 snapdir aclmode aclinherit canmount primarycache secondarycache \ 68 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \ 69 userquota@root groupquota@root userused@root groupused@root 70 71$ZFS upgrade -v > /dev/null 2>&1 72if [[ $? -eq 0 ]]; then 73 set -A all_props ${all_props[*]} version 74fi 75 76depth_fs_setup 77 78mntpnt=$(get_prop mountpoint $DEPTH_FS) 79DEPTH_OUTPUT="$mntpnt/depth_output" 80EXPECT_OUTPUT="$mntpnt/expect_output" 81typeset -i prop_numb=16 82typeset -i old_val=0 83typeset -i j=0 84typeset eg_opt="$DEPTH_FS"$ 85for dp in ${depth_array[@]}; do 86 (( j=old_val+1 )) 87 while (( j<=dp && j<=MAX_DEPTH )); do 88 eg_opt="$eg_opt""|d""$j"$ 89 (( j+=1 )) 90 done 91 for prop in $(gen_option_str "${all_props[*]}" "" "," $prop_numb); do 92 log_must eval "$ZFS get -H -d $dp -o name $prop $DEPTH_FS > $DEPTH_OUTPUT" 93 log_must eval "$ZFS get -rH -o name $prop $DEPTH_FS | $EGREP -e '$eg_opt' > $EXPECT_OUTPUT" 94 log_must $DIFF $DEPTH_OUTPUT $EXPECT_OUTPUT 95 done 96 (( old_val=dp )) 97done 98 99log_pass "'zfs get -d <n>' should get expected output." 100 101