]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh
Add the ZFS Test Suite
[mirror_zfs.git] / tests / zfs-tests / tests / functional / cli_user / zfs_list / zfs_list_003_pos.ksh
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 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 #
29 # Copyright (c) 2013 by Delphix. All rights reserved.
30 #
31
32 . $STF_SUITE/include/libtest.shlib
33
34 #
35 # DESCRIPTION:
36 # Verify 'zfs list -r' could recursively display any children
37 # of the dataset.
38 #
39 # STRATEGY:
40 # 1. Prepare a set of datasets by hierarchy.
41 # 2. Execute 'zfs list -r' at the top of these datasets.
42 # 3. Verify all child datasets are all be shown.
43 #
44
45 function cleanup
46 {
47 if [[ -f $tmpfile ]]; then
48 $RM -f $tmpfile
49 fi
50 }
51
52 verify_runnable "both"
53 log_onexit cleanup
54
55 log_assert "Verify 'zfs list -r' could display any children recursively."
56
57 tmpfile=/var/tmp/zfslist.out.$$
58 children="$TESTPOOL/$TESTFS"
59
60 for fs in $DATASETS ; do
61 children="$children $TESTPOOL/$TESTFS/$fs"
62 done
63
64 cd /tmp
65
66 for path in $TESTPOOL/$TESTFS $TESTDIR ./../$TESTDIR ; do
67 $ZFS list -rH -o name $path > $tmpfile
68 for fs in $children ; do
69 $GREP "^${fs}$" $tmpfile > /dev/null 2>&1
70 if (( $? != 0 )); then
71 log_fail "$fs not shown in the output list."
72 fi
73 done
74 done
75
76 log_pass "'zfs list -r' could display any children recursively."