xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib (revision 7a5aac98bc37534537d4896efd4efd30627d221e)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27. $STF_SUITE/include/libtest.shlib
28
29DEPTH_FS=$TESTPOOL/depth_fs
30MAX_DEPTH=3
31DS_COUNT=3
32set -A depth_options  "d 0" "d 1" "d 2" "d 4" "d 32"
33set -A depth_array  0 1 2 4 32
34
35#
36# Setup multiple depths datasets, including fs, volume and snapshot.
37#
38function depth_fs_setup
39{
40	typeset -i i j k
41	typeset fslist
42
43	log_must $ZFS create $DEPTH_FS
44
45	(( i=1 ))
46	while (( i<=MAX_DEPTH )); do
47		if (( i==1 )); then
48			fslist=$DEPTH_FS
49		else
50			(( k=i-1 ))
51			fslist=$($ZFS list -rH -t filesystem -o name $DEPTH_FS|$GREP depth"$k"$)
52			if (( $? != 0 )); then
53				log_fail "No depth$k filesystem"
54			fi
55		fi
56		for fs in $fslist; do
57			(( j=1 ))
58			while (( j<=DS_COUNT )); do
59				log_must $ZFS create $fs/fs_"$j"_depth"$i"
60				if is_global_zone ; then
61					log_must $ZFS create -V 8M $fs/vol_"$j"_depth"$i"
62				fi
63				log_must $ZFS snapshot $fs@snap_"$j"_depth"$i"
64				(( j=j+1 ))
65			done
66		done
67		(( i=i+1 ))
68	done
69}
70
71#
72# Cleanup multiple depths filesystem.
73#
74function depth_fs_cleanup
75{
76	log_must $ZFS destroy -rR $DEPTH_FS
77}
78
79
80