1#!/bin/ksh -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 28# 29# Copyright (c) 2016 by Delphix. All rights reserved. 30# 31 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 34 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 46verify_runnable "both" 47 48log_assert "'zfs get -d <n>' should get expected output." 49log_onexit depth_fs_cleanup 50 51set -A all_props type used available creation volsize referenced \ 52 compressratio mounted origin recordsize quota reservation mountpoint \ 53 sharenfs checksum compression atime devices exec readonly setuid \ 54 zoned snapdir aclmode aclinherit canmount primarycache secondarycache \ 55 usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \ 56 userquota@root groupquota@root userused@root groupused@root 57 58zfs upgrade -v > /dev/null 2>&1 59if [[ $? -eq 0 ]]; then 60 set -A all_props ${all_props[*]} version 61fi 62 63depth_fs_setup 64 65mntpnt=$(get_prop mountpoint $DEPTH_FS) 66DEPTH_OUTPUT="$mntpnt/depth_output" 67EXPECT_OUTPUT="$mntpnt/expect_output" 68typeset -i prop_numb=16 69typeset -i old_val=0 70typeset -i j=0 71typeset eg_opt="$DEPTH_FS"$ 72for dp in ${depth_array[@]}; do 73 (( j=old_val+1 )) 74 while (( j<=dp && j<=MAX_DEPTH )); do 75 eg_opt="$eg_opt""|depth""$j"$ 76 (( j+=1 )) 77 done 78 for prop in $(gen_option_str "${all_props[*]}" "" "," $prop_numb); do 79 log_must eval "zfs get -H -d $dp -o name $prop $DEPTH_FS > $DEPTH_OUTPUT" 80 log_must eval "zfs get -rH -o name $prop $DEPTH_FS | egrep -e '$eg_opt' > $EXPECT_OUTPUT" 81 log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT 82 done 83 (( old_val=dp )) 84done 85 86log_pass "'zfs get -d <n>' should get expected output." 87 88