d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#!/bin/ksh -p
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Use is subject to license terms.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy#
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# Copyright (c) 2016 by Delphix. All rights reserved.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy#
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_get/zfs_get_common.kshlib
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# DESCRIPTION:
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Verify "-d <n>" can work with other options
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# STRATEGY:
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka# 1. Create pool, filesystem, dataset, volume, snapshot, and bookmark.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 2. Getting an -d option, other options and properties random combination.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 3. Using the combination as the parameters of 'zfs get' to check the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# command line return value.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyverify_runnable "both"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyset -A options " " "-r" "-H" "-p" "-rHp" "-o name" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-s local,default,temporary,inherited,none" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-o name -s local,default,temporary,inherited,none" \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "-rHp -o name -s local,default,temporary,inherited,none"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyset -A props type used available creation volsize referenced compressratio \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy mounted origin recordsize quota reservation mountpoint sharenfs \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy checksum compression atime devices exec readonly setuid zoned snapdir \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy aclmode aclinherit canmount primarycache secondarycache \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy userquota@root groupquota@root userused@root groupused@root
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedyzfs upgrade -v > /dev/null 2>&1
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyif [[ $? -eq 0 ]]; then
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy set -A all_props ${all_props[*]} version
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyfi
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyset -A dataset $TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTVOL@$TESTSNAP
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telkaset -A bookmark_props creation
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telkaset -A bookmark $TESTPOOL/$TESTFS#$TESTBKMARK $TESTPOOL/$TESTVOL#$TESTBKMARK
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_assert "Verify '-d <n>' can work with other options"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_onexit cleanup
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Create volume and filesystem's snapshot
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedycreate_snapshot $TESTPOOL/$TESTFS $TESTSNAP
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedycreate_snapshot $TESTPOOL/$TESTVOL $TESTSNAP
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka# Create filesystem and volume's bookmark
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telkacreate_bookmark $TESTPOOL/$TESTFS $TESTSNAP $TESTBKMARK
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telkacreate_bookmark $TESTPOOL/$TESTVOL $TESTSNAP $TESTBKMARK
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset -i opt_numb=16
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset -i prop_numb=16
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset -i i=0
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset -i item=0
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypeset -i depth_item=0
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyfor dst in ${dataset[@]}; do
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy (( i=0 ))
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy while (( i < opt_numb )); do
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy (( item = $RANDOM % ${#options[@]} ))
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy (( depth_item = $RANDOM % ${#depth_options[@]} ))
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy for prop in $(gen_option_str "${props[*]}" "" "," $prop_numb)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy do
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must eval "zfs get -${depth_options[depth_item]} ${options[item]} $prop $dst > /dev/null 2>&1"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy done
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy (( i += 1 ))
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy done
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedydone
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telkafor dst in ${bookmark[@]}; do
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka (( i=0 ))
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka while (( i < opt_numb )); do
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka (( item = $RANDOM % ${#options[@]} ))
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka (( depth_item = $RANDOM % ${#depth_options[@]} ))
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka log_must eval "$ZFS get -${depth_options[depth_item]} ${options[item]} $bookmark_props $dst > /dev/null 2>&1"
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka (( i += 1 ))
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka done
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telkadone
edb901aab9c738b5eb15aa55933e82b0f2f9d9a2Marcel Telka
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_pass "Verify '-d <n>' can work with other options"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy