]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - zfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_007_pos.ksh
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) 2013 by Delphix. All rights reserved.
32 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_get
/zfs_get_list_d.kshlib
36 # 'zfs list -d <n>' should get expected output.
39 # 1. 'zfs list -d <n>' to get the output.
40 # 2. 'zfs list -r|egrep' to get the expected output.
41 # 3. Compare the two outputs, they shoud be same.
44 verify_runnable
"both"
46 set -A fs_type
"all" "filesystem" "snapshot"
47 if is_global_zone
; then
48 set -A fs_type
${fs_type[*]} "volume"
53 log_must
$RM -f $DEPTH_OUTPUT
54 log_must
$RM -f $EXPECT_OUTPUT
58 log_assert
"'zfs list -d <n>' should get expected output."
61 DEPTH_OUTPUT
="$mntpnt/depth_output"
62 EXPECT_OUTPUT
="$mntpnt/expect_output"
66 typeset eg_opt
="$DEPTH_FS"$
67 for dp
in ${depth_array[@]}; do
69 while (( j
<=dp
&& j
<=MAX_DEPTH
)); do
70 eg_opt
="$eg_opt""|depth""$j"$
74 while (( fs
<${#fs_type[*]} )); do
75 if [[ "$dp" == "0" ]] && \
76 [[ "${fs_type[$fs]}" == "volume" ||
"${fs_type[$fs]}" == "snapshot" ]]; then
77 log_must
eval "$ZFS list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
78 [[ -s "$DEPTH_OUTPUT" ]] && \
79 log_fail
"$DEPTH_OUTPUT should be null."
80 log_mustnot
$ZFS list
-rH -o name
-t ${fs_type[$fs]} $DEPTH_FS |
$EGREP -e '$eg_opt'
82 log_must
eval "$ZFS list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
83 log_must
eval "$ZFS list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | $EGREP -e '$eg_opt' > $EXPECT_OUTPUT"
84 log_must
$DIFF $DEPTH_OUTPUT $EXPECT_OUTPUT
91 log_pass
"'zfs list -d <n>' should get expected output."