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# $FreeBSD$
24
25#
26# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29# ident	"@(#)setup.ksh	1.6	09/06/22 SMI"
30#
31
32. $STF_SUITE/include/libtest.kshlib
33. $STF_SUITE/tests/cli_root/zfs_get/zfs_get_list_d.kshlib
34
35DISK=${DISKS%% *}
36
37default_setup_noexit $DISK
38
39# create datasets and set checksum options
40set -A cksumarray $CKSUMOPTS
41typeset -i index=0
42for dataset in $DATASETS
43do
44	log_must $ZFS create $TESTPOOL/$TESTFS/$dataset
45	enc=$(get_prop encryption $TESTPOOL/$TESTFS/$dataset)
46	if [[ $? -eq 0 ]] && [[ -n "$enc" ]] && [[ "$enc" != "off" ]]; then
47		log_unsupported "checksum property can't be changed \
48when encryption is set to on."
49	fi
50	$SLEEP 1
51        log_must $ZFS snapshot $TESTPOOL/$TESTFS/${dataset}@snap
52
53	$SLEEP 1
54	if is_global_zone ; then
55		log_must $ZFS create -V 64M $TESTPOOL/$TESTFS/${dataset}-vol
56		$SLEEP 1
57		log_must $ZFS snapshot $TESTPOOL/$TESTFS/${dataset}-vol@snap
58	fi
59
60	# sleep to ensure that the datasets have different creation dates
61	$SLEEP 1
62	log_must $ZFS set checksum=${cksumarray[$index]} \
63		$TESTPOOL/$TESTFS/$dataset
64	if datasetexists $TESTPOOL/$TESTFS/${dataset}-vol; then
65        	log_must $ZFS set checksum=${cksumarray[$index]} \
66	    		$TESTPOOL/$TESTFS/${dataset}-vol
67	fi
68
69        index=$((index + 1))
70done
71
72if zfs_get_list_d_supported ; then
73	depth_fs_setup
74fi
75
76log_pass
77