Index: projects/zfsd/head/tests/sys/cddl/zfs/include/constants.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/constants.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/constants.cfg (revision 329035) @@ -1,111 +1,112 @@ #!/usr/bin/env ksh93 +# vim: filetype=sh # Add test-specific binaries to PATH export PATH=${STF_SUITE}/bin:${PATH} export TMPDIR=${TMPDIR-/tmp} # Set default value of TMPDIR export TMPDIR=${TMPDIR-/tmp} # Define run length constants export RT_LONG="3" export RT_MEDIUM="2" export RT_SHORT="1" # Define macro for zone test export ZONE_POOL="zonepool" export ZONE_CTR="zonectr" # Test Suite Specific Commands export DEVNAME2DEVID="devname2devid" export FILE_WRITE="file_write" export FILE_CHECK="file_check" export LARGEST_FILE="largest_file" export MMAPWRITE="mmapwrite" export MKFILE="mkfile" export READMMAP="readmmap" export FILE_TRUNC="file_trunc" export CHG_USR_EXEC="chg_usr_exec" export MKTREE="mktree" export RANDFREE_FILE="randfree_file" export DIR_RD_UPDATE="dir_rd_update" export RM_LNKCNT_ZERO_FILE="rm_lnkcnt_zero_file" export RENAME_DIR="rename_dir" # ensure we're running in the C locale, since # localised messages may result in test failures export LC_ALL="C" export LANG="C" # # pattern to ignore from 'zpool list'. # export NO_POOLS="no pools available" # pattern to ignore from 'zfs list'. export NO_DATASETS="no datasets available" export TEST_BASE_DIR="/" # Default to compression ON export COMPRESSION_PROP=on # Default to using the checksum export CHECKSUM_PROP=on # some common variables used by test scripts : export TESTCASE_ID=${TESTCASE_ID:-$$} # some test pool names export TESTPOOL=testpool.${TESTCASE_ID} export TESTPOOL1=testpool1.${TESTCASE_ID} export TESTPOOL2=testpool2.${TESTCASE_ID} export TESTPOOL3=testpool3.${TESTCASE_ID} # some test file system names export TESTCTR=testctr${TESTCASE_ID} export TESTFS=testfs.${TESTCASE_ID} export TESTFS1=testfs1.${TESTCASE_ID} export TESTFS2=testfs2.${TESTCASE_ID} export TESTFS3=testfs3.${TESTCASE_ID} # some test directory names export TESTDIR=${TEST_BASE_DIR%%/}/testdir${TESTCASE_ID} export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0${TESTCASE_ID} export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1${TESTCASE_ID} export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2${TESTCASE_ID} # Default to limit disks to be checked export MAX_FINDDISKSNUM=100 # For iscsi target support export ISCSITGTFILE=$TMPDIR/iscsitgt_file export ISCSITGT_FMRI=svc:/system/iscsitgt:default if [ -n "$SVCS" ]; then export AUTO_SNAP=$($SVCS -a | $GREP auto-snapshot | $GREP online | $AWK '{print $3}') fi # zfs upgrade should output the first line as: # This system is currently running ZFS filesystem version 2. # . ZFS_VERSION= $ZFS upgrade -v > /dev/null 2>&1 if [ $? -eq 0 ]; then export ZFS_VERSION=$($ZFS upgrade | $HEAD -1 | $AWK '{print $NF}' \ | $SED -e 's/\.//g') fi if [ -n "$ZFS_VERSION" ]; then i=1 ZFS_ALL_VERSIONS="" while [ "$i" -le "$ZFS_VERSION" ]; do eval 'export ZFS_VERSION_$i="v${i}-fs"' ZFS_ALL_VERSIONS="$ZFS_ALL_VERSIONS $i" i=$(( i + 1 )) done export ZFS_ALL_VERSIONS fi $TRUE Index: projects/zfsd/head/tests/sys/cddl/zfs/include/libgnop.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/libgnop.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/libgnop.kshlib (revision 329035) @@ -1,97 +1,98 @@ +# vim: filetype=sh # # Copyright (c) 2017 Spectra Logic Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions, and the following disclaimer, # without modification. # 2. Redistributions in binary form must reproduce at minimum a disclaimer # substantially similar to the "NO WARRANTY" disclaimer below # ("Disclaimer") and any redistribution must be conditioned upon # including a substantially similar Disclaimer requirement for further # binary redistribution. # # NO WARRANTY # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGES. # # $FreeBSD$ # # # Routines that use gnop(8) to simulate devices that can disappear at any time # # Create a gnop device on top of a real device. Don't use the full extent; use # a portion in the middle so that any ZFS label present on the real device # won't be present on the gnop device and vice versa. function create_gnop { # Name of disk to use, with or without /dev/ typeset disk=$1 # Optional physical path to use typeset physpath=$2 # size of disk in bytes typeset -li disk_size # disk size, rounded down to multiple of 16384 typeset -li disk_size_rounded # size of the nop device in bytes typeset -li nop_size # offset of the beginning of the nop device in bytes typeset -li nop_offset typeset args disk_size=`diskinfo $disk | cut -f 3` # Round it down so the nop device will be 4k-aligned disk_size_rounded=$(( ${disk_size} / 16384 * 16384 )) nop_size=$(( ${disk_size_rounded} / 4 )) nop_offset=${nop_size} args="-s ${nop_size} -o ${nop_offset}" if [ -n "$physpath" ]; then args="$args -z $physpath" fi gnop create ${args} ${disk} } # Create multiple gnop devices function create_gnops { typeset disk for disk in $@; do create_gnop "$disk" || return 1 done return 0 } # Destroy a gnop device. function destroy_gnop { # Name of the underlying (non-gnop) device typeset disk=$1 # Use "-f" so we can destroy a gnop with a consumer (like ZFS) gnop destroy -f ${disk}.nop } # Destroy multiple gnop devices. Attempt to destroy them all, ignoring errors function destroy_gnops { typeset disk for disk in $@; do destroy_gnop "$disk" done return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/include/libremote.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/libremote.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/libremote.kshlib (revision 329035) @@ -1,44 +1,45 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)libremote.kshlib 1.1 07/05/25 SMI" # # Check if a package is installed # $1 package name # Return 0 if it is installed; 1 if not installed function pkg_isinstalled { /usr/bin/pkginfo -q $1 return $? } # Get the installation base for a package # $1 package name # Return function pkg_getinstbase { /bin/echo $(/usr/bin/pkginfo -r $1 2>/dev/null) } Index: projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib (revision 329035) @@ -1,3514 +1,3515 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)libtest.kshlib 1.15 09/08/06 SMI" # . ${STF_SUITE}/include/logapi.kshlib ZFS=${ZFS:-/sbin/zfs} ZPOOL=${ZPOOL:-/sbin/zpool} os_name=`uname -s` # Determine if a test has the necessary requirements to run function test_requires { integer unsupported=0 unsupported_list="" until [[ $# -eq 0 ]];do var_name=$1 cmd=$(eval echo \$${1}) if [[ ! "$cmd" != "" ]] ; then print $var_name is not set unsupported_list="$var_name $unsupported_list" ((unsupported=unsupported+1)) fi shift done if [[ unsupported -gt 0 ]] ; then log_unsupported "$unsupported_list commands are unsupported" else log_note "All commands are supported" fi } # Determine whether a dataset is mounted # # $1 dataset name # $2 filesystem type; optional - defaulted to zfs # # Return 0 if dataset is mounted; 1 if unmounted; 2 on error function ismounted { typeset fstype=$2 [[ -z $fstype ]] && fstype=zfs typeset out dir name ret case $fstype in zfs) if [[ "$1" == "/"* ]] ; then for out in $($ZFS mount | $AWK '{print $2}') ; do [[ $1 == $out ]] && return 0 done else for out in $($ZFS mount | $AWK '{print $1}') ; do [[ $1 == $out ]] && return 0 done fi ;; ufs|nfs) # a = device, b = "on", c = mount point", d = flags $MOUNT | $GREP $fstype | while read a b c d do [[ "$1" == "$a" || "$1" == "$c" ]] && return 0 done ;; esac return 1 } # Return 0 if a dataset is mounted; 1 otherwise # # $1 dataset name # $2 filesystem type; optional - defaulted to zfs function mounted { ismounted $1 $2 (( $? == 0 )) && return 0 return 1 } # Return 0 if a dataset is unmounted; 1 otherwise # # $1 dataset name # $2 filesystem type; optional - defaulted to zfs function unmounted { ismounted $1 $2 (( $? == 1 )) && return 0 return 1 } # split line on "," # # $1 - line to split function splitline { $ECHO $1 | $SED "s/,/ /g" } function default_setup { default_setup_noexit "$@" log_pass } # # Given a list of disks, setup storage pools and datasets. # function default_setup_noexit { typeset disklist=$1 typeset container=$2 typeset volume=$3 if is_global_zone; then if poolexists $TESTPOOL ; then destroy_pool $TESTPOOL fi [[ -d /$TESTPOOL ]] && $RM -rf /$TESTPOOL log_must $ZPOOL create -f $TESTPOOL $disklist else reexport_pool fi $RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR $MKDIR -p $TESTDIR || log_unresolved Could not create $TESTDIR log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS if [[ -n $container ]]; then $RM -rf $TESTDIR1 || \ log_unresolved Could not remove $TESTDIR1 $MKDIR -p $TESTDIR1 || \ log_unresolved Could not create $TESTDIR1 log_must $ZFS create $TESTPOOL/$TESTCTR log_must $ZFS set canmount=off $TESTPOOL/$TESTCTR log_must $ZFS create $TESTPOOL/$TESTCTR/$TESTFS1 log_must $ZFS set mountpoint=$TESTDIR1 \ $TESTPOOL/$TESTCTR/$TESTFS1 fi if [[ -n $volume ]]; then if is_global_zone ; then log_must $ZFS create -V $VOLSIZE $TESTPOOL/$TESTVOL else log_must $ZFS create $TESTPOOL/$TESTVOL fi fi } # # Given a list of disks, setup a storage pool, file system and # a container. # function default_container_setup { typeset disklist=$1 default_setup "$disklist" "true" } # # Given a list of disks, setup a storage pool,file system # and a volume. # function default_volume_setup { typeset disklist=$1 default_setup "$disklist" "" "true" } # # Given a list of disks, setup a storage pool,file system, # a container and a volume. # function default_container_volume_setup { typeset disklist=$1 default_setup "$disklist" "true" "true" } # # Create a snapshot on a filesystem or volume. Defaultly create a snapshot on # filesystem # # $1 Existing filesystem or volume name. Default, $TESTFS # $2 snapshot name. Default, $TESTSNAP # function create_snapshot { typeset fs_vol=${1:-$TESTFS} typeset snap=${2:-$TESTSNAP} [[ -z $fs_vol ]] && log_fail "Filesystem or volume's name is undefined." [[ -z $snap ]] && log_fail "Snapshot's name is undefined." if snapexists $fs_vol@$snap; then log_fail "$fs_vol@$snap already exists." fi datasetexists $fs_vol || \ log_fail "$fs_vol must exist." log_must $ZFS snapshot $fs_vol@$snap } # # Create a clone from a snapshot, default clone name is $TESTCLONE. # # $1 Existing snapshot, $TESTPOOL/$TESTFS@$TESTSNAP is default. # $2 Clone name, $TESTPOOL/$TESTCLONE is default. # function create_clone # snapshot clone { typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP} typeset clone=${2:-$TESTPOOL/$TESTCLONE} [[ -z $snap ]] && \ log_fail "Snapshot name is undefined." [[ -z $clone ]] && \ log_fail "Clone name is undefined." log_must $ZFS clone $snap $clone } function default_mirror_setup { default_mirror_setup_noexit $1 $2 $3 log_pass } # # Given a pair of disks, set up a storage pool and dataset for the mirror # @parameters: $1 the primary side of the mirror # $2 the secondary side of the mirror # @uses: ZPOOL ZFS TESTPOOL TESTFS function default_mirror_setup_noexit { readonly func="default_mirror_setup_noexit" typeset primary=$1 typeset secondary=$2 [[ -z $primary ]] && \ log_fail "$func: No parameters passed" [[ -z $secondary ]] && \ log_fail "$func: No secondary partition passed" [[ -d /$TESTPOOL ]] && $RM -rf /$TESTPOOL log_must $ZPOOL create -f $TESTPOOL mirror $@ log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS } # # create a number of mirrors. # We create a number($1) of 2 way mirrors using the pairs of disks named # on the command line. These mirrors are *not* mounted # @parameters: $1 the number of mirrors to create # $... the devices to use to create the mirrors on # @uses: ZPOOL ZFS TESTPOOL function setup_mirrors { typeset -i nmirrors=$1 shift while (( nmirrors > 0 )); do log_must test -n "$1" -a -n "$2" [[ -d /$TESTPOOL$nmirrors ]] && $RM -rf /$TESTPOOL$nmirrors log_must $ZPOOL create -f $TESTPOOL$nmirrors mirror $1 $2 shift 2 (( nmirrors = nmirrors - 1 )) done } # # create a number of raidz pools. # We create a number($1) of 2 raidz pools using the pairs of disks named # on the command line. These pools are *not* mounted # @parameters: $1 the number of pools to create # $... the devices to use to create the pools on # @uses: ZPOOL ZFS TESTPOOL function setup_raidzs { typeset -i nraidzs=$1 shift while (( nraidzs > 0 )); do log_must test -n "$1" -a -n "$2" [[ -d /$TESTPOOL$nraidzs ]] && $RM -rf /$TESTPOOL$nraidzs log_must $ZPOOL create -f $TESTPOOL$nraidzs raidz $1 $2 shift 2 (( nraidzs = nraidzs - 1 )) done } # # Destroy the configured testpool mirrors. # the mirrors are of the form ${TESTPOOL}{number} # @uses: ZPOOL ZFS TESTPOOL function destroy_mirrors { default_cleanup_noexit log_pass } # # Given a minimum of two disks, set up a storage pool and dataset for the raid-z # $1 the list of disks # function default_raidz_setup { typeset disklist="$*" set -A disks $disklist if [[ ${#disks[*]} -lt 2 ]]; then log_fail "A raid-z requires a minimum of two disks." fi [[ -d /$TESTPOOL ]] && $RM -rf /$TESTPOOL log_must $ZPOOL create -f $TESTPOOL raidz $1 $2 $3 log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS log_pass } # # Common function used to cleanup storage pools and datasets. # # Invoked at the start of the test suite to ensure the system # is in a known state, and also at the end of each set of # sub-tests to ensure errors from one set of tests doesn't # impact the execution of the next set. function default_cleanup { default_cleanup_noexit log_pass } function all_pools { cmd="$ZPOOL list -H -o name | $GREP -v '$NO_POOLS'" if [[ -n $KEEP ]]; then cmd="$cmd | $EGREP -v '(${KEEP})'" fi eval $cmd } function default_cleanup_noexit { typeset exclude="" typeset pool="" # # Destroying the pool will also destroy any # filesystems it contains. # if is_global_zone; then # Here, we loop through the pools we're allowed to # destroy, only destroying them if it's safe to do # so. for pool in $(all_pools); do if safe_to_destroy_pool $pool; then destroy_pool $pool fi done else typeset fs="" for fs in $($ZFS list -H -o name \ | $GREP "^$ZONE_POOL/$ZONE_CTR[01234]/"); do datasetexists $fs && \ log_must $ZFS destroy -Rf $fs done # Need cleanup here to avoid garbage dir left. for fs in $($ZFS list -H -o name \ ); do [[ $fs == /$ZONE_POOL ]] && continue [[ -d $fs ]] && log_must $RM -rf $fs/* done # # Reset the $ZONE_POOL/$ZONE_CTR[01234] file systems property to # the default value # for fs in $($ZFS list -H -o name \ ); do if [[ $fs == $ZONE_POOL/$ZONE_CTR[01234] ]]; then log_must $ZFS set reservation=none $fs log_must $ZFS set recordsize=128K $fs log_must $ZFS set mountpoint=/$fs $fs typeset enc="" enc=$(get_prop encryption $fs) if [[ $? -ne 0 ]] || [[ -z "$enc" ]] || \ [[ "$enc" == "off" ]]; then log_must $ZFS set checksum=on $fs fi log_must $ZFS set compression=off $fs log_must $ZFS set atime=on $fs log_must $ZFS set devices=off $fs log_must $ZFS set exec=on $fs log_must $ZFS set setuid=on $fs log_must $ZFS set readonly=off $fs log_must $ZFS set snapdir=hidden $fs log_must $ZFS set aclmode=groupmask $fs log_must $ZFS set aclinherit=secure $fs fi done fi [[ -d $TESTDIR ]] && \ log_must $RM -rf $TESTDIR } # # Common function used to cleanup storage pools, file systems # and containers. # function default_container_cleanup { if ! is_global_zone; then reexport_pool fi ismounted $TESTPOOL/$TESTCTR/$TESTFS1 [[ $? -eq 0 ]] && \ log_must $ZFS unmount $TESTPOOL/$TESTCTR/$TESTFS1 datasetexists $TESTPOOL/$TESTCTR/$TESTFS1 && \ log_must $ZFS destroy -R $TESTPOOL/$TESTCTR/$TESTFS1 datasetexists $TESTPOOL/$TESTCTR && \ log_must $ZFS destroy -Rf $TESTPOOL/$TESTCTR [[ -e $TESTDIR1 ]] && \ log_must $RM -rf $TESTDIR1 > /dev/null 2>&1 default_cleanup } # # Common function used to cleanup snapshot of file system or volume. Default to # delete the file system's snapshot # # $1 snapshot name # function destroy_snapshot { typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP} if ! snapexists $snap; then log_fail "'$snap' does not existed." fi # # For the sake of the value which come from 'get_prop' is not equal # to the really mountpoint when the snapshot is unmounted. So, firstly # check and make sure this snapshot's been mounted in current system. # typeset mtpt="" if ismounted $snap; then mtpt=$(get_prop mountpoint $snap) (( $? != 0 )) && \ log_fail "get_prop mountpoint $snap failed." fi log_must $ZFS destroy $snap [[ $mtpt != "" && -d $mtpt ]] && \ log_must $RM -rf $mtpt } # # Common function used to cleanup clone. # # $1 clone name # function destroy_clone { typeset clone=${1:-$TESTPOOL/$TESTCLONE} if ! datasetexists $clone; then log_fail "'$clone' does not existed." fi # With the same reason in destroy_snapshot typeset mtpt="" if ismounted $clone; then mtpt=$(get_prop mountpoint $clone) (( $? != 0 )) && \ log_fail "get_prop mountpoint $clone failed." fi log_must $ZFS destroy $clone [[ $mtpt != "" && -d $mtpt ]] && \ log_must $RM -rf $mtpt } # Return 0 if a snapshot exists; $? otherwise # # $1 - snapshot name function snapexists { $ZFS list -H -t snapshot "$1" > /dev/null 2>&1 return $? } # # Set a property to a certain value on a dataset. # Sets a property of the dataset to the value as passed in. # @param: # $1 dataset who's property is being set # $2 property to set # $3 value to set property to # @return: # 0 if the property could be set. # non-zero otherwise. # @use: ZFS # function dataset_setprop { typeset fn=dataset_setprop if (( $# < 3 )); then log_note "$fn: Insufficient parameters (need 3, had $#)" return 1 fi typeset output= output=$($ZFS set $2=$3 $1 2>&1) typeset rv=$? if (( rv != 0 )); then log_note "Setting property on $1 failed." log_note "property $2=$3" log_note "Return Code: $rv" log_note "Output: $output" return $rv fi return 0 } # # Assign suite defined dataset properties. # This function is used to apply the suite's defined default set of # properties to a dataset. # @parameters: $1 dataset to use # @uses: ZFS COMPRESSION_PROP CHECKSUM_PROP # @returns: # 0 if the dataset has been altered. # 1 if no pool name was passed in. # 2 if the dataset could not be found. # 3 if the dataset could not have it's properties set. # function dataset_set_defaultproperties { typeset dataset="$1" [[ -z $dataset ]] && return 1 typeset confset= typeset -i found=0 for confset in $($ZFS list); do if [[ $dataset = $confset ]]; then found=1 break fi done [[ $found -eq 0 ]] && return 2 if [[ -n $COMPRESSION_PROP ]]; then dataset_setprop $dataset compression $COMPRESSION_PROP || \ return 3 log_note "Compression set to '$COMPRESSION_PROP' on $dataset" fi if [[ -n $CHECKSUM_PROP && $WRAPPER != *"crypto"* ]]; then dataset_setprop $dataset checksum $CHECKSUM_PROP || \ return 3 log_note "Checksum set to '$CHECKSUM_PROP' on $dataset" fi return 0 } # # Check a numeric assertion # @parameter: $@ the assertion to check # @output: big loud notice if assertion failed # @use: log_fail # function assert { (( $@ )) || log_fail $@ } function wipe_partition_table # [ ...] { while [[ -n $* ]]; do typeset diskname=$1 [ ! -e $diskname ] && log_fail "ERROR: $diskname doesn't exist" if gpart list $(basename $diskname) >/dev/null 2>&1; then wait_for 5 1 $GPART destroy -F $diskname else log_note "No GPT partitions detected on $diskname" fi log_must $GPART create -s gpt $diskname shift done } # # Given a slice, size and disk, this function # formats the slice to the specified size. # Size should be specified with units as per # the `format` command requirements eg. 100mb 3gb # function set_partition # { typeset -i slicenum=$1 typeset start=$2 typeset size=$3 typeset disk=$4 set -A devmap a b c d e f g h [[ -z $slicenum || -z $size || -z $disk ]] && \ log_fail "The slice, size or disk name is unspecified." size=`$ECHO $size| sed s/mb/M/` size=`$ECHO $size| sed s/m/M/` size=`$ECHO $size| sed s/gb/G/` size=`$ECHO $size| sed s/g/G/` [[ -n $start ]] && start="-b $start" log_must $GPART add -t efi $start -s $size -i $slicenum $disk return 0 } function get_disk_size # { typeset disk=$1 diskinfo da0 | awk '{print $3}' } function get_available_disk_size # { typeset disk=$1 raw_size=`get_disk_size $disk` (( available_size = raw_size * 95 / 100 )) echo $available_size } # # Get the end cyl of the given slice # #TODO: fix this to be GPT-compatible if we want to use the SMI WRAPPER. This # function is not necessary on FreeBSD # function get_endslice # { log_fail "get_endslice has not been updated for GPT partitions" } # # Get the first LBA that is beyond the end of the given partition function get_partition_end # { typeset disk=$1 typeset partition_index=$2 export partition_index $GPART show $disk | $AWK \ '/^[ \t]/ && $3 ~ ENVIRON["partition_index"] {print $1 + $2}' } # # Given a size,disk and total number of partitions, this function formats the # disk partitions from 0 to the total partition number with the same specified # size. # function partition_disk # { typeset -i i=1 typeset part_size=$1 typeset disk_name=$2 typeset total_parts=$3 typeset cyl wipe_partition_table $disk_name while (( i <= $total_parts )); do set_partition $i "" $part_size $disk_name (( i = i+1 )) done } function size_of_file # fname { typeset fname=$1 sz=`stat -f '%z' $fname` [[ -z "$sz" ]] && log_fail "stat($fname) failed" $ECHO $sz return 0 } # # This function continues to write to a filenum number of files into dirnum # number of directories until either $FILE_WRITE returns an error or the # maximum number of files per directory have been written. # # Usage: # fill_fs [destdir] [dirnum] [filenum] [bytes] [num_writes] [data] # # Return value: 0 on success # non 0 on error # # Where : # destdir: is the directory where everything is to be created under # dirnum: the maximum number of subdirectories to use, -1 no limit # filenum: the maximum number of files per subdirectory # blocksz: number of bytes per block # num_writes: number of blocks to write # data: the data that will be written # # E.g. # file_fs /testdir 20 25 1024 256 0 # # Note: blocksz * num_writes equals the size of the testfile # function fill_fs # destdir dirnum filenum blocksz num_writes data { typeset destdir=${1:-$TESTDIR} typeset -i dirnum=${2:-50} typeset -i filenum=${3:-50} typeset -i blocksz=${4:-8192} typeset -i num_writes=${5:-10240} typeset -i data=${6:-0} typeset -i retval=0 typeset -i dn=0 # current dir number typeset -i fn=0 # current file number while (( retval == 0 )); do (( dirnum >= 0 && dn >= dirnum )) && break typeset curdir=$destdir/$dn log_must $MKDIR -p $curdir for (( fn = 0; $fn < $filenum && $retval == 0; fn++ )); do log_cmd $FILE_WRITE -o create -f $curdir/$TESTFILE.$fn \ -b $blocksz -c $num_writes -d $data retval=$? done (( dn = dn + 1 )) done return $retval } # # Simple function to get the specified property. If unable to # get the property then exits. # # Note property is in 'parsable' format (-p) # function get_prop # property dataset { typeset prop_val typeset prop=$1 typeset dataset=$2 prop_val=$($ZFS get -pH -o value $prop $dataset 2>/dev/null) if [[ $? -ne 0 ]]; then log_note "Unable to get $prop property for dataset $dataset" return 1 fi $ECHO $prop_val return 0 } # # Simple function to return the lesser of two values. # function min { typeset first_arg=$1 typeset second_arg=$2 if (( first_arg < second_arg )); then $ECHO $first_arg else $ECHO $second_arg fi return 0 } # # Simple function to get the specified property of pool. If unable to # get the property then exits. # function get_pool_prop # property pool { typeset prop_val typeset prop=$1 typeset pool=$2 if poolexists $pool ; then prop_val=$($ZPOOL get $prop $pool 2>/dev/null | $TAIL -1 | \ $AWK '{print $3}') if [[ $? -ne 0 ]]; then log_note "Unable to get $prop property for pool " \ "$pool" return 1 fi else log_note "Pool $pool not exists." return 1 fi $ECHO $prop_val return 0 } # Return 0 if a pool exists; $? otherwise # # $1 - pool name function poolexists { typeset pool=$1 if [[ -z $pool ]]; then log_note "No pool name given." return 1 fi $ZPOOL list -H "$pool" > /dev/null 2>&1 return $? } # Return 0 if all the specified datasets exist; $? otherwise # # $1-n dataset name function datasetexists { if (( $# == 0 )); then log_note "No dataset name given." return 1 fi while (( $# > 0 )); do $ZFS list -H -t filesystem,snapshot,volume $1 > /dev/null 2>&1 || \ return $? shift done return 0 } # return 0 if none of the specified datasets exists, otherwise return 1. # # $1-n dataset name function datasetnonexists { if (( $# == 0 )); then log_note "No dataset name given." return 1 fi while (( $# > 0 )); do $ZFS list -H -t filesystem,snapshot,volume $1 > /dev/null 2>&1 && \ return 1 shift done return 0 } # # Given a mountpoint, or a dataset name, determine if it is shared. # # Returns 0 if shared, 1 otherwise. # function is_shared { typeset fs=$1 typeset mtpt if [[ $fs != "/"* ]] ; then if datasetnonexists "$fs" ; then return 1 else mtpt=$(get_prop mountpoint "$fs") case $mtpt in none|legacy|-) return 1 ;; *) fs=$mtpt ;; esac fi fi for mtpt in `$SHARE | $AWK '{print $2}'` ; do if [[ $mtpt == $fs ]] ; then return 0 fi done typeset stat=$($SVCS -H -o STA nfs/server:default) if [[ $stat != "ON" ]]; then log_note "Current nfs/server status: $stat" fi return 1 } # # Given a mountpoint, determine if it is not shared. # # Returns 0 if not shared, 1 otherwise. # function not_shared { typeset fs=$1 is_shared $fs if (( $? == 0)); then return 1 fi return 0 } # # Helper function to unshare a mountpoint. # function unshare_fs #fs { typeset fs=$1 is_shared $fs if (( $? == 0 )); then log_must $ZFS unshare $fs fi return 0 } # # Check NFS server status and trigger it online. # function setup_nfs_server { # Cannot share directory in non-global zone. # if ! is_global_zone; then log_note "Cannot trigger NFS server by sharing in LZ." return fi typeset nfs_fmri="svc:/network/nfs/server:default" if [[ $($SVCS -Ho STA $nfs_fmri) != "ON" ]]; then # # Only really sharing operation can enable NFS server # to online permanently. # typeset dummy=$TMPDIR/dummy if [[ -d $dummy ]]; then log_must $RM -rf $dummy fi log_must $MKDIR $dummy log_must $SHARE $dummy # # Waiting for fmri's status to be the final status. # Otherwise, in transition, an asterisk (*) is appended for # instances, unshare will reverse status to 'DIS' again. # # Waiting for 1's at least. # log_must $SLEEP 1 timeout=10 while [[ timeout -ne 0 && $($SVCS -Ho STA $nfs_fmri) == *'*' ]] do log_must $SLEEP 1 (( timeout -= 1 )) done log_must $UNSHARE $dummy log_must $RM -rf $dummy fi log_note "Current NFS status: '$($SVCS -Ho STA,FMRI $nfs_fmri)'" } # # To verify whether calling process is in global zone # # Return 0 if in global zone, 1 in non-global zone # function is_global_zone { typeset cur_zone=$($ZONENAME 2>/dev/null) # Zones are not supported on FreeBSD. if [[ $os_name == "FreeBSD" ]]; then return 0 fi if [[ $cur_zone != "global" ]]; then return 1 fi return 0 } # # Verify whether test is permit to run from # global zone, local zone, or both # # $1 zone limit, could be "global", "local", or "both"(no limit) # # Return 0 if permit, otherwise exit with log_unsupported # function verify_runnable # zone limit { typeset limit=$1 [[ -z $limit ]] && return 0 if is_global_zone ; then case $limit in global|both) break ;; local) log_unsupported "Test is unable to run from \ global zone." break ;; *) log_note "Warning: unknown limit $limit - use both." ;; esac else case $limit in local|both) break ;; global) log_unsupported "Test is unable to run from \ local zone." break ;; *) log_note "Warning: unknown limit $limit - use both." ;; esac reexport_pool fi return 0 } # Return 0 if create successfully or the pool exists; $? otherwise # Note: In local zones, this function should return 0 silently. # # $1 - pool name # $2-n - [keyword] devs_list function create_pool #pool devs_list { typeset pool=${1%%/*} shift if [[ -z $pool ]]; then log_note "Missing pool name." return 1 fi if poolexists $pool ; then destroy_pool $pool fi if is_global_zone ; then [[ -d /$pool ]] && $RM -rf /$pool log_must $ZPOOL create -f $pool $@ fi return 0 } # Return 0 if destroy successfully or the pool exists; $? otherwise # Note: In local zones, this function should return 0 silently. # # $1 - pool name # Destroy pool with the given parameters. function destroy_pool #pool { typeset pool=${1%%/*} typeset mtpt if [[ -z $pool ]]; then log_note "No pool name given." return 1 fi if is_global_zone ; then if poolexists "$pool" ; then mtpt=$(get_prop mountpoint "$pool") log_must $ZPOOL destroy -f $pool [[ -d $mtpt ]] && \ log_must $RM -rf $mtpt else log_note "Pool $pool does not exist, skipping destroy." return 1 fi fi return 0 } # # Create file vdevs. # By default this generates sparse vdevs 10GB in size, for performance. # function create_vdevs # vdevs { typeset vdsize=10G [ -n "$VDEV_SIZE" ] && vdsize=$VDEV_SIZE rm -f $@ || return 1 truncate -s $vdsize $@ } # # Firstly, create a pool with 5 datasets. Then, create a single zone and # export the 5 datasets to it. In addition, we also add a ZFS filesystem # and a zvol device to the zone. # # $1 zone name # $2 zone root directory prefix # $3 zone ip # function zfs_zones_setup #zone_name zone_root zone_ip { typeset zone_name=${1:-$(hostname)-z} typeset zone_root=${2:-"/zone_root"} typeset zone_ip=${3:-"10.1.1.10"} typeset prefix_ctr=$ZONE_CTR typeset pool_name=$ZONE_POOL typeset -i cntctr=5 typeset -i i=0 # Create pool and 5 container within it # [[ -d /$pool_name ]] && $RM -rf /$pool_name log_must $ZPOOL create -f $pool_name $DISKS while (( i < cntctr )); do log_must $ZFS create $pool_name/$prefix_ctr$i (( i += 1 )) done # create a zvol log_must $ZFS create -V 1g $pool_name/zone_zvol # # If current system support slog, add slog device for pool # if verify_slog_support ; then typeset sdevs="$TMPDIR/sdev1 $TMPDIR/sdev2" log_must create_vdevs $sdevs log_must $ZPOOL add $pool_name log mirror $sdevs fi # this isn't supported just yet. # Create a filesystem. In order to add this to # the zone, it must have it's mountpoint set to 'legacy' # log_must $ZFS create $pool_name/zfs_filesystem # log_must $ZFS set mountpoint=legacy $pool_name/zfs_filesystem [[ -d $zone_root ]] && \ log_must $RM -rf $zone_root/$zone_name [[ ! -d $zone_root ]] && \ log_must $MKDIR -p -m 0700 $zone_root/$zone_name # Create zone configure file and configure the zone # typeset zone_conf=$TMPDIR/zone_conf.${TESTCASE_ID} $ECHO "create" > $zone_conf $ECHO "set zonepath=$zone_root/$zone_name" >> $zone_conf $ECHO "set autoboot=true" >> $zone_conf i=0 while (( i < cntctr )); do $ECHO "add dataset" >> $zone_conf $ECHO "set name=$pool_name/$prefix_ctr$i" >> \ $zone_conf $ECHO "end" >> $zone_conf (( i += 1 )) done # add our zvol to the zone $ECHO "add device" >> $zone_conf $ECHO "set match=/dev/zvol/dsk/$pool_name/zone_zvol" >> $zone_conf $ECHO "end" >> $zone_conf # add a corresponding zvol rdsk to the zone $ECHO "add device" >> $zone_conf $ECHO "set match=/dev/zvol/rdsk/$pool_name/zone_zvol" >> $zone_conf $ECHO "end" >> $zone_conf # once it's supported, we'll add our filesystem to the zone # $ECHO "add fs" >> $zone_conf # $ECHO "set type=zfs" >> $zone_conf # $ECHO "set special=$pool_name/zfs_filesystem" >> $zone_conf # $ECHO "set dir=/export/zfs_filesystem" >> $zone_conf # $ECHO "end" >> $zone_conf $ECHO "verify" >> $zone_conf $ECHO "commit" >> $zone_conf log_must $ZONECFG -z $zone_name -f $zone_conf log_must $RM -f $zone_conf # Install the zone $ZONEADM -z $zone_name install if (( $? == 0 )); then log_note "SUCCESS: $ZONEADM -z $zone_name install" else log_fail "FAIL: $ZONEADM -z $zone_name install" fi # Install sysidcfg file # typeset sysidcfg=$zone_root/$zone_name/root/etc/sysidcfg $ECHO "system_locale=C" > $sysidcfg $ECHO "terminal=dtterm" >> $sysidcfg $ECHO "network_interface=primary {" >> $sysidcfg $ECHO "hostname=$zone_name" >> $sysidcfg $ECHO "}" >> $sysidcfg $ECHO "name_service=NONE" >> $sysidcfg $ECHO "root_password=mo791xfZ/SFiw" >> $sysidcfg $ECHO "security_policy=NONE" >> $sysidcfg $ECHO "timezone=US/Eastern" >> $sysidcfg # Boot this zone log_must $ZONEADM -z $zone_name boot } # # Reexport TESTPOOL & TESTPOOL(1-4) # function reexport_pool { typeset -i cntctr=5 typeset -i i=0 while (( i < cntctr )); do if (( i == 0 )); then TESTPOOL=$ZONE_POOL/$ZONE_CTR$i if ! ismounted $TESTPOOL; then log_must $ZFS mount $TESTPOOL fi else eval TESTPOOL$i=$ZONE_POOL/$ZONE_CTR$i if eval ! ismounted \$TESTPOOL$i; then log_must eval $ZFS mount \$TESTPOOL$i fi fi (( i += 1 )) done } # # Wait for something to return true, checked by the caller. # function wait_for_checked # timeout dt [args...] { typeset timeout=$1 typeset dt=$2 shift; shift typeset -i start=$(date '+%s') typeset -i endtime log_note "Waiting $timeout seconds (checked every $dt seconds) for: $*" ((endtime = start + timeout)) while :; do $* [ $? -eq 0 ] && return curtime=$(date '+%s') [ $curtime -gt $endtime ] && return 1 sleep $dt done return 0 } # # Wait for something to return true. # function wait_for # timeout dt [args...] { typeset timeout=$1 typeset dt=$2 shift; shift wait_for_checked $timeout $dt $* || \ log_fail "ERROR: Timed out waiting for: $*" } # # Verify a given disk is online or offline # # Return 0 is pool/disk matches expected state, 1 otherwise # stateexpr is a regex like ONLINE or REMOVED|UNAVAIL # function check_state # pool disk stateexpr { typeset pool=$1 typeset disk=${2#/dev/dsk/} disk=${disk#/dev/rdsk/} disk=${disk#/dev/} typeset stateexpr=$3 $ZPOOL status -v $pool | grep "$disk" \ | egrep -i "$stateexpr" > /dev/null 2>&1 return $? } # # Wait for a given disk to leave a state # function wait_for_state_exit { typeset pool=$1 typeset disk=$2 typeset state=$3 while check_state "$pool" "$disk" "$state"; do $SLEEP 1 done } # # Wait for a given disk to enter a state # function wait_for_state_enter { typeset -i timeout=$1 typeset pool=$2 typeset disk=$3 typeset state=$4 log_note "Waiting up to $timeout seconds for $disk to become $state ..." for ((; $timeout > 0; timeout=$timeout-1)); do check_state $pool "$disk" "$state" [ $? -eq 0 ] && return $SLEEP 1 done log_must $ZPOOL status $pool log_fail "ERROR: Disk $disk not marked as $state in $pool" } # # Get the mountpoint of snapshot # as its mountpoint # function snapshot_mountpoint { typeset dataset=${1:-$TESTPOOL/$TESTFS@$TESTSNAP} if [[ $dataset != *@* ]]; then log_fail "Error name of snapshot '$dataset'." fi typeset fs=${dataset%@*} typeset snap=${dataset#*@} if [[ -z $fs || -z $snap ]]; then log_fail "Error name of snapshot '$dataset'." fi $ECHO $(get_prop mountpoint $fs)/$(get_snapdir_name)/$snap } function pool_maps_intact # pool { typeset pool="$1" if ! $ZDB -bcv $pool; then return 1 fi return 0 } function filesys_has_zil # filesystem { typeset filesys="$1" if ! $ZDB -ivv $filesys | $GREP "ZIL header"; then return 1 fi return 0 } # # Given a pool and file system, this function will verify the file system # using the zdb internal tool. Note that the pool is exported and imported # to ensure it has consistent state. # function verify_filesys # pool filesystem dir { typeset pool="$1" typeset filesys="$2" typeset zdbout="$TMPDIR/zdbout.${TESTCASE_ID}" shift shift typeset dirs=$@ typeset search_path="" log_note "Calling $ZDB to verify filesystem '$filesys'" log_must $ZPOOL export $pool if [[ -n $dirs ]] ; then for dir in $dirs ; do search_path="$search_path -d $dir" done fi log_must $ZPOOL import $search_path $pool $ZDB -cudi $filesys > $zdbout 2>&1 if [[ $? != 0 ]]; then log_note "Output: $ZDB -cudi $filesys" $CAT $zdbout log_fail "$ZDB detected errors with: '$filesys'" fi log_must $RM -rf $zdbout } # # Given a pool, and this function list all disks in the pool # function get_disklist # pool { typeset disklist="" disklist=$($ZPOOL iostat -v $1 | $NAWK '(NR >4 ) {print $1}' | \ $GREP -v "\-\-\-\-\-" | \ $EGREP -v -e "^(mirror|raidz1|raidz2|spare|log|cache)$" ) $ECHO $disklist } # # Destroy all existing metadevices and state database # function destroy_metas { typeset metad for metad in $($METASTAT -p | $AWK '{print $1}'); do log_must $METACLEAR -rf $metad done for metad in $($METADB | $CUT -f6 | $GREP dev | $UNIQ); do log_must $METADB -fd $metad done } # /** # This function kills a given list of processes after a time period. We use # this in the stress tests instead of STF_TIMEOUT so that we can have processes # run for a fixed amount of time, yet still pass. Tests that hit STF_TIMEOUT # would be listed as FAIL, which we don't want : we're happy with stress tests # running for a certain amount of time, then finishing. # # @param $1 the time in seconds after which we should terminate these processes # @param $2..$n the processes we wish to terminate. # */ function stress_timeout { typeset -i TIMEOUT=$1 shift typeset cpids="$@" log_note "Waiting for child processes($cpids). " \ "It could last dozens of minutes, please be patient ..." log_must $SLEEP $TIMEOUT log_note "Killing child processes after ${TIMEOUT} stress timeout." typeset pid for pid in $cpids; do $PS -p $pid > /dev/null 2>&1 if (( $? == 0 )); then log_must $KILL -USR1 $pid fi done } # # Check whether current OS support a specified feature or not # # return 0 if current OS version is in unsupported list, 1 otherwise # # $1 unsupported target OS versions # function check_version # { typeset unsupported_vers="$@" typeset ver typeset cur_ver=`$UNAME -r` for ver in $unsupported_vers; do [[ "$cur_ver" == "$ver" ]] && return 0 done return 1 } # # Verify a given hotspare disk is inuse or avail # # Return 0 is pool/disk matches expected state, 1 otherwise # function check_hotspare_state # pool disk state{inuse,avail} { typeset pool=$1 typeset disk=${2#/dev/dsk/} disk=${disk#/dev/rdsk/} disk=${disk#/dev/} typeset state=$3 cur_state=$(get_device_state $pool $disk "spares") if [[ $state != ${cur_state} ]]; then return 1 fi return 0 } # # Verify a given slog disk is inuse or avail # # Return 0 is pool/disk matches expected state, 1 otherwise # function check_slog_state # pool disk state{online,offline,unavail} { typeset pool=$1 typeset disk=${2#/dev/dsk/} disk=${disk#/dev/rdsk/} disk=${disk#/dev/} typeset state=$3 cur_state=$(get_device_state $pool $disk "logs") if [[ $state != ${cur_state} ]]; then return 1 fi return 0 } # # Verify a given vdev disk is inuse or avail # # Return 0 is pool/disk matches expected state, 1 otherwise # function check_vdev_state # pool disk state{online,offline,unavail} { typeset pool=$1 typeset disk=${2#/dev/dsk/} disk=${disk#/dev/rdsk/} disk=${disk#/dev/} typeset state=$3 if [[ $WRAPPER == *"smi"* ]]; then $ECHO $disk | $EGREP "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1 if (( $? == 0 )); then disk=${disk}s2 fi fi cur_state=$(get_device_state $pool $disk) if [[ $state != ${cur_state} ]]; then return 1 fi return 0 } # # Check the output of 'zpool status -v ', # and to see if the content of contain the specified. # # Return 0 is contain, 1 otherwise # function check_pool_status # pool token keyword { typeset pool=$1 typeset token=$2 typeset keyword=$3 $ZPOOL status -v "$pool" 2>/dev/null | \ $NAWK -v token="$token:" '($1==token) {print $0}' | \ $GREP -i "$keyword" >/dev/null 2>&1 return $? } function vdev_pool_error_count { typeset errs=$1 if [ -z "$2" ]; then test $errs -gt 0; ret=$? else test $errs -eq $2; ret=$? fi log_debug "vdev_pool_error_count: errs='$errs' \$2='$2' ret='$ret'" return $ret } # # Generate a pool status error file suitable for pool_errors_from_file. # If the pool is healthy, returns 0. Otherwise, the caller must handle the # returned temporarily file appropriately. # function pool_error_file # { typeset pool="$1" typeset tmpfile=$TMPDIR/pool_status.${TESTCASE_ID} $ZPOOL status -x $pool > ${tmpfile} echo $tmpfile } # # Evaluates counting the number of errors. If vdev specified, only # that vdev's errors are counted. Returns the total number. will be # deleted on exit. # function pool_errors_from_file # [vdev] { typeset file=$1 shift typeset checkvdev="$2" typeset line typeset -i fetchbegin=1 typeset -i errnum=0 typeset -i c_read=0 typeset -i c_write=0 typeset -i c_cksum=0 cat ${file} | $EGREP -v "pool:" | while read line; do if (( $fetchbegin != 0 )); then $ECHO $line | $GREP "NAME" >/dev/null 2>&1 (( $? == 0 )) && (( fetchbegin = 0 )) continue fi if [[ -n $checkvdev ]]; then $ECHO $line | $GREP $checkvdev >/dev/null 2>&1 (( $? != 0 )) && continue c_read=`$ECHO $line | $AWK '{print $3}'` c_write=`$ECHO $line | $AWK '{print $4}'` c_cksum=`$ECHO $line | $AWK '{print $5}'` if [ $c_read != 0 ] || [ $c_write != 0 ] || \ [ $c_cksum != 0 ] then (( errnum = errnum + 1 )) fi break fi c_read=`$ECHO $line | $AWK '{print $3}'` c_write=`$ECHO $line | $AWK '{print $4}'` c_cksum=`$ECHO $line | $AWK '{print $5}'` if [ $c_read != 0 ] || [ $c_write != 0 ] || \ [ $c_cksum != 0 ] then (( errnum = errnum + 1 )) fi done rm -f $file echo $errnum } # # Returns whether the vdev has the given number of errors. # If the number is unspecified, any non-zero number returns true. # function vdev_has_errors # pool vdev [errors] { typeset pool=$1 typeset vdev=$2 typeset tmpfile=$(pool_error_file $pool) log_note "Original pool status:" cat $tmpfile typeset -i errs=$(pool_errors_from_file $tmpfile $vdev) vdev_pool_error_count $errs $3 } # # Returns whether the pool has the given number of errors. # If the number is unspecified, any non-zero number returns true. # function pool_has_errors # pool [errors] { typeset pool=$1 typeset tmpfile=$(pool_error_file $pool) log_note "Original pool status:" cat $tmpfile typeset -i errs=$(pool_errors_from_file $tmpfile) vdev_pool_error_count $errs $2 } # # Returns whether clearing $pool at $vdev (if given) succeeds. # function pool_clear_succeeds { typeset pool="$1" typeset vdev=$2 $ZPOOL clear $pool $vdev ! pool_has_errors $pool } # # Return whether the pool is healthy # function is_pool_healthy # pool { typeset pool=$1 typeset healthy_output="pool '$pool' is healthy" typeset real_output=$($ZPOOL status -x $pool) if [[ "$real_output" == "$healthy_output" ]]; then return 0 else typeset -i ret $ZPOOL status -x $pool | $GREP "state:" | \ $GREP "FAULTED" >/dev/null 2>&1 ret=$? (( $ret == 0 )) && return 1 typeset l_scan typeset errnum l_scan=$($ZPOOL status -x $pool | $GREP "scan:") l_scan=${l_scan##*"with"} errnum=$($ECHO $l_scan | $AWK '{print $1}') if [ "$errnum" != "0" ]; then return 1 else return 0 fi fi } # # These 5 following functions are instance of check_pool_status() # is_pool_resilvering - to check if the pool is resilver in progress # is_pool_resilvered - to check if the pool is resilver completed # is_pool_scrubbing - to check if the pool is scrub in progress # is_pool_scrubbed - to check if the pool is scrub completed # is_pool_scrub_stopped - to check if the pool is scrub stopped # function is_pool_resilvering #pool { check_pool_status "$1" "scan" "resilver in progress" return $? } function is_pool_resilvered #pool { check_pool_status "$1" "scan" "resilvered" return $? } function resilver_happened # pool { typeset pool=$1 is_pool_resilvering "$pool" || is_pool_resilvered "$pool" } function is_pool_scrubbing #pool { check_pool_status "$1" "scan" "scrub in progress" return $? } function is_pool_scrubbed #pool { check_pool_status "$1" "scan" "scrub repaired" return $? } function is_pool_scrub_stopped #pool { check_pool_status "$1" "scan" "scrub canceled" return $? } function is_pool_state # pool state { check_pool_status "$1" "state" "$2" return $? } # # Erase the partition tables and destroy any zfs labels # function cleanup_devices #vdevs { for device in $@; do # Labelclear must happen first, otherwise it may interfere # with the teardown/setup of GPT labels. $ZPOOL labelclear -f $device # Only wipe partition tables for arguments that are disks, # as opposed to slices (which are valid arguments here). if camcontrol inquiry $device >/dev/null 2>&1; then wipe_partition_table $device fi done return 0 } # # Verify the rsh connectivity to each remote host in RHOSTS. # # Return 0 if remote host is accessible; otherwise 1. # $1 remote host name # $2 username # function verify_rsh_connect #rhost, username { typeset rhost=$1 typeset username=$2 typeset rsh_cmd="$RSH -n" typeset cur_user= $GETENT hosts $rhost >/dev/null 2>&1 if (( $? != 0 )); then log_note "$rhost cannot be found from" \ "administrative database." return 1 fi $PING $rhost 3 >/dev/null 2>&1 if (( $? != 0 )); then log_note "$rhost is not reachable." return 1 fi if (( ${#username} != 0 )); then rsh_cmd="$rsh_cmd -l $username" cur_user="given user \"$username\"" else cur_user="current user \"`$LOGNAME`\"" fi if ! $rsh_cmd $rhost $TRUE; then log_note "$RSH to $rhost is not accessible" \ "with $cur_user." return 1 fi return 0 } # # Verify the remote host connection via rsh after rebooting # $1 remote host # function verify_remote { rhost=$1 # # The following loop waits for the remote system rebooting. # Each iteration will wait for 150 seconds. there are # total 5 iterations, so the total timeout value will # be 12.5 minutes for the system rebooting. This number # is an approxiate number. # typeset -i count=0 while ! verify_rsh_connect $rhost; do sleep 150 (( count = count + 1 )) if (( count > 5 )); then return 1 fi done return 0 } # # Replacement function for /usr/bin/rsh. This function will include # the /usr/bin/rsh and meanwhile return the execution status of the # last command. # # $1 usrname passing down to -l option of /usr/bin/rsh # $2 remote machine hostname # $3... command string # function rsh_status { typeset ruser=$1 typeset rhost=$2 typeset -i ret=0 typeset cmd_str="" typeset rsh_str="" shift; shift cmd_str="$@" err_file=$TMPDIR/${rhost}.${TESTCASE_ID}.err if (( ${#ruser} == 0 )); then rsh_str="$RSH -n" else rsh_str="$RSH -n -l $ruser" fi $rsh_str $rhost /usr/local/bin/ksh93 -c "'$cmd_str; \ print -u 2 \"status=\$?\"'" \ >/dev/null 2>$err_file ret=$? if (( $ret != 0 )); then $CAT $err_file $RM -f $std_file $err_file log_fail "$RSH itself failed with exit code $ret..." fi ret=$($GREP -v 'print -u 2' $err_file | $GREP 'status=' | \ $CUT -d= -f2) (( $ret != 0 )) && $CAT $err_file >&2 $RM -f $err_file >/dev/null 2>&1 return $ret } # # Get the SUNWstc-fs-zfs package installation path in a remote host # $1 remote host name # function get_remote_pkgpath { typeset rhost=$1 typeset pkgpath="" pkgpath=$($RSH -n $rhost "$PKGINFO -l SUNWstc-fs-zfs | $GREP BASEDIR: |\ $CUT -d: -f2") $ECHO $pkgpath } #/** # A function to find and locate free disks on a system or from given # disks as the parameter. Since the conversion to ATF, this function is # superfluous; it is assumed that the user will supply an accurate list of # disks to use. So we just return the arguments. # # $@ given disks to find which are free # # @return a string containing the list of available disks #*/ function find_disks { (( first=0 )) for disk in $@; do [[ $first == 1 ]] && echo -n " " (( first=1 )) case $disk in /dev/*) echo -n "$disk" ;; *) echo -n "/dev/$disk" ;; esac done } # A function to set convenience variables for disks. function set_disks { set -A disk_array $(find_disks $DISKS) [[ -z "$DISK_ARRAY_LIMIT" ]] && typeset -i DISK_ARRAY_LIMIT=5 export DISK="" typeset -i i=0 while (( i < ${#disk_array[*]} && i <= $DISK_ARRAY_LIMIT )); do export DISK${i}="${disk_array[$i]}" DISKSARRAY="$DISKSARRAY ${disk_array[$i]}" (( i = i + 1 )) done export DISK_ARRAY_NUM=$i export DISKSARRAY export disk=$DISK0 } # # Add specified user to specified group # # $1 group name # $2 user name # function add_user # { typeset gname=$1 typeset uname=$2 if (( ${#gname} == 0 || ${#uname} == 0 )); then log_fail "group name or user name are not defined." fi # Check to see if the user exists. $ID $uname > /dev/null 2>&1 && return 0 # Assign 1000 as the base uid typeset -i uid=1000 while true; do typeset -i ret $USERADD -u $uid -g $gname -d /var/tmp/$uname -m $uname ret=$? case $ret in 0) return 0 ;; # The uid is not unique 65) ((uid += 1)) ;; *) return 1 ;; esac if [[ $uid == 65000 ]]; then log_fail "No user id available under 65000 for $uname" fi done return 0 } # # Delete the specified user. # # $1 login name # function del_user # { typeset user=$1 if (( ${#user} == 0 )); then log_fail "login name is necessary." fi if $ID $user > /dev/null 2>&1; then log_must $USERDEL $user fi return 0 } # # Select valid gid and create specified group. # # $1 group name # function add_group # { typeset group=$1 if (( ${#group} == 0 )); then log_fail "group name is necessary." fi # See if the group already exists. $GROUPSHOW $group >/dev/null 2>&1 [[ $? == 0 ]] && return 0 # Assign 100 as the base gid typeset -i gid=100 while true; do $GROUPADD -g $gid $group > /dev/null 2>&1 typeset -i ret=$? case $ret in 0) return 0 ;; # The gid is not unique 65) ((gid += 1)) ;; *) return 1 ;; esac if [[ $gid == 65000 ]]; then log_fail "No user id available under 65000 for $group" fi done } # # Delete the specified group. # # $1 group name # function del_group # { typeset grp=$1 if (( ${#grp} == 0 )); then log_fail "group name is necessary." fi $GROUPDEL -n $grp > /dev/null 2>&1 typeset -i ret=$? case $ret in # Group does not exist, or was deleted successfully. 0|6|65) return 0 ;; # Name already exists as a group name 9) log_must $GROUPDEL $grp ;; *) return 1 ;; esac return 0 } # # This function will return true if it's safe to destroy the pool passed # as argument 1. It checks for pools based on zvols and files, and also # files contained in a pool that may have a different mountpoint. # function safe_to_destroy_pool { # $1 the pool name typeset pool="" typeset DONT_DESTROY="" # We check that by deleting the $1 pool, we're not # going to pull the rug out from other pools. Do this # by looking at all other pools, ensuring that they # aren't built from files or zvols contained in this pool. for pool in $($ZPOOL list -H -o name) do ALTMOUNTPOOL="" # this is a list of the top-level directories in each of the files # that make up the path to the files the pool is based on FILEPOOL=$($ZPOOL status -v $pool | $GREP /$1/ | \ $AWK '{print $1}') # this is a list of the zvols that make up the pool ZVOLPOOL=$($ZPOOL status -v $pool | $GREP "/dev/zvol/dsk/$1$" | \ $AWK '{print $1}') # also want to determine if it's a file-based pool using an # alternate mountpoint... POOL_FILE_DIRS=$($ZPOOL status -v $pool | \ $GREP / | $AWK '{print $1}' | \ $AWK -F/ '{print $2}' | $GREP -v "dev") for pooldir in $POOL_FILE_DIRS do OUTPUT=$($ZFS list -H -r -o mountpoint $1 | \ $GREP "${pooldir}$" | $AWK '{print $1}') ALTMOUNTPOOL="${ALTMOUNTPOOL}${OUTPUT}" done if [ ! -z "$ZVOLPOOL" ] then DONT_DESTROY="true" log_note "Pool $pool is built from $ZVOLPOOL on $1" fi if [ ! -z "$FILEPOOL" ] then DONT_DESTROY="true" log_note "Pool $pool is built from $FILEPOOL on $1" fi if [ ! -z "$ALTMOUNTPOOL" ] then DONT_DESTROY="true" log_note "Pool $pool is built from $ALTMOUNTPOOL on $1" fi done if [ -z "${DONT_DESTROY}" ] then return 0 else log_note "Warning: it is not safe to destroy $1!" return 1 fi } # # Get IP address of hostname # $1 hostname # function getipbyhost { typeset ip ip=`$ARP $1 2>/dev/null | $AWK -F\) '{print $1}' \ | $AWK -F\( '{print $2}'` $ECHO $ip } # # Setup iSCSI initiator to target # $1 target hostname # function iscsi_isetup { # check svc:/network/iscsi_initiator:default state, try to enable it # if the state is not ON typeset ISCSII_FMRI="svc:/network/iscsi_initiator:default" if [[ "ON" != $($SVCS -H -o sta $ISCSII_FMRI) ]]; then log_must $SVCADM enable $ISCSII_FMRI typeset -i retry=20 while [[ "ON" != $($SVCS -H -o sta $ISCSII_FMRI) && \ ( $retry -ne 0 ) ]] do (( retry = retry - 1 )) $SLEEP 1 done if [[ "ON" != $($SVCS -H -o sta $ISCSII_FMRI) ]]; then log_fail "$ISCSII_FMRI service can not be enabled!" fi fi log_must $ISCSIADM add discovery-address $(getipbyhost $1) log_must $ISCSIADM modify discovery --sendtargets enable log_must $DEVFSADM -i iscsi } # # Check whether iscsi parameter is set as remote # # return 0 if iscsi is set as remote, otherwise 1 # function check_iscsi_remote { if [[ $iscsi == "remote" ]] ; then return 0 else return 1 fi } # # Check if a volume is a valide iscsi target # $1 volume name # return 0 if suceeds, otherwise, return 1 # function is_iscsi_target { typeset dataset=$1 typeset target targets [[ -z $dataset ]] && return 1 targets=$($ISCSITADM list target | $GREP "Target:" | $AWK '{print $2}') [[ -z $targets ]] && return 1 for target in $targets; do [[ $dataset == $target ]] && return 0 done return 1 } # # Get the iSCSI name of a target # $1 target name # function iscsi_name { typeset target=$1 typeset name [[ -z $target ]] && log_fail "No parameter." if ! is_iscsi_target $target ; then log_fail "Not a target." fi name=$($ISCSITADM list target $target | $GREP "iSCSI Name:" \ | $AWK '{print $2}') return $name } # # check svc:/system/iscsitgt:default state, try to enable it if the state # is not ON # function iscsitgt_setup { log_must $RM -f $ISCSITGTFILE if [[ "ON" == $($SVCS -H -o sta $ISCSITGT_FMRI) ]]; then log_note "iscsitgt is already enabled" return fi log_must $SVCADM enable -t $ISCSITGT_FMRI typeset -i retry=20 while [[ "ON" != $($SVCS -H -o sta $ISCSITGT_FMRI) && \ ( $retry -ne 0 ) ]] do $SLEEP 1 (( retry = retry - 1 )) done if [[ "ON" != $($SVCS -H -o sta $ISCSITGT_FMRI) ]]; then log_fail "$ISCSITGT_FMRI service can not be enabled!" fi log_must $TOUCH $ISCSITGTFILE } # # set DISABLED state of svc:/system/iscsitgt:default # which is the most suiteable state if $ISCSITGTFILE exists # function iscsitgt_cleanup { if [[ -e $ISCSITGTFILE ]]; then log_must $SVCADM disable $ISCSITGT_FMRI log_must $RM -f $ISCSITGTFILE fi } # # Close iSCSI initiator to target # $1 target hostname # function iscsi_iclose { log_must $ISCSIADM modify discovery --sendtargets disable log_must $ISCSIADM remove discovery-address $(getipbyhost $1) $DEVFSADM -Cv } # # Get the available ZFS compression options # $1 option type zfs_set|zfs_compress # function get_compress_opts { typeset COMPRESS_OPTS typeset GZIP_OPTS="gzip gzip-1 gzip-2 gzip-3 gzip-4 gzip-5 \ gzip-6 gzip-7 gzip-8 gzip-9" if [[ $1 == "zfs_compress" ]] ; then COMPRESS_OPTS="on lzjb" elif [[ $1 == "zfs_set" ]] ; then COMPRESS_OPTS="on off lzjb" fi typeset valid_opts="$COMPRESS_OPTS" $ZFS get 2>&1 | $GREP gzip >/dev/null 2>&1 if [[ $? -eq 0 ]]; then valid_opts="$valid_opts $GZIP_OPTS" fi $ECHO "$valid_opts" } # # Check the subcommand/option is supported # function check_opt_support #command, option { typeset command=$1 typeset option=$2 if [[ -z $command ]]; then return 0 elif [[ -z $option ]]; then eval "$ZFS 2>&1 | $GREP '$command' > /dev/null 2>&1" else eval "$ZFS $command 2>&1 | $GREP -- '$option' | \ $GREP -v -- 'User-defined' > /dev/null 2>&1" fi return $? } # # Check the zpool subcommand/option is supported # function check_zpool_opt_support #command, option { typeset command=$1 typeset option=$2 if [[ -z $command ]]; then return 0 elif [[ -z $option ]]; then eval "$ZPOOL 2>&1 | $GREP '$command' > /dev/null 2>&1" else eval "$ZPOOL $command 2>&1 | $GREP -- '$option' > /dev/null 2>&1" fi return $? } # # Verify zfs operation with -p option work as expected # $1 operation, value could be create, clone or rename # $2 dataset type, value could be fs or vol # $3 dataset name # $4 new dataset name # function verify_opt_p_ops { typeset ops=$1 typeset datatype=$2 typeset dataset=$3 typeset newdataset=$4 if [[ $datatype != "fs" && $datatype != "vol" ]]; then log_fail "$datatype is not supported." fi # check parameters accordingly case $ops in create) newdataset=$dataset dataset="" if [[ $datatype == "vol" ]]; then ops="create -V $VOLSIZE" fi ;; clone) if [[ -z $newdataset ]]; then log_fail "newdataset should not be empty" \ "when ops is $ops." fi log_must datasetexists $dataset log_must snapexists $dataset ;; rename) if [[ -z $newdataset ]]; then log_fail "newdataset should not be empty" \ "when ops is $ops." fi log_must datasetexists $dataset log_mustnot snapexists $dataset ;; *) log_fail "$ops is not supported." ;; esac # make sure the upper level filesystem does not exist if datasetexists ${newdataset%/*} ; then log_must $ZFS destroy -rRf ${newdataset%/*} fi # without -p option, operation will fail log_mustnot $ZFS $ops $dataset $newdataset log_mustnot datasetexists $newdataset ${newdataset%/*} # with -p option, operation should succeed log_must $ZFS $ops -p $dataset $newdataset if ! datasetexists $newdataset ; then log_fail "-p option does not work for $ops" fi # when $ops is create or clone, redo the operation still return zero if [[ $ops != "rename" ]]; then log_must $ZFS $ops -p $dataset $newdataset fi return 0 } function get_disk_guid { typeset diskname=$1 lastcwd=$(pwd) cd /dev guid=$($ZDB -l ${diskname} | ${AWK} '/^ guid:/ {print $2}' | head -1) cd $lastcwd echo $guid } # # Get cachefile for a pool. # Prints the cache file, if there is one. # Returns 0 for a default zpool.cache, 1 for an explicit one, and 2 for none. # function cachefile_for_pool { typeset pool=$1 cachefile=$(get_pool_prop cachefile $pool) [[ $? != 0 ]] && return 1 case "$cachefile" in none) ret=2 ;; "-") ret=2 for dir in /boot/zfs /etc/zfs; do if [[ -f "${dir}/zpool.cache" ]]; then cachefile="${dir}/zpool.cache" ret=0 break fi done ;; *) ret=1; esac [[ $ret -eq 0 || $ret -eq 1 ]] && print "$cachefile" return $ret } # # Assert that the pool is in the appropriate cachefile. # function assert_pool_in_cachefile { typeset pool=$1 cachefile=$(cachefile_for_pool $pool) [ $? -ne 0 ] && log_fail "ERROR: Cachefile not created for '$pool'?" log_must test -e "${cachefile}" log_must zdb -U ${cachefile} -C ${pool} } # # Get the zdb options given the cachefile state of the pool. # function zdb_cachefile_opts { typeset pool=$1 typeset vdevdir=$2 typeset opts if poolexists "$pool"; then cachefile=$(cachefile_for_pool $pool) typeset -i ret=$? case $ret in 0) opts="-C" ;; 1) opts="-U $cachefile -C" ;; 2) opts="-eC" ;; *) log_fail "Unknown return '$ret'" ;; esac else opts="-eC" [[ -n "$vdevdir" ]] && opts="$opts -p $vdevdir" fi echo "$opts" } # # Get configuration of pool # $1 pool name # $2 config name # function get_config { typeset pool=$1 typeset config=$2 typeset vdevdir=$3 typeset alt_root typeset zdb_opts zdb_opts=$(zdb_cachefile_opts $pool $vdevdir) value=$($ZDB $zdb_opts $pool | $GREP "$config:" | $AWK -F: '{print $2}') if [[ -n $value ]] ; then value=${value#'} value=${value%'} else return 1 fi echo $value return 0 } # # Privated function. Random select one of items from arguments. # # $1 count # $2-n string # function _random_get { typeset cnt=$1 shift typeset str="$@" typeset -i ind ((ind = RANDOM % cnt + 1)) typeset ret=$($ECHO "$str" | $CUT -f $ind -d ' ') $ECHO $ret } # # Random select one of item from arguments which include NONE string # function random_get_with_non { typeset -i cnt=$# ((cnt =+ 1)) _random_get "$cnt" "$@" } # # Random select one of item from arguments which doesn't include NONE string # function random_get { _random_get "$#" "$@" } # # Detect if the current system support slog # function verify_slog_support { typeset dir=$TMPDIR/disk.${TESTCASE_ID} typeset pool=foo.${TESTCASE_ID} typeset vdev=$dir/a typeset sdev=$dir/b $MKDIR -p $dir log_must create_vdevs $vdev $sdev typeset -i ret=0 if ! $ZPOOL create -n $pool $vdev log $sdev > /dev/null 2>&1; then ret=1 fi $RM -r $dir return $ret } # # The function will generate a dataset name with specific length # $1, the length of the name # $2, the base string to construct the name # function gen_dataset_name { typeset -i len=$1 typeset basestr="$2" typeset -i baselen=${#basestr} typeset -i iter=0 typeset l_name="" if (( len % baselen == 0 )); then (( iter = len / baselen )) else (( iter = len / baselen + 1 )) fi while (( iter > 0 )); do l_name="${l_name}$basestr" (( iter -= 1 )) done $ECHO $l_name } # # Ensure that a given path has been synced, not just ZIL committed. # # XXX The implementation currently requires calling 'zpool history'. On # FreeBSD, the sync(8) command (via $SYNC) calls zfs_sync() which just # does a zil_commit(), as opposed to a txg_wait_synced(). For things that # require writing to their final destination (e.g. for intentional # corruption purposes), zil_commit() is not good enough. # function force_sync_path # path { typeset path="$1" zfspath=$($DF $path 2>/dev/null | tail -1 | cut -d" " -f1 | cut -d/ -f1) [ -z "$zfspath" ] && return false log_note "Force syncing ${zfspath} for ${path} ..." $ZPOOL history $zfspath >/dev/null 2>&1 } # # Get cksum tuple of dataset # $1 dataset name # # zdb output is like below # " Dataset pool/fs [ZPL], ID 978, cr_txg 2277, 19.0K, 5 objects, # rootbp [L0 DMU objset] 400L/200P DVA[0]=<0:1880c00:200> # DVA[1]=<0:341880c00:200> fletcher4 lzjb LE contiguous birth=2292 fill=5 # cksum=989930ccf:4014fe00c83:da5e388e58b4:1f7332052252ac " # function datasetcksum { typeset cksum $SYNC cksum=$($ZDB -vvv $1 | $GREP "^Dataset $1 \[" | $GREP "cksum" \ | $AWK -F= '{print $6}') $ECHO $cksum } # # Get cksum of file # #1 file path # function checksum { typeset cksum cksum=$($CKSUM $1 | $AWK '{print $1}') $ECHO $cksum } # # Get the given disk/slice state from the specific field of the pool # function get_device_state #pool disk field("", "spares","logs") { typeset pool=$1 typeset disk=${2#/dev/dsk/} disk=${disk#/dev/rdsk/} disk=${disk#/dev/} typeset field=${3:-$pool} state=$($ZPOOL status -v "$pool" 2>/dev/null | \ $NAWK -v device=$disk -v pool=$pool -v field=$field \ 'BEGIN {startconfig=0; startfield=0; } /config:/ {startconfig=1} (startconfig==1)&&($1==field) {startfield=1; next;} (startfield==1)&&($1==device) {print $2; exit;} (startfield==1)&&(NF>=3)&&($(NF-1)=="was")&&($NF==device) {print $2; exit;} (startfield==1)&&($1==field || $1 ~ "^spares$" || $1 ~ "^logs$") {startfield=0}') print $state } # # print the given directory filesystem type # # $1 directory name # function get_fstype { typeset dir=$1 if [[ -z $dir ]]; then log_fail "Usage: get_fstype " fi # # $ df -n / # / : ufs # $DF -n $dir | $AWK '{print $3}' } # # Given a disk, label it to VTOC regardless what label was on the disk # $1 disk # function labelvtoc { typeset disk=$1 if [[ -z $disk ]]; then log_fail "The disk name is unspecified." fi typeset label_file=$TMPDIR/labelvtoc.${TESTCASE_ID} typeset arch=$($UNAME -p) if [[ $arch == "i386" ]]; then $ECHO "label" > $label_file $ECHO "0" >> $label_file $ECHO "" >> $label_file $ECHO "q" >> $label_file $ECHO "q" >> $label_file $FDISK -B $disk >/dev/null 2>&1 # wait a while for fdisk finishes $SLEEP 60 elif [[ $arch == "sparc" ]]; then $ECHO "label" > $label_file $ECHO "0" >> $label_file $ECHO "" >> $label_file $ECHO "" >> $label_file $ECHO "" >> $label_file $ECHO "q" >> $label_file else log_fail "unknown arch type" fi $FORMAT -e -s -d $disk -f $label_file typeset -i ret_val=$? $RM -f $label_file # # wait the format to finish # $SLEEP 60 if (( ret_val != 0 )); then log_fail "unable to label $disk as VTOC." fi return 0 } # # Detect if the given filesystem property is supported in this release # # 0 Yes, it is supported # !0 No, it is not supported # function fs_prop_exist { typeset prop=$1 if [[ -z $prop ]]; then log_fail "Usage: fs_prop_exist " return 1 fi # # If the property is shortened column name, # convert it to the standard name # case $prop in avail) prop=available ;; refer) prop=referenced ;; volblock) prop=volblocksize ;; compress) prop=compression ;; rdonly) prop=readonly ;; recsize) prop=recordsize ;; reserv) prop=reservation ;; refreserv) prop=refreservation ;; esac # # The zfs get output looks like the following # # # The following properties are supported: # # PROPERTY EDIT INHERIT VALUES # # available NO NO # compressratio NO NO <1.00x or higher if compressed> # creation NO NO # ... ... # zoned YES YES on | off # # Sizes are specified in bytes with standard units such as K, M, G, etc. # # # Start to extract property from the first blank line after 'PROPERTY' # and stop at the next blank line # $ZFS get 2>&1 | \ $AWK '/PROPERTY/ {start=1; next} /Sizes/ {start=0} start==1 {print $1}' | \ $GREP -w "$prop" > /dev/null 2>&1 return $? } # # Detect if the given pool property is supported in this release # # 0 Yes, it is supported # !0 No, it is not supported # function pool_prop_exist { typeset prop=$1 if [[ -z $prop ]]; then log_fail "Usage: pool_prop_exist " return 1 fi # # If the property is shortened column name, # convert it to the standard name # case $prop in avail) prop=available ;; cap) prop=capacity ;; replace) prop=autoreplace ;; esac # # The zpool get output looks like the following # # usage: # get <"all" | property[,...]> ... # # the following properties are supported: # # PROPERTY EDIT VALUES # # available NO # capacity NO # guid NO # health NO # size NO # used NO # altroot YES # autoreplace YES on | off # bootfs YES # cachefile YES | none # delegation YES on | off # failmode YES wait | continue | panic # version YES $ZPOOL get 2>&1 | \ $AWK '/PROPERTY/ {start=1; next} start==1 {print $1}' | \ $GREP -w "$prop" > /dev/null 2>&1 return $? } # # check if the system was installed as zfsroot or not # return: 0 ture, otherwise false # function is_zfsroot { $DF -n / | $GREP zfs > /dev/null 2>&1 return $? } # # get the root filesystem name if it's zfsroot system. # # return: root filesystem name function get_rootfs { typeset rootfs="" rootfs=$($MOUNT | $AWK '$3 == "\/" && $4~/zfs/ {print $1}') if [[ -z "$rootfs" ]]; then log_fail "Can not get rootfs" fi $ZFS list $rootfs > /dev/null 2>&1 if (( $? == 0 )); then $ECHO $rootfs else log_fail "This is not a zfsroot system." fi } # # get the rootfs's pool name # return: # rootpool name # function get_rootpool { typeset rootfs="" typeset rootpool="" rootfs=$(get_rootfs) rootpool=`$ECHO $rootfs | awk -F\/ '{print $1}'` echo $rootpool } # # Get the sub string from specified source string # # $1 source string # $2 start position. Count from 1 # $3 offset # function get_substr #src_str pos offset { typeset pos offset $ECHO $1 | \ $NAWK -v pos=$2 -v offset=$3 '{print substr($0, pos, offset)}' } # # Check if the given device is physical device # function is_physical_device #device { dev_file=`find_disks $1` [ -c "${dev_file}" -o -b "${dev_file}" ] return $? } # # Get the directory path of given device # function get_device_dir #device { typeset device=$1 if ! $(is_physical_device $device) ; then if [[ $device != "/" ]]; then device=${device%/*} fi $ECHO $device else $ECHO "/dev" fi } # # Get the package name # function get_package_name { typeset dirpath=${1:-$STC_NAME} print "SUNWstc-${dirpath}" | /usr/bin/sed -e "s/\//-/g" } # # Get the word numbers from a string separated by white space # function get_word_count { $ECHO $1 | $WC -w } # # To verify if the require numbers of disks is given # function verify_disk_count { typeset -i min=${2:-1} typeset -i count=$(get_word_count "$1") if (( count < min )); then atf_skip "A minimum of $min disks is required to run." \ " You specified $count disk(s)" fi } # # Verify that vfs.zfs.vol.recursive is set, so pools can be created using zvols # as backing stores. # function verify_zvol_recursive { if [ "`sysctl -n vfs.zfs.vol.recursive`" -ne 1 ]; then atf_skip "Recursive ZVOLs not enabled" fi } # # bsdmap disk/slice number to a device path # function bsddevmap { typeset arg=$1 echo $arg | egrep "*s[0-9]$" > /dev/null 2>&1 if [ $? -eq 0 ] then n=`echo $arg| wc -c` set -A map a b c d e f g h i j s=`echo $arg | cut -c $((n-1))` arg=${arg%s[0-9]}${map[$s]} fi echo $arg } # # Get the name of the snapshots directory. Traditionally .zfs/snapshots # function get_snapdir_name { echo ".zfs/snapshot" } # # Unmount all ZFS filesystems except for those that are in the KEEP variable # function unmount_all_safe { echo $(all_pools) | \ $XARGS -n 1 $ZFS list -H -o name -t all -r | \ $XARGS -n 1 $ZFS unmount } # # Return the highest pool version that this OS can create # function get_zpool_version { # We assume output from zpool upgrade -v of the form: # # This system is currently running ZFS version 2. # . # . typeset ZPOOL_VERSION=$($ZPOOL upgrade -v | $HEAD -1 | \ $AWK '{print $NF}' | $SED -e 's/\.//g') # Starting with version 5000, the output format changes to: # This system supports ZFS pool feature flags. # . # . if [[ $ZPOOL_VERSION = "flags" ]]; then ZPOOL_VERSION=5000 fi echo $ZPOOL_VERSION } # Ensures that zfsd is running, starting it if necessary. Every test that # interacts with zfsd must call this at startup. This is intended primarily # to eliminate interference from outside the test suite. function ensure_zfsd_running { if ! service zfsd status > /dev/null 2>&1; then service zfsd start || service zfsd onestart service zfsd status > /dev/null 2>&1 || log_unsupported "Test requires zfsd" fi } # Temporarily stops ZFSD, because it can interfere with some tests. If this # function is used, then restart_zfsd _must_ be called in the cleanup routine. function stop_zfsd { $RM -f $TMPDIR/.zfsd_enabled_during_stf_zfs_tests if [[ -n "$ZFSD" && -x "$ZFSD" ]]; then if /etc/rc.d/zfsd status > /dev/null; then log_note "Stopping zfsd" $TOUCH $TMPDIR/.zfsd_enabled_during_stf_zfs_tests /etc/rc.d/zfsd stop || /etc/rc.d/zfsd onestop fi fi } # Restarts zfsd after it has been stopped by stop_zfsd. Intelligently restarts # only iff zfsd was running at the time stop_zfsd was called. function restart_zfsd { if [[ -f $TMPDIR/.zfsd_enabled_during_stf_zfs_tests ]]; then log_note "Restarting zfsd" /etc/rc.d/zfsd start || /etc/rc.d/zfsd onestart fi $RM -f $TMPDIR/.zfsd_enabled_during_stf_zfs_tests } # # Using the given , obtain the value of the property for # the given identified by numeric id. # function get_tvd_prop # vdev tvd propname { typeset vdev=$1 typeset -i tvd=$2 typeset propname=$3 $ZDB -l $vdev | $AWK -v tvd=$tvd -v prop="${propname}:" ' BEGIN { start = 0; } /^ id:/ && ($2==tvd) { start = 1; next; } (start==0) { next; } /^ [a-z]+/ && ($1==prop) { print $2; exit; } /^ children/ { exit; } ' } # # Convert a DVA into a physical block address. Prints number of blocks. # This takes the usual printed form, in which offsets are left shifted so # they represent bytes rather than the native sector count. # function dva_to_block_addr # dva { typeset dva=$1 typeset offcol=$(echo $dva | cut -f2 -d:) typeset -i offset="0x${offcol}" # First add 4MB to skip the boot blocks and first two vdev labels, # then convert to 512 byte blocks (for use with dd). Note that this # differs from simply adding 8192 blocks, since the input offset is # given in bytes and has the actual ashift baked in. (( offset += 4*1024*1024 )) (( offset >>= 9 )) echo "$offset" } # # Convert a RAIDZ DVA into a physical block address. This has the same # output as dva_to_block_addr (number of blocks from beginning of device), but # is more complicated due to RAIDZ. ashift is normally always 9, but RAIDZ # uses the actual tvd ashift instead. Furthermore, the number of vdevs changes # the actual block for each device. # function raidz_dva_to_block_addr # dva ncols ashift { typeset dva=$1 typeset -i ncols=$2 typeset -i ashift=$3 typeset -i offset=0x$(echo $dva | cut -f2 -d:) (( offset >>= ashift )) typeset -i ioff=$(( (offset + ncols - 1) / ncols )) # Now add the front 4MB and return. (( ioff += ( 4194304 >> $ashift ) )) echo "$ioff" } # # Return the vdevs for the given toplevel vdev number. # Child vdevs will only be included if they are ONLINE. Output format: # # [: ...] # # Valid toplevel vdev types are mirror, raidz[1-3], leaf (which can be a # disk or a file). Note that 'nchildren' can be larger than the number of # returned children; it represents the number of children regardless of how # many are actually online. # function vdevs_for_tvd # pool tvd { typeset pool=$1 typeset -i tvd=$2 $ZPOOL status $pool | $AWK -v want_tvd=$tvd ' BEGIN { start = 0; tvd = -1; lvd = -1; type = "UNKNOWN"; disks = ""; disk = ""; nchildren = 0; } /NAME.*STATE/ { start = 1; next; } (start==0) { next; } (tvd > want_tvd) { exit; } END { print type " " nchildren " " disks; } length(disk) > 0 { if (length(disks) > 0) { disks = disks " "; } if (substr(disk, 0, 1) == "/") { disks = disks disk; } else { disks = disks "/dev/" disk; } disk = ""; } /^\t(spares|logs)/ { tvd = want_tvd + 1; next; } /^\t (mirror|raidz[1-3])-[0-9]+/ { tvd += 1; (tvd == want_tvd) && type = substr($1, 0, 6); next; } /^\t [\/A-Za-z]+/ { tvd += 1; if (tvd == want_tvd) { (( nchildren += 1 )) type = "leaf"; ($2 == "ONLINE") && disk = $1; } next; } (tvd < want_tvd) { next; } /^\t spare-[0-9]+/ { next; } /^\t [\/A-Za-z]+/ { (( nchildren += 1 )) ($2 == "ONLINE") && disk = $1; next; } /^\t [\/A-Za-z]+/ { (( nchildren += 1 )) ($2 == "ONLINE") && disk = $1; next; } ' } # # Get a vdev path, ashift & offset for a given pool/dataset and DVA. # If desired, can also select the toplevel vdev child number. # function dva_to_vdev_ashift_off # pool/dataset dva [leaf_vdev_num] { typeset poollike=$1 typeset dva=$2 typeset -i leaf_vdev_num=$3 # vdevs are normally 0-indexed while arguments are 1-indexed. (( leaf_vdev_num += 1 )) # Strip any child datasets or snapshots. pool=$(echo $poollike | sed -e 's,[/@].*,,g') tvd=$(echo $dva | cut -d: -f1) set -- $(vdevs_for_tvd $pool $tvd) log_debug "vdevs_for_tvd: $* " tvd_type=$1; shift nchildren=$1; shift lvd=$(eval echo \$$leaf_vdev_num) log_debug "type='$tvd_type' children='$nchildren' lvd='$lvd' dva='$dva'" case $tvd_type in raidz*) ashift=$(get_tvd_prop $lvd $tvd ashift) log_debug "raidz: ashift='${ashift}'" off=$(raidz_dva_to_block_addr $dva $nchildren $ashift) ;; *) ashift=9 off=$(dva_to_block_addr $dva) ;; esac echo "${lvd}:${ashift}:${off}" } # # Get the DVA for the specified dataset's given filepath. # function file_dva # dataset filepath [level] [offset] [dva_num] { typeset dataset=$1 typeset filepath=$2 typeset -i level=$3 typeset -i offset=$4 typeset -i dva_num=$5 # A lot of these numbers can be larger than 32-bit, so we have to # use floats to manage them... :( typeset -i blksz=0 typeset -i blknum=0 typeset -i startoff # The inner match is for 'DVA[0]=<0:1b412600:200>', in which the # text surrounding the actual DVA is a fixed size with 8 characters # before it and 1 after. $ZDB -P -vvvvv -o "ZFS plain file" $dataset $filepath | \ $AWK -v level=${level} -v dva_num=${dva_num} ' BEGIN { stage = 0; } (stage == 0) && ($1=="Object") { stage = 1; next; } (stage == 1) { print $3 " " $4; stage = 2; next; } (stage == 2) && /^Indirect blocks/ { stage=3; next; } (stage < 3) { next; } match($2, /L[0-9]/) { if (substr($2, RSTART+1, RLENGTH-1) != level) { next; } } match($3, /DVA\[.*>/) { dva = substr($3, RSTART+8, RLENGTH-9); if (substr($3, RSTART+4, 1) == dva_num) { print $1 " " dva; } } ' | \ while read line; do log_debug "params='$blksz/$blknum/$startoff' line='$line'" if (( blksz == 0 )); then typeset -i iblksz=$(echo $line | cut -d " " -f1) typeset -i dblksz=$(echo $line | cut -d " " -f2) # Calculate the actual desired block starting offset. if (( level > 0 )); then typeset -i nbps_per_level typeset -i indsz typeset -i i=0 (( nbps_per_level = iblksz / 128 )) (( blksz = dblksz )) for (( i = 0; $i < $level; i++ )); do (( blksz *= nbps_per_level )) done else blksz=$dblksz fi (( blknum = offset / blksz )) (( startoff = blknum * blksz )) continue fi typeset lineoffstr=$(echo $line | cut -d " " -f1) typeset -i lineoff=$(printf "%d" "0x${lineoffstr}") typeset dva="$(echo $line | cut -d " " -f2)" log_debug "str='$lineoffstr' lineoff='$lineoff' dva='$dva'" if [[ -n "$dva" ]] && (( lineoff == startoff )); then echo $line | cut -d " " -f2 return 0 fi done return 1 } # # Corrupt the given dataset's filepath file. This will obtain the first # level 0 block's DVA and scribble random bits on it. # function corrupt_file # dataset filepath [leaf_vdev_num] { typeset dataset=$1 typeset filepath=$2 typeset -i leaf_vdev_num="$3" dva=$(file_dva $dataset $filepath) [ $? -ne 0 ] && log_fail "ERROR: Can't find file $filepath on $dataset" vdoff=$(dva_to_vdev_ashift_off $dataset $dva $leaf_vdev_num) vdev=$(echo $vdoff | cut -d: -f1) ashift=$(echo $vdoff | cut -d: -f2) off=$(echo $vdoff | cut -d: -f3) blocksize=$(( 1 << $ashift )) log_note "Corrupting ${dataset}'s $filepath on $vdev at DVA $dva with ashift $ashift" log_must $DD if=/dev/urandom bs=$blocksize of=$vdev seek=$off count=1 conv=notrunc } # # Given a number of files, this function will iterate through # the loop creating the specified number of files, whose names # will start with . # # The argument is special: it can be "ITER", in which case # the -d argument will be the value of the current iteration. It # can be 0, in which case it will always be 0. Otherwise, it will # always be the given value. # # If is specified, a snapshot will be taken using the # argument as the snapshot basename. # function populate_dir # basename num_files write_count blocksz data snapbase { typeset basename=$1 typeset -i num_files=$2 typeset -i write_count=$3 typeset -i blocksz=$4 typeset data=$5 typeset snapbase="$6" log_note "populate_dir: data='$data'" for (( i = 0; i < num_files; i++ )); do case "$data" in 0) d=0 ;; ITER) d=$i ;; *) d=$data ;; esac log_must $FILE_WRITE -o create -c $write_count \ -f ${basename}.$i -b $blocksz -d $d [ -n "$snapbase" ] && log_must $ZFS snapshot ${snapbase}.${i} done } # Reap all children registered in $child_pids. function reap_children { [ -z "$child_pids" ] && return for wait_pid in $child_pids; do log_must $KILL $wait_pid done child_pids="" } # Busy a path. Expects to be reaped via reap_children. Tries to run as # long and slowly as possible. [num] is taken as a hint; if such a file # already exists a different one will be chosen. function busy_path # [num] { typeset busypath=$1 typeset -i num=$2 while :; do busyfile="$busypath/busyfile.${num}" [ ! -f "$busyfile" ] && break done cmd="$DD if=/dev/urandom of=$busyfile bs=512" ( cd $busypath && $cmd ) & typeset pid=$! $SLEEP 1 log_must $PS -p $pid child_pids="$child_pids $pid" } Index: projects/zfsd/head/tests/sys/cddl/zfs/include/logapi.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/logapi.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/logapi.kshlib (revision 329035) @@ -1,416 +1,417 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)logapi.kshlib 1.2 07/03/14 SMI" # # # This is a ksh function library. It is intended to be sourced into # other ksh scripts and not executed directly. # . ${STF_SUITE}/include/stf.shlib # # Send a debug message to stderr, if $STF_DEBUG set. # function log_debug { [ -z "$STF_DEBUG" ] && return echo "$*" >&2 } # Output an assertion # # $@ - assertion text function log_assert { _printline ASSERTION: "$@" } # Output a comment # # $@ - comment text function log_note { _printline NOTE: "$@" } # Execute a positive test and exit $STF_FAIL is test fails # # $@ - command to execute function log_must { log_pos "$@" (( $? != 0 )) && log_fail } # Execute a command that must exit $1 # # $@ - command to execute function log_mustbe { typeset exitcode_wanted=$1 shift log_cmd "$@" (( $? != $exitcode_wanted )) && log_fail } # Execute a negative test and exit $STF_FAIL if test passes # # $@ - command to execute function log_mustnot { log_neg "$@" (( $? != 0 )) && log_fail } # Execute a command that should only be logged if it fails. # # $@ - command to execute function log_onfail { eval $@ typeset status=$? [ $status -eq 0 ] && return _printerror "$@" "unexpectedly exited $status" } # Execute and print command with status where success equals non-zero result # or output includes expected keyword # # $2-$@ - command to execute # # Summary: execute $@. Return 1 if any of the following hold: # 1) The command exited 0, 127, 138, or 139 # 2) The command's stderr included "internal error" or # "assertion failed" # # return 0 if command fails, or the output contains the keyword expected, # return 1 otherwise function log_neg { typeset out="" typeset logfile="$TMPDIR/log.$$" typeset ret=1 while [[ -e $logfile ]]; do logfile="$logfile.$$" done "$@" 2>$logfile typeset status=$? out="/bin/cat $logfile" # unexpected status if (( $status == 0 )); then print -u2 $($out) _printerror "$@" "unexpectedly exited $status" # missing binary elif (( $status == 127 )); then print -u2 $($out) _printerror "$@" "unexpectedly exited $status (File not found)" # bus error - core dump elif (( $status == 138 )); then print -u2 $($out) _printerror "$@" "unexpectedly exited $status (Bus Error)" # segmentation violation - core dump elif (( $status == 139 )); then print -u2 $($out) _printerror "$@" "unexpectedly exited $status (SEGV)" else $out | /usr/bin/egrep -i "internal error|assertion failed" \ > /dev/null 2>&1 # internal error or assertion failed if (( $? == 0 )); then print -u2 $($out) _printerror "$@" "internal error or assertion failure" \ " exited $status" else ret=0 fi if (( $ret == 0 )); then [[ -n $LOGAPI_DEBUG ]] && print $($out) _printsuccess "$@" "exited $status" fi fi _recursive_output $logfile "false" return $ret } # Execute and print command; unconditionally return its exit code. # Useful for code that needs to do more specialized exit status filtering. function log_cmd { typeset logfile="$TMPDIR/log.$$" while [[ -e $logfile ]]; do logfile="$logfile.$$" done "$@" 2>$logfile typeset status=$? _printline "EXECUTED (exited $status): $@" _recursive_output $logfile "false" return $status } # Execute and print command with status where success equals zero result # # $@ command to execute # # Summary: run $@. return 1 if its exit status was nonzero or if it printed # "internal error" or "assertion failed" to stderr. # print stderr on failure or if LOGAPI_DEBUG is set. # # return command exit status function log_pos { typeset out="" typeset logfile="$TMPDIR/log.$$" while [[ -e $logfile ]]; do logfile="$logfile.$$" done "$@" 2>$logfile typeset status=$? out="/bin/cat $logfile" if (( $status != 0 )) ; then print -u2 $($out) _printerror "$@" "exited $status" else $out | /usr/bin/egrep -i "internal error|assertion failed" \ > /dev/null 2>&1 # internal error or assertion failed if [[ $? -eq 0 ]]; then print -u2 $($out) _printerror "$@" "internal error or assertion failure" \ " exited $status" status=1 else [[ -n $LOGAPI_DEBUG ]] && print $($out) _printsuccess "$@" fi fi _recursive_output $logfile "false" return $status } # Set an exit handler # # $@ - function(s) to perform on exit function log_onexit { _CLEANUP="$@" } # # Exit functions # # Perform cleanup and exit $STF_PASS # # $@ - message text function log_pass { _endlog $STF_PASS "$@" } # Perform cleanup and exit $STF_FAIL # # $@ - message text function log_fail { _endlog $STF_FAIL "$@" } # Perform cleanup and exit $STF_UNRESOLVED # # $@ - message text function log_unresolved { _endlog $STF_UNRESOLVED "$@" } # Perform cleanup and exit $STF_NOTINUSE # # $@ - message text function log_notinuse { _endlog $STF_NOTINUSE "$@" } # Perform cleanup and exit $STF_UNSUPPORTED # # $@ - message text function log_unsupported { _endlog $STF_UNSUPPORTED "$@" } # Perform cleanup and exit $STF_UNTESTED # # $@ - message text function log_untested { _endlog $STF_UNTESTED "$@" } # Perform cleanup and exit $STF_UNINITIATED # # $@ - message text function log_uninitiated { _endlog $STF_UNINITIATED "$@" } # Perform cleanup and exit $STF_NORESULT # # $@ - message text function log_noresult { _endlog $STF_NORESULT "$@" } # Perform cleanup and exit $STF_WARNING # # $@ - message text function log_warning { _endlog $STF_WARNING "$@" } # Perform cleanup and exit $STF_TIMED_OUT # # $@ - message text function log_timed_out { _endlog $STF_TIMED_OUT "$@" } # Perform cleanup and exit $STF_OTHER # # $@ - message text function log_other { _endlog $STF_OTHER "$@" } # # Internal functions # # Perform cleanup and exit # # Summary: Runs any cleanup routine registered with log_onexit. Prints a # message and exits $1. Note: the _recursive_output does # nothing, because the rest of this api guarantees that the # logfile will not exist. # $1 - stf exit code # $2-$n - message text function _endlog { typeset logfile="$TMPDIR/log.$$" _recursive_output $logfile export STF_EXITCODE=$1 shift (( ${#@} > 0 )) && _printline "$@" if [[ -n $_CLEANUP ]] ; then typeset cleanup=$_CLEANUP log_onexit "" log_note "Performing local cleanup via log_onexit ($cleanup)" $cleanup fi exit $STF_EXITCODE } # Output a formatted line # # $@ - message text function _printline { print `/bin/date +%H:%M:%S` "$@" } # Output an error message # # $@ - message text function _printerror { _printline ERROR: "$@" } # Output a success message # # $@ - message text function _printsuccess { _printline SUCCESS: "$@" } # Output logfiles recursively # # $1 - start file # $2 - indicate whether output the start file itself, default as yes. function _recursive_output #logfile { typeset logfile=$1 while [[ -e $logfile ]]; do if [[ -z $2 || $logfile != $1 ]]; then /bin/cat $logfile fi /bin/rm -f $logfile logfile="$logfile.$$" done } Index: projects/zfsd/head/tests/sys/cddl/zfs/include/stf.shlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/stf.shlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/stf.shlib (revision 329035) @@ -1,52 +1,53 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)stf.shlib 1.2 07/04/12 SMI" # STF_PASS=0 STF_FAIL=1 STF_UNRESOLVED=2 STF_NOTINUSE=3 STF_UNSUPPORTED=4 STF_UNTESTED=5 STF_UNINITIATED=6 STF_NORESULT=7 STF_WARNING=8 STF_TIMED_OUT=9 STF_OTHER=10 # do this to use the names: eval echo \$STF_RESULT_NAME_${result} STF_RESULT_NAME_0="PASS" STF_RESULT_NAME_1="FAIL" STF_RESULT_NAME_2="UNRESOLVED" STF_RESULT_NAME_3="NOTINUSE" STF_RESULT_NAME_4="UNSUPPORTED" STF_RESULT_NAME_5="UNTESTED" STF_RESULT_NAME_6="UNINITIATED" STF_RESULT_NAME_7="NORESULT" STF_RESULT_NAME_8="WARNING" STF_RESULT_NAME_9="TIMED_OUT" STF_RESULT_NAME_10="OTHER" Index: projects/zfsd/head/tests/sys/cddl/zfs/include/testenv.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/include/testenv.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/include/testenv.kshlib (revision 329035) @@ -1,19 +1,20 @@ +# vim: filetype=sh . ${STF_SUITE}/include/libtest.kshlib . ${STF_SUITE}/include/commands.cfg # Environment-dependent constants. for d in `geom disk list | awk '/Name:/ {print $3}'`; do # Clear the GPT label first to avoid spurious create failures. gpart destroy -F $d >/dev/null 2>&1 if gpart create -s gpt $d >/dev/null 2>&1 ; then gpart destroy $d >/dev/null 2>&1 || continue DISKS=("${DISKS[@]}" "/dev/$d") #"$DISKS $d" fi # Don't bother testing any more if we have enough already. # Currently we use at most 5 disks plus 1 for temporary disks. [ ${#DISKS[@]} -eq 6 ] && break done export KEEP="$(zpool list -H -o name)" # Pull in constants. . ${STF_SUITE}/include/constants.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/acl.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/acl.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/acl.cfg (revision 329035) @@ -1,69 +1,70 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)acl.cfg 1.3 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib export NISSTAFILE=$TMPDIR/nis_state export TESTFILE=testfile${TESTCASE_ID} export TESTFILE0=testfile0.${TESTCASE_ID} export TESTFILE2=testfile2.${TESTCASE_ID} # Define super user 'admin' export ZFS_ACL_ADMIN=admin export ZFS_ACL_STAFF_GROUP=zfsgrp export ZFS_ACL_STAFF1=staff1 export ZFS_ACL_STAFF2=staff2 export ZFS_ACL_OTHER_GROUP=othergrp export ZFS_ACL_OTHER1=other1 export ZFS_ACL_OTHER2=other2 # Define the current user who run 'usr_exec' export ZFS_ACL_CUR_USER="" # Define global error string export ZFS_ACL_ERR_STR="" # Define test file and test directory which will be operated by chmod export testfile=$TESTDIR/testfile export testdir=$TESTDIR/testdir # Define several directories for trivial ACLs function test. export RES_DIR=$TESTDIR/RES export INI_DIR=$TESTDIR/INIT export TST_DIR=$TESTDIR/TEST export TMP_DIR=$TESTDIR/TMP # Define test files and their attributes files number for trivial # ACLs function test export NUM_FILE=5 export NUM_ATTR=10 # Enlarge STF_TIMEOUT export STF_TIMEOUT=1800 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/acl_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/acl_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/acl_common.kshlib (revision 329035) @@ -1,635 +1,636 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)acl_common.kshlib 1.4 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib # FreeBSD doesn't support ZFS extended attributes. It also doesn't support the # same ACL mechanisms Solaris does for testing. if [[ $os_name != "FreeBSD" ]]; then export ZFS_XATTR="true" export ZFS_ACL="true" else log_note "On FreeBSD most xattr and ACL tests are disabled" fi # # Get the given file/directory access mode # # $1 object -- file or directroy # function get_mode # { typeset obj=$1 if (( ${#obj} == 0 )); then return 1 fi $LS -ld $obj | $AWK '{print $1}' } # # Get the given file/directory ACL # # $1 object -- file or directroy # function get_acl # { typeset obj=$1 if (( ${#obj} == 0 )); then return 1 fi $LS -vd $obj | $NAWK '(NR != 1) {print $0}' } # # Get the given file/directory ACL # # $1 object -- file or directroy # function get_compact_acl # { typeset obj=$1 if (( ${#obj} == 0 )); then return 1 fi $LS -Vd $obj | $NAWK '(NR != 1) {print $0}' } # # Check the given two files/directories have the same ACLs # # Return 0, if source object acl is equal to target object acl. # # $1 source object # $2 target object # function compare_acls # { typeset src=$1 typeset tgt=$2 (( ${#src} == 0 || ${#tgt} == 0 )) && return 1 [[ $src == $tgt ]] && return 0 typeset tmpsrc=$TMPDIR/compare_acls.src.${TESTCASE_ID} typeset tmptgt=$TMPDIR/compare_acls.tgt.${TESTCASE_ID} get_acl $src > $tmpsrc get_acl $tgt > $tmptgt typeset -i ret=0 $DIFF $tmpsrc $tmptgt > /dev/null 2>&1 ret=$? $RM -f $tmpsrc $tmptgt if (( ret != 0 )); then return $ret fi get_compact_acl $src > $tmpsrc get_compact_acl $tgt > $tmptgt $DIFF $tmpsrc $tmptgt > /dev/null 2>&1 ret=$? $RM -f $tmpsrc $tmptgt return $ret } # # Check that the given two objects have the same modes. # Return 0, if their modes are equal with each other. Otherwise, return 1. # # $1 source object # $2 target object # function compare_modes # { typeset src=$1 typeset tgt=$2 typeset -i i=0 set -A mode (( ${#src} == 0 || ${#tgt} == 0 )) && return 1 [[ $src == $tgt ]] && return 0 typeset obj for obj in $src $tgt do mode[i]=$(get_mode $obj) (( i = i + 1 )) done [[ ${mode[0]} != ${mode[1]} ]] && return 1 return 0 } # # Check that the given two objects have the same xattrs. # Return 0, if their xattrs are equal with each other. Otherwise, return 1. # # $1 source object # $2 target object # function compare_xattrs # { typeset src=$1 typeset tgt=$2 (( ${#src} == 0 || ${#tgt} == 0 )) && return 1 [[ $src == $tgt ]] && return 0 typeset tmpsrc=$TMPDIR/compare_xattrs.src.${TESTCASE_ID} typeset tmptgt=$TMPDIR/compare_xattrs.tgt.${TESTCASE_ID} get_xattr $src > $tmpsrc get_xattr $tgt > $tmptgt typeset -i ret=0 $DIFF $tmpsrc $tmptgt > /dev/null 2>&1 ret=$? $RM -f $tmpsrc $tmptgt return $ret } # # Check '+' is set for a given file/directory with 'ls [-l]' command # # $1 object -- file or directory. # function plus_sign_check_l # { typeset obj=$1 if (( ${#obj} == 0 )); then return 1 fi $LS -ld $obj | $AWK '{print $1}' | $GREP "+\>" > /dev/null return $? } # # Check '+' is set for a given file/directory with 'ls [-v]' command # # $1 object -- file or directory. # function plus_sign_check_v # { typeset obj=$1 if (( ${#obj} == 0 )); then return 1 fi $LS -vd $obj | $NAWK '(NR == 1) {print $1}' | $GREP "+\>" > /dev/null return $? } # # A wrapper function of c program # # $1 legal login name # $2-n commands and options # function chgusr_exec # [...] { $CHG_USR_EXEC $@ return $? } # # Export the current user for the following usr_exec operating. # # $1 legal login name # function set_cur_usr # { export ZFS_ACL_CUR_USER=$1 } # # Run commands by $ZFS_ACL_CUR_USER # # $1-n commands and options # function usr_exec # [...] { $CHG_USR_EXEC "$ZFS_ACL_CUR_USER" $@ return $? } # # Count how many ACEs for the speficied file or directory. # # $1 file or directroy name # function count_ACE # { if [[ ! -e $1 ]]; then log_note "Need input file or directroy name." return 1 fi $LS -vd $1 | $NAWK 'BEGIN {count=0} (NR != 1)&&(/[0-9]:/) {count++} END {print count}' return 0 } # # Get specified number ACE content of specified file or directory. # # $1 file or directory name # $2 specified number # function get_ACE # { if [[ ! -e $1 || $2 -ge $(count_ACE $1) ]]; then return 1 fi typeset file=$1 typeset -i num=$2 typeset format=${3:-verbose} typeset -i next_num=-1 typeset tmpfile=$TMPDIR/tmp_get_ACE.${TESTCASE_ID} typeset line="" typeset args case $format in verbose) args="-vd" ;; compact) args="-Vd" ;; *) log_fail "Invalid parameter as ($format), " \ "only verbose|compact is supported." ;; esac $LS $args $file > $tmpfile (( $? != 0 )) && log_fail "FAIL: $LS $args $file > $tmpfile" while read line; do [[ -z $line ]] && continue if [[ $args == -vd ]]; then if [[ $line == "$num":* ]]; then (( next_num = num + 1 )) fi if [[ $line == "$next_num":* ]]; then break fi if (( next_num != -1 )); then print -n $line fi else if (( next_num == num )); then print -n $line fi (( next_num += 1 )) fi done < $tmpfile $RM -f $tmpfile (( $? != 0 )) && log_fail "FAIL: $RM -f $tmpfile" } # # Cleanup exist user/group. # function cleanup_user_group { del_user $ZFS_ACL_ADMIN del_user $ZFS_ACL_STAFF1 del_user $ZFS_ACL_STAFF2 del_group $ZFS_ACL_STAFF_GROUP del_user $ZFS_ACL_OTHER1 del_user $ZFS_ACL_OTHER2 del_group $ZFS_ACL_OTHER_GROUP return 0 } # # Clean up testfile and test directory # function cleanup { if [[ -d $TESTDIR ]]; then cd $TESTDIR $RM -rf $TESTDIR/* fi } # # According to specified access or acl_spec, do relevant operating by using the # specified user. # # $1 specified user # $2 node # $3 acl_spec or access # function rwx_node #user node acl_spec|access { typeset user=$1 typeset node=$2 typeset acl_spec=$3 if [[ $user == "" || $node == "" || $acl_spec == "" ]]; then log_note "node or acl_spec are not defined." return 1 fi if [[ -d $node ]]; then case $acl_spec in *:read_data:*|read_data) chgusr_exec $user $LS -l $node > /dev/null 2>&1 return $? ;; *:write_data:*|write_data) if [[ -f ${node}/tmpfile ]]; then log_must $RM -f ${node}/tmpfile fi chgusr_exec $user $TOUCH ${node}/tmpfile > \ /dev/null 2>&1 return $? ;; *"execute:"*|execute) chgusr_exec $user $FIND $node > /dev/null 2>&1 return $? ;; esac else case $acl_spec in *:read_data:*|read_data) chgusr_exec $user $CAT $node > /dev/null 2>&1 return $? ;; *:write_data:*|write_data) chgusr_exec $user $DD if=/bin/ls of=$node > \ /dev/null 2>&1 return $? ;; *"execute:"*|execute) ZFS_ACL_ERR_STR=$(chgusr_exec $user $node 2>&1) return $? ;; esac fi } # # Get the given file/directory xattr # # $1 object -- file or directroy # function get_xattr # { typeset obj=$1 typeset xattr if (( ${#obj} == 0 )); then return 1 fi for xattr in `$RUNAT $obj $LS | \ /usr/bin/egrep -v -e SUNWattr_ro -e SUNWattr_rw` ; do $RUNAT $obj $SUM $xattr done } # # Get the owner of a file/directory # function get_owner #node { typeset node=$1 typeset value if [[ -z $node ]]; then log_fail "node are not defined." fi if [[ -d $node ]]; then value=$($LS -dl $node | $AWK '{print $3}') elif [[ -e $node ]]; then value=$($LS -l $node | $AWK '{print $3}') fi $ECHO $value } # # Get the group of a file/directory # function get_group #node { typeset node=$1 typeset value if [[ -z $node ]]; then log_fail "node are not defined." fi if [[ -d $node ]]; then value=$($LS -dl $node | $AWK '{print $4}') elif [[ -e $node ]]; then value=$($LS -l $node | $AWK '{print $4}') fi $ECHO $value } # # Get the group name that a UID belongs to # function get_user_group #uid { typeset uid=$1 typeset value if [[ -z $uid ]]; then log_fail "UID not defined." fi value=$(id $uid) if [[ $? -eq 0 ]]; then value=${value##*\(} value=${value%%\)*} $ECHO $value else log_fail "Invalid UID (uid)." fi } # # Get the specified item of the specified string # # $1: Item number, count from 0. # $2-n: strings # function getitem { typeset -i n=$1 shift (( n += 1 )) eval print \${$n} } # # This function calculate the specified directory files checksum and write # to the specified array. # # $1 directory in which the files will be cksum. # $2 file array name which was used to store file cksum information. # $3 attribute array name which was used to store attribute information. # function cksum_files # { typeset dir=$1 typeset farr_name=$2 typeset aarr_name=$3 [[ ! -d $dir ]] && return typeset oldpwd=$PWD cd $dir typeset files=$($LS file*) typeset -i i=0 typeset -i n=0 while (( i < NUM_FILE )); do typeset f=$(getitem $i $files) eval $farr_name[$i]=\$\(\$CKSUM $f\) typeset -i j=0 while (( j < NUM_ATTR )); do eval $aarr_name[$n]=\$\(\$RUNAT \$f \$CKSUM \ attribute.$j\) (( j += 1 )) (( n += 1 )) done (( i += 1 )) done cd $oldpwd } # # This function compare two cksum results array. # # $1 The array name which stored the cksum before operation. # $2 The array name which stored the cksum after operation. # function compare_cksum # { typeset before=$1 typeset after=$2 eval typeset -i count=\${#$before[@]} typeset -i i=0 while (( i < count )); do eval typeset var1=\${$before[$i]} eval typeset var2=\${$after[$i]} if [[ $var1 != $var2 ]]; then return 1 fi (( i += 1 )) done return 0 } # # This function calculate all the files cksum information in current directory # and output them to the specified file. # # $1 directory from which the files will be cksum. # $2 cksum output file # function record_cksum # { typeset dir=$1 typeset outfile=$2 [[ ! -d ${outfile%/*} ]] && usr_exec $MKDIR -p ${outfile%/*} usr_exec cd $dir ; $FIND . -depth -type f -exec cksum {} \\\; | $SORT > $outfile usr_exec cd $dir ; $FIND . -depth -type f -xattr -exec runat {} \ cksum attribute* \\\; | $SORT >> $outfile } # # The function create_files creates the directories and files that the script # will operate on to test extended attribute functionality. # # $1 The base directory in which to create directories and files. # function create_files # { typeset basedir=$1 [[ ! -d $basedir ]] && usr_exec $MKDIR -m 777 $basedir [[ ! -d $RES_DIR ]] && usr_exec $MKDIR -m 777 $RES_DIR [[ ! -d $INI_DIR ]] && usr_exec $MKDIR -m 777 $INI_DIR [[ ! -d $TST_DIR ]] && usr_exec $MKDIR -m 777 $TST_DIR [[ ! -d $TMP_DIR ]] && usr_exec $MKDIR -m 777 $TMP_DIR # # Create the original file and its attribute files. # [[ ! -a $RES_DIR/file ]] && \ usr_exec $FILE_WRITE -o create -f $RES_DIR/file \ -b 1024 -d 0 -c 1 [[ ! -a $RES_DIR/attribute ]] && \ usr_exec $CP $RES_DIR/file $RES_DIR/attribute typeset oldpwd=$PWD cd $INI_DIR typeset -i i=0 while (( i < NUM_FILE )); do typeset dstfile=$INI_DIR/file.${TESTCASE_ID}.$i usr_exec $CP $RES_DIR/file $dstfile typeset -i j=0 while (( j < NUM_ATTR )); do usr_exec $RUNAT $dstfile \ $CP $RES_DIR/attribute ./attribute.$j (( j += 1 )) done (( i += 1 )) done cd $oldpwd } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/cifs/cifs.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/cifs/cifs.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/acl/cifs/cifs.kshlib (revision 329035) @@ -1,88 +1,89 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cifs.kshlib 1.4 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib function cifs_supported { if check_version "5.11" ; then fs_prop_exist "sharesmb" return $? fi return 1 } # # Create a file or direcotry # # $1: The type specified, "file" or "dir" # $2: The given node name # $3: Owner of the node # function create_object { typeset type=$1 typeset object=$2 typeset owner=$3 destroy_object $object case $type in dir) $MKDIR -p $object ;; file) $ECHO "ZFS test suites" > $object ;; esac if [[ -n $owner ]]; then $CHOWN $owner $object fi return 0 } # # Destroy the given node(s) # # $@: The node(s) need to be destroyed # function destroy_object { for object in $@ ; do if [[ -e $object ]]; then # clear_attribute is a common function name, # but each case should have their own implement. log_must clear_attribute $object log_must $RM -rf $object fi done return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/atime/atime.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/atime/atime.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/atime/atime.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)atime.cfg 1.3 08/08/15 SMI" # export TESTCLONE=testclone${TESTCASE_ID} export TESTSNAP=testsnap${TESTCASE_ID} export TESTFILE=testfile Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/atime/atime_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/atime/atime_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/atime/atime_common.kshlib (revision 329035) @@ -1,69 +1,70 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)atime_common.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # Check if the access time for specified file is updated. # # $1 Given an absolute path to a file name # # Return value: # 0 -> The access time is updated. # 1 -> The access time is not updated. # function check_atime_updated { typeset filename=$1 typeset before=$($LS -luD "%Y-%m-%d %R.%s" $filename | $AWK '{print $7}') sleep 2 log_must $CAT $filename typeset after=$($LS -luD "%Y-%m-%d %R.%s" $filename | $AWK '{print $7}') if [[ $before != $after ]]; then return 0 else return 1 fi } function setup_snap_clone { # Create two file to verify snapshot. log_must $TOUCH $TESTDIR/$TESTFILE create_snapshot $TESTPOOL/$TESTFS $TESTSNAP create_clone $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTCLONE } function cleanup { destroy_clone $TESTPOOL/$TESTCLONE destroy_snapshot $TESTPOOL/$TESTFS@$TESTSNAP } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/bootfs/bootfs.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/bootfs/bootfs.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/bootfs/bootfs.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)bootfs.cfg 1.1 07/05/25 SMI" # FS=fs export FS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg (revision 329035) @@ -1,44 +1,45 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cache.cfg 1.2 09/01/13 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib set_disks export SIZE=64M export VDIR=$TMPDIR/disk.${TESTCASE_ID} export VDIR2=$TMPDIR/disk2.${TESTCASE_ID} export VDEV="$VDIR/a $VDIR/b $VDIR/c" export LDEV="$DISK0" export VDEV2="$VDIR2/a $VDIR2/b $VDIR2/c" export LDEV2="$DISK1" export STF_TIMEOUT=1200 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.kshlib (revision 329035) @@ -1,185 +1,186 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cache.kshlib 1.4 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib function cleanup { log_note "Final pool configurations:" poolexists $TESTPOOL && log_must $ZPOOL status -v $TESTPOOL poolexists $TESTPOOL2 && log_must $ZPOOL status -v $TESTPOOL2 destroy_pool $TESTPOOL destroy_pool $TESTPOOL2 } # # Try zpool status/iostat for given pool # # $1 pool # function display_status { typeset pool=$1 typeset -i ret=0 $ZPOOL status -xv $pool > /dev/null 2>&1 ret=$? $ZPOOL iostat > /dev/null 2>&1 ((ret |= $?)) typeset mntpnt=$(get_prop mountpoint $pool) $DD if=/dev/random of=$mntpnt/testfile.${TESTCASE_ID} & typeset pid=$! $ZPOOL iostat -v 1 3 > /dev/null ((ret |= $?)) kill -9 $pid return $ret } # # Verify the give cache device have correct type and status # # $1 pool name # $2 device name # $3 device status # $4 device type # function verify_cache_device { typeset pool=$1 typeset device=$2 typeset status=$3 typeset type=$4 if [[ -z $pool || -z $device || -z $status ]]; then log_fail "Usage: verify_cache_device " \ " [type]" fi # Zpool status returns on the device name sans the /dev, so # if the device contains /dev/ remove it. if [[ $device =~ "^/dev/" ]]; then device=`basename ${device}` fi if [[ $WRAPPER == *"smi"* ]]; then $ECHO $device | $EGREP "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1 if (( $? == 0 )); then device=${device}s2 fi fi # # Get all the cache devices and status table like below # # mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE # set -A dev_stat_tab $($ZPOOL status -v $pool | $NAWK ' function parse_name(status) { if (status == "OFFLINE") return substr($7,6) else if (status == "UNAVAIL") return substr($7,6) else return $1 } BEGIN {in_cache=0} /\tcache/ {in_cache=1} /\tlog/ || /\tspares/ || /^$/ {in_cache=0} # Skip if not in a cache section (in_cache==0) { next; } /\t (\/|[0-9a-zA-Z])/ { print "stripe:" parse_name($2) " " $2; } /\t (\/|[a-zA-Z])/ { print "mirror:" parse_name($2) " " $2; } # When hotspare is replacing /\t (\/|[a-zA-Z])/ { print "mirror:" parse_name($2) " " $2; } ') typeset -i i=0 typeset find=0 while (( i < ${#dev_stat_tab[@]} )); do typeset dev=${dev_stat_tab[$i]} typeset stat=${dev_stat_tab[((i+1))]} case $dev in stripe:$device) if [[ "$type" == 'mirror' ]]; then log_note "Unexpected type: mirror" return 1 else if [[ $stat != $status ]]; then log_note "Status($stat) " \ "!= Expected stat($status)" return 1 fi return 0 fi ;; mirror:$device) if [[ -z "$type" || $type == 'stripe' ]]; then log_note "Unexpected type: stripe" return 1 else if [[ $stat != $status ]]; then log_note "Status($stat) " \ "!= Expected stat($status)" return 1 fi return 0 fi ;; esac ((i += 2)) done log_note "Can not find device: $device" return 1 } function verify_cache_support { $ZPOOL upgrade -v | $GREP "Cache devices" > /dev/null 2>&1 return $? } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cachefile/cachefile.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cachefile/cachefile.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cachefile/cachefile.cfg (revision 329035) @@ -1,35 +1,36 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cachefile.cfg 1.1 08/02/29 SMI" # if [[ $os_name == "FreeBSD" ]]; then export CPATH="/boot/zfs/zpool.cache" else export CPATH="/etc/zfs/zpool.cache" fi export CPATH1=$TMPDIR/cachefile.1.${TESTCASE_ID} export CPATH2=$TMPDIR/cachefile.2.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cachefile/cachefile.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cachefile/cachefile.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cachefile/cachefile.kshlib (revision 329035) @@ -1,50 +1,51 @@ #!/usr/local/bin/ksh93 -p +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cachefile.kshlib 1.1 08/02/29 SMI" # # # A function to determine if a given pool name has an entry in cachefile # returns 1 if the pool is not in the cache, 0 otherwise. function pool_in_cache { # checking for the pool name in the strings output of # the given cachefile, default is /etc/zfs/zpool.cache typeset cachefile=${2:-$CPATH} if [[ -f $cachefile ]]; then RESULT=$($STRINGS $cachefile | $GREP -w $1) if [ -z "$RESULT" ] then return 1 fi return 0 else return 1 fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_common.kshlib (revision 329035) @@ -1,76 +1,77 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)clean_mirror_common.kshlib 1.4 07/10/09 SMI" # # Most of the code related to the clearing of mirrors is duplicated in all # the test cases below this directory, barring a few minor changes # involving the device to be affected and the 'object' to use to mangle # the contents of the mirror. # This code is sourced into each of these test cases. function overwrite_verify_mirror { typeset AFFECTED_DEVICE=$1 typeset OVERWRITING_DEVICE=$2 typeset atfile=0 set -A cksums set -A newcksums populate_dir $TESTDIR/file $FILE_COUNT $WRITE_COUNT $BLOCKSZ 0 while (( atfile < FILE_COUNT )); do cksums[$atfile]=$($CKSUM ${TESTDIR}/file.${atfile}) (( atfile = atfile + 1 )) done # unmount and export before dd log_must $UMOUNT $TESTDIR log_must $ZPOOL export $TESTPOOL # dd the primary side of the mirror log_must $DD if=$OVERWRITING_DEVICE of=$(bsddevmap $AFFECTED_DEVICE) \ seek=8 bs=$DD_BLOCK count=$(( DD_COUNT - 8 )) conv=notrunc # now remount log_must $ZPOOL import $TESTPOOL atfile=0 typeset -i failedcount=0 while (( atfile < FILE_COUNT )); do newcksum=$($CKSUM $TESTDIR/file.${atfile}) if [[ $newcksum != ${cksums[$atfile]} ]]; then (( failedcount = failedcount + 1 )) fi $RM -f ${files[$atfile]} (( atfile = atfile + 1 )) done if (( $failedcount > 0 )); then log_fail "of the $FILE_COUNT files $failedcount did not " \ "have the same checksum before and after." fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/default.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/default.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/clean_mirror/default.cfg (revision 329035) @@ -1,54 +1,55 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)default.cfg 1.3 08/08/15 SMI" # typeset -i NUMBER_OF_DISKS=0 for i in $DISKS; do [[ -n $MIRROR_PRIMARY ]] && MIRROR_SECONDARY=$i [[ -z $MIRROR_PRIMARY ]] && MIRROR_PRIMARY=$i done if [[ -z $MIRROR_SECONDARY ]]; then # We need to repartition the single disk to two slices SINGLE_DISK=$MIRROR_PRIMARY MIRROR_SECONDARY=$MIRROR_PRIMARY SIDE_PRIMARY=${SINGLE_DISK}p1 SIDE_SECONDARY=${SINGLE_DISK}p2 else SIDE_PRIMARY=${MIRROR_PRIMARY}p1 SIDE_SECONDARY=${MIRROR_SECONDARY}p1 fi export MIRROR_PRIMARY MIRROR_SECONDARY SINGLE_DISK SIDE_PRIMARY SIDE_SECONDARY export FILE_COUNT=10 export BLOCKSZ=131072 export WRITE_COUNT=8 export FILE_SIZE=$(( BLOCKSZ * WRITE_COUNT )) export MIRROR_SIZE=70 export DD_BLOCK=$(( 64 * 1024 )) export DD_COUNT=$(( MIRROR_SIZE * 1024 * 1024 / DD_BLOCK )) Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/cli.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/cli.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/cli.cfg (revision 329035) @@ -1,52 +1,53 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cli.cfg 1.3 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib export ZFSROOT= export TESTSNAP=testsnap${TESTCASE_ID} export TESTSNAP1=testsnap1${TESTCASE_ID} export TESTSNAP2=testsnap2${TESTCASE_ID} export TESTCLONE=testclone${TESTCASE_ID} export TESTCLONE1=testclone1${TESTCASE_ID} export TESTCLONE2=testclone2${TESTCASE_ID} export TESTCLCT=testclct${TESTCASE_ID} export TESTCTR1=testctr1${TESTCASE_ID} export TESTCTR2=testctr2${TESTCASE_ID} export TESTVOL=testvol${TESTCASE_ID} export TESTVOL1=testvol1${TESTCASE_ID} export TESTVOL2=testvol2${TESTCASE_ID} export TESTFILE0=testfile0.${TESTCASE_ID} export TESTFILE1=testfile1.${TESTCASE_ID} export TESTFILE2=testfile2.${TESTCASE_ID} export LONGPNAME="poolname50charslong_012345678901234567890123456789" export LONGFSNAME="fsysname50charslong_012345678901234567890123456789" export VOLSIZE=150m export BIGVOLSIZE=1eb Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/cli_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/cli_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/cli_common.kshlib (revision 329035) @@ -1,88 +1,89 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cli_common.kshlib 1.2 07/01/09 SMI" # . $STF_SUITE/include/libtest.kshlib # # Get the checksum and size of the file. # function get_cksum # { return $($CKSUM $1 | $AWK '{print $1 $2}') } # # Compare the check sum of target files with the original file # function compare_cksum # ... { typeset orig_data=$1 typeset orig_sum=$(get_cksum $orig_data) typeset target_sum="" typeset bad_data_list="" typeset -i bad_count=0 shift for data in $@; do if [[ ! -e $data ]]; then bad_data_list="$bad_data_list $data" (( bad_count +=1 )) continue fi target_sum=$(get_cksum $data) if [[ $target_sum != $orig_sum ]]; then bad_data_list="$bad_data_list $data" (( bad_count +=1 )) fi done [[ $bad_data_list != "" ]] && \ log_fail "Data corruptions appear during send->receive." \ "There are total $bad_count corruptions. They are:\n"\ "$bad_data_list" } # # Check the received dataset exists or not # function receive_check #... { typeset bad_rst_tgts="" for dataset in $@; do ! datasetexists $dataset && \ bad_rst_tgts="$bad_rst_tgts $dataset" done if [[ $bad_rst_tgts != "" ]]; then log_fail "Restoring fails. The specified datasets"\ "$bad_rst_tgts are not being received." fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zdb.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_malformed.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_malformed.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_malformed.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_malformed.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_clone.cfg 1.3 07/07/31 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export SNAPFS="$TESTPOOL/$TESTFS@$TESTSNAP" export SNAPFS1="$TESTPOOL/$TESTVOL@$TESTSNAP" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.cfg (revision 329035) @@ -1,37 +1,38 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_copies.cfg 1.2 07/10/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export ZPOOL_VERSION_1_FILES="zfs-pool-v1.dat.Z" export ZPOOL_VERSION_1_NAME="v1-pool" export FILESIZE=10m export FILE=file.${TESTCASE_ID} export SLEEPTIME=30 export UFS_MNTPOINT=/testdir_nfs_mntpoint Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.kshlib (revision 329035) @@ -1,143 +1,144 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_copies.kshlib 1.3 08/02/27 SMI" # . $STF_SUITE/include/libtest.kshlib # # Compare the value of copies property with specified value # $1, the dataset name # $2, the expected copies value # function cmp_prop { typeset ds=$1 typeset val_expect=$2 typeset val_actual val_actual=$(get_prop copies $ds) if [[ $val_actual != $val_expect ]]; then log_fail "Expected value ($val_expect) != " \ "actual value ($val_actual)" fi } # # Get the value of property used via zfs list # $1, the dataset name # function get_used_prop { typeset ds=$1 typeset used used=`$ZFS list -H -o used $ds` used=${used%[m|M]} if [[ $used == *K ]]; then used=0 fi $ECHO $used } # # Check the used space is charged correctly # $1, the number of used space # $2, the expected common factor between the used space and the file space # function check_used { typeset charged_spc=$1 typeset -i used typeset -i expected_cfactor=$2 typeset -i cfactor typeset -i fsize=${FILESIZE%[m|M]} (( used = ${charged_spc%[m|M]} )) (( cfactor = used / fsize )) if (( cfactor != expected_cfactor )); then log_fail "The space is not charged correctly while setting"\ "copies as $expected_cfactor." fi } # # test ncopies on volume # $1 test type zfs|ufs, default zfs # $2 copies # $3 mntp for ufs test function do_vol_test { typeset type=$1 typeset copy=$2 typeset mntp=$3 vol=$TESTPOOL/$TESTVOL1 vol_b_path=/dev/zvol/$TESTPOOL/$TESTVOL1 vol_r_path=/dev/zvol/$TESTPOOL/$TESTVOL1 log_must $ZFS create -V $VOLSIZE -o copies=$copy $vol if fs_prop_exist "refreserv" ; then log_must $ZFS set refreservation=none $vol fi if [[ $type == "ufs" ]]; then log_must $ECHO y | $NEWFS $vol_r_path >/dev/null 2>&1 log_must $MOUNT -F ufs -o rw $vol_b_path $mntp else log_must $ZPOOL create $TESTPOOL1 $vol_b_path log_must $ZFS create $TESTPOOL1/$TESTFS1 fi (( nfilesize = copy * ${FILESIZE%m} )) pre_used=$(get_used_prop $vol) (( target_size = pre_used + nfilesize )) if [[ $type == "ufs" ]]; then log_must $MKFILE $FILESIZE $mntp/$FILE else log_must $MKFILE $FILESIZE /$TESTPOOL1/$TESTFS1/$FILE fi post_used=$(get_used_prop $vol) while (( post_used < target_size )) ; do sleep 1 post_used=$(get_used_prop $vol) done (( used = post_used - pre_used )) if (( used < nfilesize )); then log_fail "The space is not charged correctly while setting"\ "copies as $copy" fi if [[ $type == "ufs" ]]; then $UMOUNT $mntp else log_must $ZPOOL destroy $TESTPOOL1 fi log_must $ZFS destroy $vol } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/properties.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/properties.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/properties.kshlib (revision 329035) @@ -1,80 +1,81 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)properties.kshlib 1.6 09/01/13 SMI" # . $STF_SUITE/include/libtest.kshlib set -A RW_FS_PROP "quota=512M" \ "reservation=512M" \ "recordsize=64K" \ "mountpoint=/tmp/mnt${TESTCASE_ID}" \ "checksum=fletcher2" \ "compression=lzjb" \ "atime=off" \ "devices=off" \ "exec=off" \ "setuid=off" \ "readonly=on" \ "snapdir=visible" \ "aclmode=discard" \ "aclinherit=discard" \ "canmount=off" \ "local:department=123" is_global_zone && \ set -A RW_FS_PROP ${RW_FS_PROP[*]} "sharenfs=on" set -A RW_VOL_PROP "volblocksize=16K" \ "checksum=fletcher2" \ "compression=lzjb" \ "readonly=on" \ "local:department=123" set -A RW_VOL_CLONE_PROP "checksum=fletcher2" \ "compression=lzjb" \ "readonly=on" \ "local:department=123" set -A FS_ONLY_PROP "quota=512M" \ "recordsize=64K" \ "mountpoint=/tmp/mnt${TESTCASE_ID}" \ "sharenfs=on" \ "atime=off" \ "devices=off" \ "exec=off" \ "setuid=off" \ "snapdir=visible" \ "aclmode=discard" \ "aclinherit=discard" \ "canmount=off" $ZFS upgrade -v > /dev/null 2>&1 if [[ $? -eq 0 ]]; then set -A FS_ONLY_PROP ${FS_ONLY_PROP[*]} "version=1" fi set -A VOL_ONLY_PROP "volblocksize=16K" "volsize=512M" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create.cfg (revision 329035) @@ -1,53 +1,54 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_create.cfg 1.3 07/10/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export BYND_MAX_NAME="byondmaxnamelength\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789" # There're 3 different prompt messages while create # a volume that great than 1TB on 32-bit # - volume size exceeds limit for this system. (happy gate) # - max volume size is 1TB on 32-bit systems (s10u2) # - value is too large (old) export VOL_LIMIT_KEYWORD1="1TB on 32-bit" export VOL_LIMIT_KEYWORD2="value is too large" export VOL_LIMIT_KEYWORD3="volume size exceeds limit" set -A size "8k" "8K" "1m" "1M" "1mb" "1mB" "1Mb" "1MB" "1g" "1G" \ "1p" "1P" "1z" "1Z" "1gb" "1gB" "1Gb" "1GB" "1pb" "1pB" "1Pb" \ "1PB" "1zb" "1zB" "1Zb" "1ZB" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_common.kshlib (revision 329035) @@ -1,53 +1,54 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # #!/bin/ksh -p # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_create_common.kshlib 1.3 07/07/31 SMI" # . $STF_SUITE/include/libtest.kshlib # # Check if the user property is identical to the expected value. # # $1 dataset # $2 property string # function propertycheck { typeset dtst=$1 typeset propstr=$2 typeset prop=$($ECHO $propstr | $AWK -F= '{print $1}') typeset expect_value=$($ECHO $propstr | $AWK -F= '{print $2}') typeset value=$($ZFS get -H -o value $prop $dtst) if [[ "$expect_value" == "$value" ]]; then return 0 else return 1 fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy.cfg (revision 329035) @@ -1,41 +1,42 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_destroy.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export TESTFSCLONE=${TESTFS}clone export TESTVOLCLONE=${TESTVOL}clone export CTR=$TESTPOOL/$TESTCTR export FS=$CTR/$TESTFS export VOL=$CTR/$TESTVOL export FSSNAP=$FS@$TESTSNAP export VOLSNAP=$VOL@$TESTSNAP export FSCLONE=$TESTPOOL/$TESTFSCLONE export VOLCLONE=$TESTPOOL/$TESTVOLCLONE export STF_TIMEOUT=3600 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_common.kshlib (revision 329035) @@ -1,170 +1,171 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_destroy_common.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # Create or recover a set of test environment which include ctr, vol, fs, # snap & clone. It looks like the following. # # pool # |ctr # | |fs # | | |fssnap # | |vol # | |volsnap # |fsclone # |volclone # # $1 indicate which dependent dataset need be created. Such as 'snap', 'clone'. # function setup_testenv #[dtst] { typeset dtst=$1 if ! datasetexists $CTR; then log_must $ZFS create $CTR fi if ! datasetexists $FS; then log_must $ZFS create $FS fi # Volume test is only availible on globle zone if ! datasetexists $VOL && is_global_zone; then log_must $ZFS create -V $VOLSIZE $VOL log_must $NEWFS /dev/zvol/$VOL if [[ ! -d $TESTDIR1 ]]; then log_must $MKDIR $TESTDIR1 fi log_must $MOUNT /dev/zvol/$VOL $TESTDIR1 fi if [[ $dtst == snap || $dtst == clone ]]; then if ! datasetexists $FSSNAP; then log_must $ZFS snapshot $FSSNAP fi if ! datasetexists $VOLSNAP && is_global_zone; then log_must $ZFS snapshot $VOLSNAP fi fi if [[ $dtst == clone ]]; then if ! datasetexists $FSCLONE; then log_must $ZFS clone $FSSNAP $FSCLONE fi if ! datasetexists $VOLCLONE && is_global_zone; then log_must $ZFS clone $VOLSNAP $VOLCLONE fi fi } function make_dir_busy { typeset dir=$1 typeset dirfiltered=$(echo $dir | sed -Ee 's,[/\.],_,g') OLDPWD=$(pwd) cd $dir # Sleep for long enough for the test to have run through. Note that # even if the test itself changes directory, sleep will still be on it. $SLEEP $STF_TIMEOUT & eval SLEEP_PID_${dirfiltered}=$! pid=$(eval echo \$SLEEP_PID_${dirfiltered}) cd ${OLDPWD} log_note "Sleeping while on ${dir} in pid $pid" } function make_dir_unbusy { typeset dir=$1 typeset dirfiltered=$(echo $dir | sed -Ee 's,[/\.],_,g') typeset pid=$(eval echo \$SLEEP_PID_${dirfiltered}) # Safeguard in case this is used incorrectly. [[ -z "$pid" ]] && log_fail "make_dir_unbusy called without busy?" $KILL -15 $pid eval SLEEP_PID_${dirfiltered}="" log_note "Unbusied ${dir}" } # Clean up the testing environment # function cleanup_testenv { if [[ $STF_EXITCODE -eq $STF_FAIL ]]; then $ECHO "Testcase failed; dataset listing follows:" $ZFS list -t all -r $TESTPOOL fi if (( ${#init_dir} != 0 )); then cd $init_dir init_dir="" fi if is_global_zone && ismounted "$TESTDIR1" "ufs" ; then log_must $UMOUNT -f $TESTDIR1 fi if [[ -d $TESTDIR1 ]]; then log_must $RM -rf $TESTDIR1 fi [[ -n "$SLEEP_PID" ]] && $KILL -15 $SLEEP_PID if datasetexists $CTR; then log_must $ZFS destroy -Rf $CTR fi } # # Delete volume and related datasets from list, if the test cases was # runing in local zone. Then check them are existed or non-exists. # # $1 function name # $2-n datasets name # function check_dataset { typeset funname=$1 typeset newlist="" typeset dtst shift for dtst in "$@"; do # Volume and related stuff are unvailable in local zone if ! is_global_zone; then if [[ $dtst == $VOL || $dtst == $VOLSNAP || \ $dtst == $VOLCLONE ]] then continue fi fi newlist="$newlist $dtst" done if (( ${#newlist} != 0 )); then log_must eval "$funname $newlist" fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg (revision 329035) @@ -1,27 +1,28 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2017 Spectra Logic. All rights reserved. # Use is subject to license terms. # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get.cfg (revision 329035) @@ -1,31 +1,32 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_get.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export TESTSNAP=testsnap${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_common.kshlib (revision 329035) @@ -1,99 +1,100 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_get_common.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # According to $elements, $prefix and $separator, the function random produce # the number of $counter combination. # # $1 elements which is used to get the combination. # $2 prefix is appended to the combination # $3 separator between the combination, such as ' ' or ',' # $4 counter is the number of combination which you want to get. # function gen_option_str # $elements $prefix $separator $counter { typeset elements="" typeset prefix=${2} typeset separator=${3} typeset -i counter=${4:-0} typeset -i i=0 typeset comb_str="" for e in $1; do elements[i]="$e" (( i += 1 )) done (( ${#elements[@]} == 0 )) && log_fail "The elements can't be empty." typeset -i item=0 typeset -i j=0 typeset -i numb_item=0 # Loop and get the specified number combination strings. i=0 while (( i < counter )); do j=0 numb_item=0 comb_str="" # Get random number items for each combinations. (( numb_item = ($RANDOM % ${#elements[@]}) + 1 )) while (( j < numb_item )); do # Random select elements from the array (( item = $RANDOM % ${#elements[@]} )) if (( ${#comb_str} == 0 )); then comb_str=${elements[item]} else comb_str=$comb_str$separator${elements[item]} fi (( j += 1 )) done print "$prefix$comb_str" (( i += 1 )) done } # # Cleanup the volume snapshot and filesystem snapshot were created for # this test case. # function cleanup { datasetexists $TESTPOOL/$TESTVOL@$TESTSNAP && \ destroy_snapshot $TESTPOOL/$TESTVOL@$TESTSNAP datasetexists $TESTPOOL/$TESTFS@$TESTSNAP && \ destroy_snapshot $TESTPOOL/$TESTFS@$TESTSNAP [[ -e $TESTFILE0 ]] && log_must $RM $TESTFILE0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_list_d.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_list_d.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_list_d.kshlib (revision 329035) @@ -1,91 +1,92 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_get_list_d.kshlib 1.1 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib DEPTH_FS=$TESTPOOL/depth_fs MAX_DEPTH=3 DS_COUNT=3 set -A depth_options "d 0" "d 1" "d 2" "d 4" "d 32" set -A depth_array 0 1 2 4 32 # # 'zfs get -d or zfs list -d' is supported # function zfs_get_list_d_supported { check_opt_support "get" "-d" return $? } # # Setup multiple depths datasets, including fs, volume and snapshot. # function depth_fs_setup { typeset -i i j k typeset fslist log_must $ZFS create $DEPTH_FS (( i=1 )) while (( i<=MAX_DEPTH )); do if (( i==1 )); then fslist=$DEPTH_FS else (( k=i-1 )) fslist=$($ZFS list -rH -t filesystem -o name $DEPTH_FS|$GREP d"$k"$) if (( $? != 0 )); then zfs list -rH -t filesystem -o name $DEPTH_FS log_fail "No d$k filesystem" fi fi for fs in $fslist; do (( j=1 )) while (( j<=DS_COUNT )); do log_must $ZFS create $fs/fs_"$j"_d"$i" if is_global_zone ; then log_must $ZFS create -V 8M $fs/v_"$j"_d"$i" fi log_must $ZFS snapshot $fs@s_"$j"_d"$i" (( j=j+1 )) done done (( i=i+1 )) done } # # Cleanup multiple depths filesystem. # function depth_fs_cleanup { log_must $ZFS destroy -rR $DEPTH_FS } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit.cfg (revision 329035) @@ -1,27 +1,28 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2013 Spectra Logic. All rights reserved. # Use is subject to license terms. # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.cfg (revision 329035) @@ -1,39 +1,40 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_mount.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export mountcmd=mount export mountforce="$mountcmd -f" export mountall="$mountcmd -a" export unmountcmd=unmount export unmountforce="$unmountcmd -f" export unmountall="$unmountcmd -a" export NONEXISTFSNAME="nonexistfs50charslong_0123456789012345678901234567" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.kshlib (revision 329035) @@ -1,132 +1,133 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_mount.kshlib 1.3 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib function force_unmount #dev { typeset dev=$1 ismounted $dev if (( $? == 0 )); then log_must $ZFS $unmountforce $dev fi return 0 } # Create pool and ( fs | container | vol ) with the given parameters, # it'll destroy prior exist one that has the same name. function setup_filesystem #disklist #pool #fs #mntpoint #type #vdev { typeset disklist=$1 typeset pool=$2 typeset fs=${3##/} typeset mntpoint=$4 typeset type=$5 typeset vdev=$6 if [[ -z $pool || -z $fs || -z $mntpoint ]]; then log_note "Missing parameter: (\"$pool\", \"$fs\", \"$mntpoint\")" return 1 fi if is_global_zone && [[ -z $disklist ]] ; then log_note "Missing disklist." return 1 fi if [[ $vdev != "" && \ $vdev != "mirror" && \ $vdev != "raidz" ]] ; then log_note "Wrong vdev: (\"$vdev\")" return 1 fi poolexists $pool || \ create_pool $pool $vdev $disklist datasetexists $pool/$fs && \ log_must cleanup_filesystem $pool $fs $RMDIR $mntpoint > /dev/null 2>&1 if [[ ! -d $mntpoint ]]; then log_must $MKDIR -p $mntpoint fi case "$type" in 'ctr') log_must $ZFS create $pool/$fs log_must $ZFS set mountpoint=$mntpoint $pool/$fs ;; 'vol') log_must $ZFS create -V $VOLSIZE $pool/$fs ;; *) log_must $ZFS create $pool/$fs log_must $ZFS set mountpoint=$mntpoint $pool/$fs ;; esac return 0 } # Destroy ( fs | container | vol ) with the given parameters. function cleanup_filesystem #pool #fs { typeset pool=$1 typeset fs=${2##/} typeset mtpt="" if [[ -z $pool || -z $fs ]]; then log_note "Missing parameter: (\"$pool\", \"$fs\")" return 1 fi if datasetexists "$pool/$fs" ; then mtpt=$(get_prop mountpoint "$pool/$fs") log_must $ZFS destroy -r $pool/$fs [[ -d $mtpt ]] && \ log_must $RM -rf $mtpt else return 1 fi return 0 } # Make sure 'zfs mount' should display all ZFS filesystems currently mounted. # The results of 'zfs mount' and 'df -F zfs' should be identical. function verify_mount_display { typeset fs for fs in $($ZFS $mountcmd | $AWK '{print $1}') ; do log_must mounted $fs done return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote.cfg (revision 329035) @@ -1,43 +1,44 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_promote.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export FILESIZE=1m export TESTSNAP3=testsnap3.${TESTCASE_ID} export TESTSNAP4=testsnap4.${TESTCASE_ID} export TESTSNAP5=testsnap5.${TESTCASE_ID} export TESTFILE3=testfile3.${TESTCASE_ID} export CLONEFILE=clonefile.${TESTCASE_ID} export CLONEFILE1=clonefile1.${TESTCASE_ID} export CLONEFILE2=clonefile2.${TESTCASE_ID} export CLONEFILE3=clonefile3.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_common.kshlib (revision 329035) @@ -1,45 +1,46 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_promote_common.kshlib 1.3 07/03/14 SMI" # # # Check whether the operating filesystem support 'zfs promote' or not # function unsupport_check { typeset srch_str="unrecognized command" typeset tmpout=$TMPDIR/tmpout.${TESTCASE_ID} typeset -i ret $ZFS promote >$tmpout 2>&1 $GREP "$srch_str" $tmpout >/dev/null 2>&1 ret=$? $RM -f $tmpout return $ret } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/zfs_property.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/zfs_property.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/zfs_property.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_property.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_receive.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export PARTSIZE=1g export BLOCK_SIZE=512 export WRITE_COUNT=8 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.cfg (revision 329035) @@ -1,38 +1,39 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_rename.cfg 1.1 07/07/31 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export DATAFS=datafs${TESTCASE_ID} export DATA=$TESTDIR2/data.${TESTCASE_ID} export IF=/dev/urandom export OF=$DATA export BS=512 export CNT=2048 export VOL_R_PATH=/dev/zvol/$TESTPOOL/$TESTVOL export VOLDATA=$TESTDIR2/voldata.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.kshlib (revision 329035) @@ -1,114 +1,115 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_rename.kshlib 1.5 07/10/09 SMI" # function additional_setup { # Create testfile log_must $CP $DATA $TESTDIR/$TESTFILE0 log_must $CP $DATA $TESTDIR1/$TESTFILE0 # Create snapshot if ! snapexists $TESTPOOL/$TESTFS@snapshot; then log_must $ZFS snapshot $TESTPOOL/$TESTFS@snapshot log_must $ZFS clone $TESTPOOL/$TESTFS@snapshot \ $TESTPOOL/$TESTFS-clone fi # Create file system datasetexists $TESTPOOL/$TESTFS1 || \ log_must $ZFS create $TESTPOOL/$TESTFS1 # Create testfile log_must $CP $DATA $(get_prop mountpoint $TESTPOOL/$TESTFS1)/$TESTFILE0 # Create container datasetexists $TESTPOOL/$TESTCTR1 || \ log_must $ZFS create $TESTPOOL/$TESTCTR1 log_must $CP $DATA $(get_prop mountpoint $TESTPOOL/$TESTCTR1)/$TESTFILE0 # Create data in zvol if is_global_zone; then log_must eval "$DD if=$DATA of=$VOL_R_PATH bs=$BS count=$CNT \ >/dev/null 2>&1" else log_must $CP $DATA $(get_prop mountpoint $TESTPOOL/$TESTVOL)/$TESTFILE0 fi } function rename_dataset # src dest { typeset src=$1 typeset dest=$2 log_must $ZFS rename $src $dest # # Verify src name no longer in use # log_mustnot datasetexists $src log_must datasetexists $dest } function cleanup { typeset -i i=0 while ((i < ${#dataset[*]} )); do if ! datasetexists ${dataset[i]}-new ; then ((i = i + 1)) continue fi if [[ ${dataset[i]}-new != *@* ]] ; then $ZFS rename ${dataset[i]}-new ${dataset[i]} if [[ $? -ne 0 ]]; then typeset newfs=${dataset[i]}-new typeset oldfs=${dataset[i]} typeset mntp=$(get_prop mountpoint $newfs) log_must $ZFS destroy -f $newfs log_must $ZFS create -p $oldfs log_must $ZFS set mountpoint=$mntp $oldfs fi else log_must $ZFS destroy -fR ${dataset[i]}-new fi ((i = i + 1)) done } function cmp_data #<$1 src data, $2 tgt data> { typeset src=$1 typeset tgt=$2 $CMP $src $tgt >/dev/null 2>&1 return $? } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_reservation.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback.cfg (revision 329035) @@ -1,50 +1,51 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_rollback.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cli_root/cli.cfg export FS=$TESTPOOL/$TESTFS export VOL=$TESTPOOL/$TESTVOL export FSSNAP0=$FS@$TESTSNAP export FSSNAP1=$FS@$TESTSNAP1 export FSSNAP2=$FS@$TESTSNAP2 export VOLSNAP0=$VOL@$TESTSNAP export VOLSNAP1=$VOL@$TESTSNAP1 export VOLSNAP2=$VOL@$TESTSNAP2 export FSCLONE0=$FS$TESTCLONE export FSCLONE1=$FS$TESTCLONE1 export FSCLONE2=$FS$TESTCLONE2 export VOLCLONE0=$VOL$TESTCLONE export VOLCLONE1=$VOL$TESTCLONE1 export VOLCLONE2=$VOL$TESTCLONE2 export STF_TIMEOUT=1800 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_common.kshlib (revision 329035) @@ -1,302 +1,303 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_rollback_common.kshlib 1.6 08/05/14 SMI" # . $STF_SUITE/include/libtest.kshlib # Get file sum # # $1 full file name function getsum #fname { (( ${#1} == 0 )) && \ log_fail "Need give file name." return $($SUM $1 | $AWK '{print $1}') } # Define global variable checksum, get the original file sum. # origsum=$(getsum /etc/passwd) # # Setup or recover the test environment. Firstly, copy /etc/passwd to ZFS file # system or volume, then make a snapshot or clone. Repeat up to three times. # # $1 number of snapshot. Note: Currently only support three snapshots. # $2 indicate if it is necessary to create clone # function setup_snap_env { typeset -i cnt=${1:-3} typeset createclone=${2:-"false"} if datasetnonexists $FS; then log_must $ZFS create $FS log_must $ZFS set mountpoint=$TESTDIR $FS fi # Volume can't be created in Local Zone. if datasetnonexists $VOL && is_global_zone; then log_must $ZFS create -V $VOLSIZE $VOL fi # Make sure $VOL is volume typeset type=$(get_prop type $VOL) if datasetexists $VOL && \ [[ $type == 'volume' ]]; then # # At the first time, Make a UFS file system in volume and # mount it. Otherwise, only check if this ufs file system # was mounted. # log_must eval "$ECHO "y" | \ $NEWFS /dev/zvol/$VOL > /dev/null 2>&1" [[ ! -d $TESTDIR1 ]] && log_must $MKDIR $TESTDIR1 # Make sure the ufs filesystem hasn't been mounted, # then mount the new ufs filesystem. $MOUNT | grep -q "/dev/zvol/$VOL" > /dev/null 2>&1 if (( $? != 0 )); then log_must $MOUNT \ /dev/zvol/$TESTPOOL/$TESTVOL $TESTDIR1 fi fi # Separately Create three snapshots for file system & volume typeset -i ind=0 typeset dtst for dtst in $FS $VOL; do # Volume can be created in Local Zone. if [[ $dtst == $VOL ]]; then if ! is_global_zone; then break fi fi ind=0 while (( ind < cnt )); do case $dtst in $FS) eval typeset snap=\$FSSNAP$ind eval typeset clone=\$FSCLONE$ind eval typeset fname=\$TESTDIR/\$TESTFILE$ind ;; $VOL) eval typeset snap=\$VOLSNAP$ind eval typeset clone=\$VOLCLONE$ind eval typeset fname=\$TESTDIR1/\$TESTFILE$ind ;; esac if datasetnonexists $snap; then log_must $CP /etc/passwd $fname # # Take the snapshot with the zvol unmounted so # that its filesystem's state will be # consistent. # mount -u -o ro /dev/zvol/$TESTPOOL/$TESTVOL log_must $ZFS snapshot $snap mount -u -o rw /dev/zvol/$TESTPOOL/$TESTVOL fi if [[ $createclone == "true" ]]; then if datasetnonexists $clone; then log_must $ZFS clone $snap $clone fi fi (( ind += 1 )) done done } function setup_clone_env { setup_snap_env $1 "true" } # # Clean up the test environmnet # # $1 number of snapshot Note: Currently only support three snapshots. # function cleanup_env { typeset -i cnt=${1:-3} typeset -i ind=0 typeset dtst typeset snap $PKILL ${DD##*/} $MOUNT | grep -q "/dev/zvol/$VOL" > /dev/null 2>&1 if (( $? == 0 )); then log_must $UMOUNT -f $TESTDIR1 fi [[ -d $TESTDIR ]] && log_must $RM -rf $TESTDIR/* [[ -d $TESTDIR1 ]] && log_must $RM -rf $TESTDIR1/* for dtst in $FS $VOL; do for snap in $TESTSNAP $TESTSNAP1 $TESTSNAP2; do if snapexists $dtst@$snap; then log_must $ZFS destroy -Rf $dtst@$snap fi done done # Restore original test environment if datasetnonexists $FS ; then log_must $ZFS create $FS fi if datasetnonexists $VOL ; then if is_global_zone ; then log_must $ZFS create -V $VOLSIZE $VOL else log_must $ZFS create $VOL fi fi } # # check if the specified files have specified status. # # $1 expected status # $2-n full file name # If it is true return 0, else return 1 # function file_status { (( $# == 0 )) && \ log_fail "The file name is not defined." typeset opt case $1 in exist) opt="-e" ;; nonexist) opt="! -e" ;; *) log_fail "Unsupported file status." ;; esac shift while (( $# > 0 )); do eval [[ $opt $1 ]] || return 1 shift done return 0 } function files_exist { file_status "exist" $@ } function files_nonexist { file_status "nonexist" $@ } # # According to snapshot check if the file system was recovered to the right # point. # # $1 snapshot. fs@snap or vol@snap # function check_files { typeset dtst=$1 if [[ $(get_prop type $dtst) != snapshot ]]; then log_fail "Parameter must be a snapshot." fi typeset fsvol=${dtst%%@*} typeset snap=${dtst##*@} if [[ $(get_prop type $fsvol) == "filesystem" ]]; then ind="" else ind="1" fi eval typeset file0=\$TESTDIR$ind/\$TESTFILE0 eval typeset file1=\$TESTDIR$ind/\$TESTFILE1 eval typeset file2=\$TESTDIR$ind/\$TESTFILE2 case $snap in $TESTSNAP2) log_must files_exist $file0 $file1 $file2 typeset sum0=$(getsum $file0) typeset sum1=$(getsum $file1) typeset sum2=$(getsum $file2) if [[ $sum0 != $origsum || \ $sum1 != $origsum || sum2 != $origsum ]] then log_fail "After rollback, file sum is changed." fi ;; $TESTSNAP1) log_must files_exist $file0 $file1 log_must files_nonexist $file2 typeset sum0=$(getsum $file0) typeset sum1=$(getsum $file1) if [[ $sum0 != $origsum || $sum1 != $origsum ]] then log_fail "After rollback, file sum is changed." fi ;; $TESTSNAP) log_must files_exist $file0 log_must files_nonexist $file1 $file2 typeset sum0=$(getsum $file0) if [[ $sum0 != $origsum ]]; then log_fail "After rollback, file sum is changed." fi ;; esac } # According to dataset type, write file to different directories. # # $1 dataset # function write_mountpoint_dir { typeset dtst=$1 typeset dir if [[ $dtst == $FS ]]; then dir=$TESTDIR log_must ismounted $dir else dir=$TESTDIR1 log_must ismounted $dir "ufs" fi $DD if=/dev/urandom of=$dir/$TESTFILE1 & log_must $SLEEP 3 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_send.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export PARTSIZE=1g export BLOCK_SIZE=512 export WRITE_COUNT=8 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_set.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export TESTDIR_NOTEXISTING=${TEST_BASE_DIR%%/}/testdir_notexisting${TESTCASE_ID} export STF_TIMEOUT=1200 #ro_prop_001_pos need more time Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib (revision 329035) @@ -1,250 +1,251 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_set_common.kshlib 1.7 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib set -A VALID_NAME_CHAR a b c d e f g h i j k l m n o p q r s t u v w x y z \ 0 1 2 3 4 5 6 7 8 9 ':' '-' '.' '_' set -A INVALID_NAME_CHAR A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ '`' '~' '!' '@' '#' '$' '%' '^' '&' '(' ')' '+' '=' \ '|' '{' '[' ']' '}' ';' '"' '<' ',' '>' '?' '/' \ ' ' set -A ALL_CHAR ${VALID_NAME_CHAR[*]} ${INVALID_NAME_CHAR[*]} # # Firstly, set the property value to dataset. Then checking if the property # value is equal with the expected value, according to the expected result. # # $1 property value # $2 property name # $3 dataset # $4 expected result # function set_n_check_prop { typeset expect_value=$1 typeset prop=$2 typeset dataset=$3 typeset expect_result=${4:-true} typeset old_value="" typeset cur_value="" [ -n "$prop" ] && old_value=$(get_prop $prop $dataset) if [ "$expect_result" = "true" ]; then log_must $ZFS set $prop=$expect_value $dataset else log_mustnot $ZFS set $prop=$expect_value $dataset fi [ -n "$prop" ] && cur_value=$(get_prop $prop $dataset) err="ERROR: Dataset '$dataset': '$prop' value '$cur_value'" if [ "$expect_result" = "true" ]; then [ "$expect_value" = "gzip-6" ] && expect_value="gzip" case "$prop" in reservation|reserv|quota) if [ "$expect_value" = "none" -a "$cur_value" != "0" ]; then err="$err should not be set!" log_fail "$err" return fi ;; esac if [ "$cur_value" != "$expect_value" ]; then err="$err should have changed to '$expect_value'!" log_fail "$err" fi else if [ "$expect_value" != "" -a "$cur_value" != "$old_value" ]; then err="$err should be unchanged at '$old_value'!" log_fail "$err" fi fi } # # Cleanup all the user properties of the pool and the dataset reside it. # # $1 pool name # function cleanup_user_prop { typeset pool=$1 typeset dtst=$($ZFS list -H -r -o name -t filesystem,volume $pool) typeset user_prop for dt in $dtst; do user_prop=$($ZFS get -H -o property all $dtst | grep ":") typeset prop for prop in $user_prop; do $ZFS inherit $prop $dt (($? != 0)) && log_must $ZFS inherit $prop $dt done done } # # Random select charactor from the specified charactor set and combine into a # random string # # $1 character set name # $2 String length # function random_string { typeset char_set=${1:-VALID_NAME_CHAR} typeset -i len=${2:-5} eval typeset -i count=\${#$char_set[@]} typeset str typeset -i i=0 while ((i < len)); do typeset -i ind ((ind = RANDOM % count)) eval str=\${str}\${$char_set[\$ind]} ((i += 1)) done $ECHO "$str" } # # Get vaild user defined property name # # $1 user defined property name length # function valid_user_property { typeset -i sumlen=${1:-10} ((sumlen < 2 )) && sumlen=2 typeset -i len ((len = RANDOM % sumlen)) typeset part1 part2 while true; do part1="$(random_string VALID_NAME_CHAR $len)" if [[ "$part1" == "-"* ]]; then continue fi break done ((len = sumlen - (len + 1))) while true; do part2="$(random_string VALID_NAME_CHAR $len)" if [[ -z $part1 && -z $part2 ]]; then continue fi break done $ECHO "${part1}:${part2}" } # # Get invaild user defined property name # # $1 user defined property name length # function invalid_user_property { typeset -i sumlen=${1:-10} ((sumlen == 0)) && sumlen=1 typeset -i len ((len = RANDOM % sumlen)) typeset part1 part2 while true; do part1="$(random_string VALID_NAME_CHAR $len)" ((len = sumlen - len)) part2="$(random_string INVALID_NAME_CHAR $len)" # Avoid $part1 is *:* and $part2 is "=*" if [[ "$part1" == *":"* && "$part2" == "="* ]]; then continue fi break done $ECHO "${part1}${part2}" } # # Get user property value # # $1 user defined property name length # function user_property_value { typeset -i len=${1:-100} ((len < 1 )) && len=1 typeset value=$(random_string ALL_CHAR $len) $ECHO "$value" } # # Check if the user property is identical to the expected value. # # $1 dataset # $2 user property # $3 expected value # function check_user_prop { typeset dtst=$1 typeset user_prop="$2" typeset expect_value="$3" typeset value=$($ZFS get -p -H -o value "$user_prop" $dtst 2>&1) if [[ "$expect_value" == "$value" ]]; then return 0 else return 1 fi } # # Get source of the dataset # function get_source { typeset prop=$1 typeset dataset=$2 typeset source source=$($ZFS get -H -o source $prop $dataset) if (($? != 0)); then log_fail "Unable to get $prop source for dataset $dataset" fi $ECHO "$source" } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_share.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export SNAPROOT="$(get_snapdir_name)" export NONEXISTFSNAME="nonexistfs50charslong_0123456789012345678901234567" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot.cfg (revision 329035) @@ -1,34 +1,35 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_snapshot.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cli_root/cli.cfg export SNAPFS="$TESTPOOL/$TESTFS@$TESTSNAP" export SNAPFS1="$TESTPOOL/$TESTVOL@$TESTSNAP" export SNAPDIR="$TESTDIR@$TESTSNAP" export SNAPDIR1="$ZFSROOT/$SNAPFS1" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.cfg (revision 329035) @@ -1,39 +1,40 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_unmount.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export mountcmd=mount export mountforce="$mountcmd -f" export mountall="$mountcmd -a" export unmountcmd=unmount export unmountforce="$unmountcmd -f" export unmountall="$unmountcmd -a" export NONEXISTFSNAME="nonexistfs50charslong_0123456789012345678901234567" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.kshlib (revision 329035) @@ -1,73 +1,74 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_unmount.kshlib 1.2 07/01/09 SMI" # function do_unmount #cmd #opt #mnt #expect { typeset cmd=$1 typeset opt=$2 typeset mnt=$3 typeset -i expect=${4-0} typeset -i ret typeset -i wasmounted=1 mounted $mnt || wasmounted=0 if (( expect == 0 )) ; then log_must $ZFS $cmd $opt $mnt log_must unmounted $mnt log_note "Successfully $ZFS $cmd $opt $mnt" else log_note "$ZFS $cmd $opt $mnt" $ZFS $cmd $opt $mnt ret=$? if (( ret != expect)); then log_fail "'$ZFS $cmd $opt $mnt' " \ "unexpected return code of $ret." fi if (( wasmounted == 1 )) ; then log_must mounted $mnt else log_must unmounted $mnt fi log_note "Mount status of $mnt not changed." fi } function cleanup { [[ -n $cwd ]] && cd $cwd log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS mounted $TESTPOOL/$TESTFS || \ log_must $ZFS $mountcmd $TESTPOOL/$TESTFS } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_unshare.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export NONEXISTFSNAME="nonexistfs50charslong_0123456789012345678901234567" export NONEXISTMOUNTPOINT="/nonexistmountpoint_0123456789" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Copyright 2013 Spectra Logic. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_upgrade.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.kshlib (revision 329035) @@ -1,193 +1,194 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_upgrade.kshlib 1.3 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib # # For zfs create. # When pool version is 15, fs whose version is 4 can be created. # set -A zpl_create_versions 3 4 5 set -A spa_create_versions 9 15 24 # # For zfs upgrade # set -A zpl_upgrade_versions 3 4 5 set -A spa_upgrade_versions 9 15 24 function get_pool_version #pool { typeset pool=$1 typeset vs=$(get_pool_prop version $pool) if [ "$vs" = "-" ]; then echo 5000 else echo "$vs" fi } function default_setup_datasets #rootfs { typeset rootfs=$1 typeset pool=${rootfs%%/*} typeset -i vp=$(get_pool_version $pool) typeset -i version typeset -i m typeset -i spa_version typeset -i zpl_version for version in $ZFS_ALL_VERSIONS ; do typeset verfs eval verfs=\$ZFS_VERSION_$version typeset current_fs=$rootfs/$verfs typeset current_snap=${current_fs}@snap typeset current_clone=$rootfs/clone$verfs (( m=0 )) (( spa_version=0 )) while (( m < ${#zpl_create_versions[@]} )); do (( zpl_version=${zpl_create_versions[m]} )) if (( version == zpl_version )); then (( spa_version=${spa_create_versions[m]} )) break fi (( m+=1 )) done if (( spa_version != 0 )) && (( vp < spa_version )); then log_mustnot $ZFS create -o version=${version} ${current_fs} continue fi log_must $ZFS create -o version=${version} ${current_fs} log_must $ZFS snapshot ${current_snap} log_must $ZFS clone ${current_snap} ${current_clone} for subversion in $ZFS_ALL_VERSIONS ; do typeset subverfs eval subverfs=\$ZFS_VERSION_$subversion (( m=0 )) (( spa_version=0 )) while (( m < ${#zpl_create_versions[@]} )); do (( zpl_version=${zpl_create_versions[m]} )) if (( subversion == zpl_version )); then (( spa_version=${spa_create_versions[m]} )) break fi (( m+=1 )) done if (( spa_version != 0 )) && (( vp < spa_version )); then log_mustnot $ZFS create -o \ version=${subversion} ${current_fs}/$subverfs else log_must $ZFS create -o \ version=${subversion} ${current_fs}/$subverfs fi done done } function default_cleanup_datasets #rootfs { typeset rootfs=$1 if datasetexists $rootfs ; then log_must $ZFS destroy -Rf $rootfs fi if datasetnonexists $rootfs ; then log_must $ZFS create $rootfs fi } function default_check_zfs_upgrade #rootfs { typeset rootfs=$1 typeset pool=${rootfs%%/*} typeset -i vp="$(get_pool_version $pool)" typeset -i m typeset -i spa_version typeset -i zpl_version typeset newv typeset -i df_ret $DF -F zfs / > /dev/null 2>&1 df_ret=$? for newv in "" $ZFS_VERSION; do default_setup_datasets $rootfs if [[ -n $newv ]]; then opt="-V $newv" else newv=$ZFS_VERSION fi (( m=0 )) (( spa_version=0 )) while (( m < ${#zpl_upgrade_versions[@]} )); do (( zpl_version=${zpl_upgrade_versions[m]} )) if (( newv == zpl_version )); then (( spa_version=${spa_upgrade_versions[m]} )) break fi (( m+=1 )) done if (( df_ret != 0 )); then if (( spa_version != 0 )) && (( vp < spa_version )); then log_mustnot eval '$ZFS upgrade $opt -a > /dev/null 2>&1' log_must eval '$ZPOOL upgrade $pool > /dev/null 2>&1' vp="$(get_pool_version $pool)" fi log_must eval '$ZFS upgrade $opt -a > /dev/null 2>&1' for fs in $($ZFS list -rH -t filesystem -o name $rootfs) ; do log_must check_fs_version $fs $newv done fi default_cleanup_datasets $rootfs done } function check_fs_version #filesystem version { typeset fs=$1 typeset -i version=${2:-$ZFS_VERSION} if [[ -z $fs ]]; then log_fail "No filesystem specified." fi typeset -i curv=$(get_prop version $fs) if (( curv != version )); then return 1 fi return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg (revision 329035) @@ -1,66 +1,67 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_add.cfg 1.3 08/08/15 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib export DISK_ARRAY_NUM=0 export DISK_ARRAY_LIMIT=4 export DISKSARRAY="" # # Variables for zpool_add_006 # export STF_TIMEOUT=2400 export VDEVS_NUM=300 export FILE_SIZE=100 #100mb set_disks export FILESIZE="100m" export FILESIZE1="150m" export SIZE="150m" export SIZE1="250m" export FILEDISK=filedisk${TESTCASE_ID} export FILEDISK0=filedisk0${TESTCASE_ID} export FILEDISK1=filedisk1${TESTCASE_ID} export FILEDISK2=filedisk2${TESTCASE_ID} export FILEDISK3=filedisk3${TESTCASE_ID} export VOLSIZE=64mb export BYND_MAX_NAME="byondmaxnamelength\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.kshlib (revision 329035) @@ -1,151 +1,152 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_add.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # check if the contains ... # # $1 pool # $2..n ... # # Return 0 if are contained in the ; 1 if not used; 2 if pool # name is missing # function iscontained { typeset pool=$1 typeset vdev if [[ -z $pool ]]; then log_note "Missing pool name." return 2 fi shift for vdev in $@; do # remove /dev/dsk in vdev if there is $ECHO $vdev | $GREP "^/dev/" >/dev/null 2>&1 (( $? == 0 )) && \ vdev=${vdev##*/} $ZPOOL status "$pool" | $AWK '$1 == vdevname {exit 1}' \ vdevname=$vdev >/dev/null 2>&1 (( $? != 1 )) && \ return 1 done return 0; } # # Find the storage device in /etc/fstab # function find_vfstab_dev { typeset vfstab="/etc/fstab" typeset tmpfile="$TMPDIR/fstab.tmp" typeset vfstabdev typeset vfstabdevs="" typeset line $CAT $vfstab | $GREP "^/dev/" >$tmpfile while read -r line do vfstabdev=`$ECHO "$line" | $AWK '{print $1}'` vfstabdev=${vfstabdev%%:} vfstabdevs="$vfstabdev $vfstabdevs" done <$tmpfile $RM -f $tmpfile $ECHO $vfstabdevs } # # Find the storage device in /etc/mnttab # function find_mnttab_dev { typeset mnttab="/etc/mnttab" typeset tmpfile="$TMPDIR/mnttab.tmp" typeset mnttabdev typeset mnttabdevs="" typeset line $MOUNT | $GREP "^/dev/" >$tmpfile while read -r line do mnttabdev=`$ECHO "$line" | $AWK '{print $1}'` mnttabdev=${mnttabdev%%:} mnttabdevs="$mnttabdev $mnttabdevs" done <$tmpfile $RM -f $tmpfile $ECHO $mnttabdevs } # # Save the systme current dump device configuration # function save_dump_dev { typeset dumpdev typeset swapdev typeset swapdevs="" typeset tmpfile="$TMPDIR/swapinfo.tmp" dumpdev=`readlink /dev/dumpdev` swapinfo | $GREP "^/dev/" >$tmpfile while read -r line do swapdev=`$ECHO "$line" | $AWK '{print $1}'` swapdev=${swapdev%%:} swapdevs="$swapdev $swapdevs" done <$tmpfile $ECHO "$dumpdev $swapdevs" } # # Common cleanup routine for partitions used in testing # function partition_cleanup { log_note "Cleaning up partitions..." if [[ -n $DISK ]]; then partition_disk $SIZE $DISK 7 else typeset disk="" for disk in $DISK0 $DISK1; do partition_disk $SIZE $disk 7 done fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/zpool_attach.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/zpool_attach.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/zpool_attach.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_attach.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear.cfg (revision 329035) @@ -1,34 +1,35 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_clear.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export FILESIZE=100m export STF_TIMEOUT=2100 export BLOCKSZ=$(( 1024 * 1024 )) export NUM_WRITES=40 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg (revision 329035) @@ -1,74 +1,75 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_create.cfg 1.5 08/08/15 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib export DISK_ARRAY_NUM=0 export DISK_ARRAY_LIMIT=4 export DISKSARRAY="" # # Variables for zpool_create_005 # export STF_TIMEOUT=2400 export VDEVS_NUM=300 export FILE_SIZE=100 #100mb export MD_OVERHEAD=10 # 10% export POOL_MINSIZE=64 # the minimum size(64m) to create a storage pool set_disks export FILESIZE="100m" export FILESIZE1="150m" export SIZE="200m" export SIZE1="250m" export FILEDISK=filedisk${TESTCASE_ID} export FILEDISK0=filedisk0${TESTCASE_ID} export FILEDISK1=filedisk1${TESTCASE_ID} export FILEDISK2=filedisk2${TESTCASE_ID} export FILEDISK3=filedisk3${TESTCASE_ID} export BYND_MAX_NAME="byondmaxnamelength\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789\ 012345678901234567890123456789" export TOOSMALL="toosmall" export TESTPOOL4=testpool4.${TESTCASE_ID} export TESTPOOL5=testpool5.${TESTCASE_ID} export TESTPOOL6=testpool6.${TESTCASE_ID} export CPATH="$TMPDIR/cachefile.${TESTCASE_ID}" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib (revision 329035) @@ -1,128 +1,129 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_create.kshlib 1.4 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib # # Given a pool vdevs list, create the pool,verify the created pool, # and destroy the pool # $1, pool name # $2, pool type, mirror, raidz, or none # $3, vdevs list # function create_pool_test { typeset pool=$1 typeset keywd=$2 typeset vdevs eval set -A diskarray $3 for vdevs in "${diskarray[@]}";do create_pool $pool $keywd $vdevs log_must poolexists $pool destroy_pool $pool done } # # Create a ufs file system and make a vdev file on it # # $1, disk name to create ufs file system # $2, file name # function create_blockfile { typeset disk=$1 typeset file=$2 typeset dir=`$DIRNAME $file` if [[ -d $dir ]]; then ismounted $dir ufs && log_must $UMOUNT -f $dir else log_must $MKDIR -p $dir fi log_must $NEWFS $disk log_must $MOUNT $disk $dir log_must create_vdevs $file } # # Umount the ufs filesystem and remove the mountpoint # $1, the mount point # function clean_blockfile { typeset dirs=$1 for dir in $dirs; do if [[ -d $dir ]]; then if ismounted $dir ufs; then log_must $UMOUNT -f $dir fi log_must $RM -rf $dir fi done } # # Find the storage device in /etc/vfstab # function find_vfstab_dev { typeset vfstab="/etc/vfstab" typeset tmpfile="$TMPDIR/vfstab.tmp" typeset vfstabdev typeset vfstabdevs="" typeset line $CAT $vfstab | $GREP "^/dev" >$tmpfile while read -r line do vfstabdev=`$ECHO "$line" | $AWK '{print $1}'` vfstabdev=${vfstabdev%%:} vfstabdevs="$vfstabdev $vfstabdevs" done <$tmpfile $RM -f $tmpfile $ECHO $vfstabdevs } # # Save the systme current dump device configuration # function save_dump_dev { typeset dumpdev typeset fnd="Dump device" dumpdev=`$DUMPADM | $GREP "$fnd" | $CUT -f2 -d : | \ $AWK '{print $1}'` $ECHO $dumpdev } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_destroy.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export DISK=${DISKS%% *} export PART_SIZE=500m Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/zpool_detach.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/zpool_detach.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/zpool_detach.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_detach.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand.cfg (revision 329035) @@ -1,44 +1,45 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_expand.cfg 1.1 09/06/22 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg org_size=1g exp_size=2g export org_size export exp_size VFS=$TESTPOOL/$TESTFS export VFS EX_1GB=1073741824 EX_3GB=3221225472 export EX_1GB export EX_3GB Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_export.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg (revision 329035) @@ -1,68 +1,69 @@ #!/bin/ksh -p +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_get.cfg 1.6 09/06/22 SMI" # # Set the expected properties of zpool typeset -a properties=( "size" "capacity" "altroot" "health" "guid" "version" "bootfs" "delegation" "autoreplace" "cachefile" "failmode" "listsnapshots" "autoexpand" "dedupditto" "dedupratio" "free" "allocated" "readonly" "comment" "expandsize" "freeing" "fragmentation" "leaked" "feature@async_destroy" "feature@empty_bpobj" "feature@lz4_compress" "feature@multi_vdev_crash_dump" "feature@spacemap_histogram" "feature@enabled_txg" "feature@hole_birth" "feature@extensible_dataset" "feature@embedded_data" "feature@bookmarks" "feature@filesystem_limits" "feature@large_blocks" "feature@sha512" "feature@skein" # "feature@edonr" Edonr is not yet implemented on FreeBSD ) Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history.cfg (revision 329035) @@ -1,27 +1,28 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2013 Spectra Logic. All rights reserved. # Use is subject to license terms. # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg (revision 329035) @@ -1,132 +1,133 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_import.cfg 1.6 08/11/03 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib set -A disk_array $(find_disks $DISKS) case "${#disk_array[*]}" in 0) # # on stf_configure, disk_freelist returns empty. # DISK_COUNT=0 ;; 1) # We need to repartition the single disk to two slices. DISK_COUNT=1 ZFS_DISK1=${disk_array[0]} ZFSSIDE_DISK1=${ZFS_DISK1}p1 ZFS_DISK2=${disk_array[0]} ZFSSIDE_DISK2=${ZFS_DISK2}p2 ;; *) # We don't need to repartition anything DISK_COUNT=2 ZFS_DISK1=${disk_array[0]} ZFSSIDE_DISK1=${ZFS_DISK1} ZFS_DISK2=${disk_array[1]} ZFSSIDE_DISK2=${ZFS_DISK2} ;; esac export DISK_COUNT ZFS_DISK1 ZFSSIDE_DISK1 ZFS_DISK2 ZFSSIDE_DISK2 export FS_SIZE=2gb export FILE_SIZE=64m export PART_SIZE=128m export MAX_NUM=5 export GROUP_NUM=3 export DEVICE_DIR=${TMPDIR}/dev${TESTCASE_ID} export BACKUP_DEVICE_DIR=/bakdev${TESTCASE_ID} export DEVICE_FILE=disk export DEVICE_ARCHIVE=${TMPDIR}/archive${TESTCASE_ID}.tar # MYTESTFILE can be any file that exists and we have r access to export MYTESTFILE=$STF_SUITE/include/default.cfg # NB: It's easier just to repeat the expansion patterns than to reuse. for (( num=0 ; $num < $GROUP_NUM ; num += 1 )); do eval export VDEV\${num}F="${DEVICE_FILE}${num}" eval export VDEV\${num}="${DEVICE_DIR}/${DEVICE_FILE}${num}" DEVICE_FILES="$DEVICE_FILES ${DEVICE_DIR}/${DEVICE_FILE}${num}" done export DEVICE_FILES for (( num = GROUP_NUM ; $num < $MAX_NUM ; num += 1 )); do eval export VDEV\${num}F="${DEVICE_FILE}${num}" eval export VDEV\${num}="${DEVICE_DIR}/${DEVICE_FILE}${num}" done export ALTER_ROOT=/alter${TESTCASE_ID} export STF_TIMEOUT=2400 export ZPOOL_VERSION=$(get_zpool_version) # Version 1 pools export ZPOOL_VERSION_1_FILES="zfs-pool-v1.dat" export ZPOOL_VERSION_1_NAME="v1-pool" # Version 2 pools export ZPOOL_VERSION_2_FILES="zfs-pool-v2.dat" export ZPOOL_VERSION_2_NAME="v2-pool" # This is a v3 pool export ZPOOL_VERSION_3_FILES="zfs-pool-v3.dat" export ZPOOL_VERSION_3_NAME="v3-pool" # This is a v6 pool export ZPOOL_VERSION_6_FILES="zfs-pool-v6.dat" export ZPOOL_VERSION_6_NAME="v6-pool" # This is a v7 pool export ZPOOL_VERSION_7_FILES="zfs-pool-v7.dat" export ZPOOL_VERSION_7_NAME="v7-pool" # This is a v8 pool export ZPOOL_VERSION_8_FILES="zfs-pool-v8.dat" export ZPOOL_VERSION_8_NAME="v8-pool" # This statement builds up a list of configurations we should be able to # upgrade, for each pool version. Once we've built this variable, we'll # call the functions above for each value. case $ZPOOL_VERSION in 6) CONFIGS="6" ;; 7) CONFIGS="6 7" ;; 8) CONFIGS="6 7 8" ;; *) # we should be able to upgrade pools of version 1, 2 & 3 # but we should also log a note about the unknown pool version CONFIGS="6 7 8" ;; esac export CONFIGS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.kshlib (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # Common routines used by zpool_import*. function setup_missing_test_pool # { typeset tvd_type=$1 setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1 \ "" $tvd_type log_must $CP $MYTESTFILE $TESTDIR1/$TESTFILE0 log_must $ZPOOL export $TESTPOOL1 } function recreate_missing_files { destroy_pool $TESTPOOL1 log_must $RM -rf $DEVICE_DIR/* for (( devnum=0 ; $devnum < $MAX_NUM ; devnum += 1 )); do log_must create_vdevs ${DEVICE_DIR}/${DEVICE_FILE}$devnum done } function cleanup_missing { log_note "State of pools at the end of the test:" poolexists $TESTPOOL1 && log_must $ZPOOL status $TESTPOOL1 log_note "State of $DEVICE_DIR at the end of the test:" log_cmd $ZPOOL import -d $DEVICE_DIR destroy_pool $TESTPOOL1 log_must $RM -rf $DEVICE_DIR/* [[ -d $ALTER_ROOT ]] && log_must $RM -rf $ALTER_ROOT [[ -d $BACKUP_DEVICE_DIR ]] && log_must $RM -rf $BACKUP_DEVICE_DIR } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_offline.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_online.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_remove.cfg 1.1 07/07/31 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export DISK=${DISKS%% *} export SIZE="200m" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_replace.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub.cfg (revision 329035) @@ -1,31 +1,32 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_scrub.cfg 1.3 07/10/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg export DISK1=$($ECHO $DISKS | $AWK '{print $1}') export DISK2=$($ECHO $DISKS | $AWK '{print $2}') Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_status.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.cfg (revision 329035) @@ -1,290 +1,291 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_upgrade.cfg 1.7 09/06/22 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib export STF_TIMEOUT=1800 # We need to determine which version of ZFS we're running on, so as to # work out which types of pool we should be able to upgrade on this # system. export ZPOOL_VERSION=$(get_zpool_version) # The following variable names describe files, stored as gzip compressed files # in the test directory which can be used to construct a pool of a given # version. The variable names are important, in that the construction # ZPOOL_VERSION_$var_FILES describes the files the pool is made from, and # ZPOOL_VERSION_$var_NAME describes the pool name. # Version 1 pools export ZPOOL_VERSION_1_FILES="zfs-pool-v1.dat" export ZPOOL_VERSION_1_NAME="v1-pool" # v1 stripe export ZPOOL_VERSION_1stripe_FILES="zfs-pool-v1stripe1.dat \ zfs-pool-v1stripe2.dat zfs-pool-v1stripe3.dat" export ZPOOL_VERSION_1stripe_NAME="pool-v1stripe" # v1 raidz export ZPOOL_VERSION_1raidz_FILES="zfs-pool-v1raidz1.dat zfs-pool-v1raidz2.dat \ zfs-pool-v1raidz3.dat" export ZPOOL_VERSION_1raidz_NAME="pool-v1raidz" # v1 mirror export ZPOOL_VERSION_1mirror_FILES="zfs-pool-v1mirror1.dat \ zfs-pool-v1mirror2.dat zfs-pool-v1mirror3.dat" export ZPOOL_VERSION_1mirror_NAME="pool-v1mirror" # Version 2 pools export ZPOOL_VERSION_2_FILES="zfs-pool-v2.dat" export ZPOOL_VERSION_2_NAME="v2-pool" # v2 stripe export ZPOOL_VERSION_2stripe_FILES="zfs-pool-v2stripe1.dat \ zfs-pool-v2stripe2.dat zfs-pool-v2stripe3.dat" export ZPOOL_VERSION_2stripe_NAME="pool-v2stripe" # v2 raidz export ZPOOL_VERSION_2raidz_FILES="zfs-pool-v2raidz1.dat zfs-pool-v2raidz2.dat \ zfs-pool-v2raidz3.dat" export ZPOOL_VERSION_2raidz_NAME="pool-v2raidz" # v2 mirror export ZPOOL_VERSION_2mirror_FILES="zfs-pool-v2mirror1.dat \ zfs-pool-v2mirror2.dat zfs-pool-v2mirror3.dat" export ZPOOL_VERSION_2mirror_NAME="pool-v2mirror" # This is a v3 pool export ZPOOL_VERSION_3_FILES="zfs-pool-v3.dat" export ZPOOL_VERSION_3_NAME="v3-pool" # v3 stripe export ZPOOL_VERSION_3stripe_FILES="zfs-pool-v3stripe1.dat \ zfs-pool-v3stripe2.dat zfs-pool-v3stripe3.dat" export ZPOOL_VERSION_3stripe_NAME="pool-v3stripe" # v3 raidz export ZPOOL_VERSION_3raidz_FILES="zfs-pool-v3raidz1.dat zfs-pool-v3raidz2.dat \ zfs-pool-v3raidz3.dat" export ZPOOL_VERSION_3raidz_NAME="pool-v3raidz" # v3 mirror export ZPOOL_VERSION_3mirror_FILES="zfs-pool-v3mirror1.dat \ zfs-pool-v3mirror2.dat zfs-pool-v3mirror3.dat" export ZPOOL_VERSION_3mirror_NAME="pool-v3mirror" # v3 raidz2 export ZPOOL_VERSION_3dblraidz_FILES="zfs-pool-v3raidz21.dat \ zfs-pool-v3raidz22.dat zfs-pool-v3raidz23.dat" export ZPOOL_VERSION_3dblraidz_NAME="pool-v3raidz2" # v3 hotspares export ZPOOL_VERSION_3hotspare_FILES="zfs-pool-v3hotspare1.dat \ zfs-pool-v3hotspare2.dat zfs-pool-v3hotspare3.dat" export ZPOOL_VERSION_3hotspare_NAME="pool-v3hotspare" # v4 pool export ZPOOL_VERSION_4_FILES="zfs-pool-v4.dat" export ZPOOL_VERSION_4_NAME="v4-pool" # v5 pool export ZPOOL_VERSION_5_FILES="zfs-pool-v5.dat" export ZPOOL_VERSION_5_NAME="v5-pool" # v6 pool export ZPOOL_VERSION_6_FILES="zfs-pool-v6.dat" export ZPOOL_VERSION_6_NAME="v6-pool" # v7 pool export ZPOOL_VERSION_7_FILES="zfs-pool-v7.dat" export ZPOOL_VERSION_7_NAME="v7-pool" # v8 pool export ZPOOL_VERSION_8_FILES="zfs-pool-v8.dat" export ZPOOL_VERSION_8_NAME="v8-pool" # v9 pool export ZPOOL_VERSION_9_FILES="zfs-pool-v9.dat" export ZPOOL_VERSION_9_NAME="v9-pool" # v10 pool export ZPOOL_VERSION_10_FILES="zfs-pool-v10.dat" export ZPOOL_VERSION_10_NAME="v10-pool" # v11 pool export ZPOOL_VERSION_11_FILES="zfs-pool-v11.dat" export ZPOOL_VERSION_11_NAME="v11-pool" # v12 pool export ZPOOL_VERSION_12_FILES="zfs-pool-v12.dat" export ZPOOL_VERSION_12_NAME="v12-pool" # v13 pool export ZPOOL_VERSION_13_FILES="zfs-pool-v13.dat" export ZPOOL_VERSION_13_NAME="v13-pool" # v14 pool export ZPOOL_VERSION_14_FILES="zfs-pool-v14.dat" export ZPOOL_VERSION_14_NAME="v14-pool" # v15 pool export ZPOOL_VERSION_15_FILES="zfs-pool-v15.dat" export ZPOOL_VERSION_15_NAME="v15-pool" # v28 pool export ZPOOL_VERSION_28_FILES="zfs-pool-v28.dat" export ZPOOL_VERSION_28_NAME="v28-pool" # v5000 pool export ZPOOL_VERSION_5000_FILES="zfs-pool-v5000.dat" export ZPOOL_VERSION_5000_NAME="v5000-pool" # This pool is a v2 pool, with device problems on one side of the mirror # so that the pool appears as DEGRADED export ZPOOL_VERSION_2brokenmirror_FILES="zfs-broken-mirror1.dat \ zfs-broken-mirror2.dat" export ZPOOL_VERSION_2brokenmirror_NAME="zfs-broken-mirror" # This pool is a v999 pool (an unknown version) which can be used to check # whether upgrade, import or other tests that should fail against unknown # pool versions should fail. It should not be listed in the CONFIGS # variable below, as these are pool versions that can be imported and upgraded export ZPOOL_VERSION_9999_FILES="zfs-pool-v999.dat" export ZPOOL_VERSION_9999_NAME="v999-pool" # This statement builds up a list of configurations we should be able to # upgrade, for each pool version. Once we've built this variable, we'll # call the functions above for each value. case $ZPOOL_VERSION in 1) # we should be able to upgrade pools of version 1 CONFIGS="1 1stripe 1raidz 1mirror" ;; 2) # we should be able to upgrade pools of version 1 & 2 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror" ;; 3) # we should be able to upgrade pools of version 1, 2 & 3 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare" ;; 4) # we should be able to upgrade pools of version 1, 2, 3 & 4 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4" ;; 5) # we should be able to upgrade pools up to version 5 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5" ;; 6) # we should be able to upgrade pools up to version 6 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6" ;; 7) # we should be able to upgrade pools up to version 7 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7" ;; 8) # we should be able to upgrade pools up to version 8 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8" ;; 9) # we should be able to upgrade pools up to version 9 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9" ;; 10) # we should be able to upgrade pools up to version 10 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10" ;; 11) # we should be able to upgrade pools up to version 11 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11" ;; 12) # we should be able to upgrade pools up to version 12 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12" ;; 13) # we should be able to upgrade pools up to version 13 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13" ;; 14) # we should be able to upgrade pools up to version 14 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14" ;; 15) # we should be able to upgrade pools up to version 15 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15" ;; 28) # we should be able to upgrade pools up to version 15 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15 28" ;; 5000) # we should be able to upgrade pools up to version 15 CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15 28 5000" ;; *) # we should be able to upgrade pools up to version 15 # but we should also log a note about the unknown pool version CONFIGS="1 1stripe 1raidz 1mirror \ 2 2stripe 2raidz 2mirror 2brokenmirror \ 3 3stripe 3raidz 3mirror 3dblraidz 3hotspare 4 5 6 7 8 9 10 11 12 13 14 15" log_note "Unknown ZFS version $ZPOOL_VERSION encountered:\ Test suite may need updating." ;; esac export CONFIGS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.kshlib (revision 329035) @@ -1,159 +1,160 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_upgrade.kshlib 1.5 08/02/27 SMI" # . $STF_SUITE/include/libtest.kshlib # This part of the test suite relies on variables being setup in the # zpool_upgrade.cfg script. Those variables give us details about which # files make up the pool, and what the pool name is. # A function to import a pool from files we have stored in the test suite # We import the pool, and create some random data in the pool. # $1 a version number we can use to get information about the pool function create_old_pool { VERSION=$1 POOL_FILES=$($ENV | grep "ZPOOL_VERSION_${VERSION}_FILES"\ | $AWK -F= '{print $2}') POOL_NAME=$($ENV|grep "ZPOOL_VERSION_${VERSION}_NAME"\ | $AWK -F= '{print $2}') log_note "Creating $POOL_NAME from $POOL_FILES" for pool_file in $POOL_FILES; do $CP -f $STF_SUITE/tests/cli_root/zpool_upgrade/blockfiles/$pool_file.Z \ $TMPDIR $UNCOMPRESS $TMPDIR/$pool_file.Z done log_must $ZPOOL import -d $TMPDIR $POOL_NAME # Now put some random contents into the pool. COUNT=0 while [ "$COUNT" -lt 1024 ]; do $DD if=/dev/urandom of=/$POOL_NAME/random.$COUNT \ count=1 bs=1024 > /dev/null 2>&1 COUNT=$(( $COUNT + 1 )) done } # A function to check the contents of a pool, upgrade it to the current version # and then verify that the data is consistent after upgrading. Note that we're # not using "zpool status -x" to see if the pool is healthy, as it's possible # to also upgrade faulted, or degraded pools. # $1 a version number we can use to get information about the pool function check_upgrade { VERSION=$1 POOL_NAME=$($ENV| $GREP "ZPOOL_VERSION_${VERSION}_NAME"\ | $AWK -F= '{print $2}') POOL_FILES=$($ENV | $GREP "ZPOOL_VERSION_${VERSION}_FILES"\ | $AWK -F= '{print $2}') log_note "Checking if we can upgrade from ZFS version ${VERSION}." PRE_UPGRADE_CHECKSUM=$(check_pool $POOL_NAME pre ) log_must $ZPOOL upgrade $POOL_NAME > /dev/null POST_UPGRADE_CHECKSUM=$(check_pool $POOL_NAME post ) log_note "Checking that there are no differences between checksum output" log_must $DIFF $PRE_UPGRADE_CHECKSUM $POST_UPGRADE_CHECKSUM $RM $PRE_UPGRADE_CHECKSUM $POST_UPGRADE_CHECKSUM } # A function to destroy an upgraded pool, plus the files it was based on. # $1 a version number we can use to get information about the pool function destroy_upgraded_pool { VERSION=$1 POOL_NAME=$($ENV|grep "ZPOOL_VERSION_${VERSION}_NAME"\ | $AWK -F= '{print $2}') POOL_FILES=$($ENV | grep "ZPOOL_VERSION_${VERSION}_FILES"\ | $AWK -F= '{print $2}') if poolexists "$POOL_NAME"; then log_must $ZPOOL destroy $POOL_NAME fi for file in $POOL_FILES; do if [ -e "$TMPDIR/$file" ]; then $RM $TMPDIR/$file fi done } # This function does a basic sanity check on the pool by computing the # checksums of all files in the pool, printing the name of the file containing # the checksum results. # $1 the name of the pool # $2 a flag we can use to determine when this check is being performed # (ie. pre or post pool-upgrade) function check_pool { # pool state POOL=$1 STATE=$2 $FIND /$POOL -type f -exec $CKSUM {} + > \ $TMPDIR/pool-checksums.$POOL.$STATE print $TMPDIR/pool-checksums.$POOL.$STATE } # This function simply checks that a pool has a particular version number # as reported by zdb and zpool upgrade -v # $1 the name of the pool # $2 the version of the pool we expect to see function check_poolversion { # pool version POOL=$1 VERSION=$2 # check version using zdb ACTUAL=$(get_config $POOL version) [ "$ACTUAL" != "$VERSION" ] && log_fail \ "ERROR: $POOL not upgraded: wanted '$VERSION', got '$ACTUAL'" # check version using zpool upgrade ACTUAL=$($ZPOOL upgrade | $GREP $POOL$ | \ $AWK '{print $1}' | $SED -e 's/ //g') [ "$ACTUAL" != "$VERSION" ] && log_fail "$POOL reported version '$ACTUAL', expected '$VERSION'" } # A simple function to get a random number between two bounds # probably not the most efficient for large ranges, but it's okay. # Note since we're using $RANDOM, 32767 is the largest number we # can accept as the upper bound. # $1 lower bound # $2 upper bound function random { # min max typeset MIN=$1 typeset MAX=$2 typeset RAND=0 while [ "$RAND" -lt "$MIN" ] do RAND=$(( $RANDOM % $MAX + 1)) done print $RAND } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/cli.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/cli.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/cli.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cli.cfg 1.3 08/08/15 SMI" # export TESTSNAP=testsnap${TESTCASE_ID} export TESTCLCT=testclct${TESTCASE_ID} export TESTFILE0=testfile0.${TESTCASE_ID} export TESTFILE1=testfile1.${TESTCASE_ID} export UNPRIVILEGED_USER=`atf_config_get unprivileged_user` Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/cli_user.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/cli_user.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/cli_user.kshlib (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2017 Spectra Logic Corp. All rights reserved. # Use is subject to license terms. . $STF_SUITE/include/libtest.kshlib # Executes $@ without root privileges function run_unprivileged { echo "$@" | su -m "$UNPRIVILEGED_USER" } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/misc/misc.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/misc/misc.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/misc/misc.cfg (revision 329035) @@ -1,69 +1,70 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)misc.cfg 1.1 07/10/09 SMI" # . $STF_SUITE/tests/cli_user/cli.cfg # these are the set of setable ZFS properties PROP_NAMES="\ aclinherit aclmode atime \ checksum compression devices \ exec mountpoint quota readonly \ recordsize reservation setuid shareiscsi \ sharenfs snapdir " # these are a set of values we apply, for use when testing the # zfs get/set subcommands - ordered as per the list above so we # can iterate over both sets in an array PROP_VALS="\ secure discard on \ fletcher2 on on \ on legacy none on \ 128k none on on \ on visible " # these are an alternate set of property values PROP_ALTVALS="\ noallow groupmask off \ fletcher4 lzjb off \ off $TMPDIR/zfstest 100m off \ 512 10m off off \ off hidden " # additional properties to worry about: canmount copies xattr zoned version POOL_PROPS="\ bootfs autoreplace" POOL_VALS="\ $TESTPOOL/$TESTFS on" POOL_ALTVALS="\ $TESTPOOL/$TESTFS/$TESTFS2 off" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.cfg (revision 329035) @@ -1,37 +1,38 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_list.cfg 1.3 07/06/05 SMI" # . $STF_SUITE/tests/cli_user/cli.cfg # Datasets (in order of creation date) and which checksum options # we want to set for each dataset. # These are used by various zfs list tests export DATASETS="Apple Banana Carrot Orange apple banana carrot" export CKSUMOPTS="on sha256 sha256 sha256 fletcher4 off fletcher2" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.kshlib (revision 329035) @@ -1,116 +1,117 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zfs_list.kshlib 1.1 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib # # A function that verifies sort order. It takes as input # a command, which gets executed. We then iterate over the results # comparing that the sort order passed in via the list # function verify_sort { # command list name # now verify we've sorted by creation date: typeset CMD=$1 typeset list=$2 typeset name=$3 typeset -i RET=0 typeset -i index=1 # run the command to verify that it works log_must eval "$CMD > /dev/null" # Now check the sort order for dataset in $( $CMD ) do ACTUAL=$(basename $dataset) if [ "$dataset" != "$TESTPOOL/$TESTFS" ] then EXPECTED=$($ECHO $list | $AWK "{print \$$index}") if [ "$ACTUAL" != "$EXPECTED" ] then log_note "WARNING:" \ "'$ACTUAL' does not equal '$EXPECTED'" log_fail "ERROR: Sort by $name fails." fi ((index = index + 1)) fi done # finally check to see if we have the expected number of elements if [ $index -ne $($ECHO $list | $AWK '{print split($0,arr)+1}') ] then log_fail "Warning: " \ "unexpected number of filesystems found in list output!" fi } # A function that verifies reverse sort order. It takes as input # a command, which gets executed. We then iterate over the results # comparing that the sort order passed in via the list # function verify_reverse_sort { # command list name typeset CMD=$1 typeset list=$2 typeset name=$3 # set our index to the be number of elements in the list typeset -i index=$($ECHO $list | $AWK '{print split($0,arr)}') log_note "Checking reverse sort by '$name'," \ "expecting the reverse of '$list'" log_must eval "$CMD > /dev/null" for dataset in $( $CMD ) do ACTUAL=$(basename $dataset) if [ "$dataset" != "$TESTPOOL/$TESTFS" ] then EXPECTED=$($ECHO $list | $AWK "{print \$$index}") if [ "$ACTUAL" != "$EXPECTED" ] then log_note "Warning:" \ "'$ACTUAL' does not equal to" \ "the reverse of '$EXPECTED'" log_fail "ERROR: Reverse sort by '$name' fails." fi ((index = index - 1)) fi done # finally check to see if we have the expected number of elements if [ $index -ne 0 ] then log_fail "Warning: " \ "unexpected number of filesystems found in list output!" fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_iostat.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_user/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zpool_list.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/cli_user/cli.cfg Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/compression/compress.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/compression/compress.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/compression/compress.cfg (revision 329035) @@ -1,36 +1,37 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)compress.cfg 1.4 08/08/15 SMI" # export TESTFILE0=testfile0.${TESTCASE_ID} export TESTFILE1=testfile1.${TESTCASE_ID} export BLOCKSZ=8192 export NUM_WRITES=65536 export DATA=13 export STF_TIMEOUT=1200 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/ctime/ctime.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/ctime/ctime.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/ctime/ctime.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)ctime.cfg 1.2 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/delegate/delegate.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/delegate/delegate.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/delegate/delegate.cfg (revision 329035) @@ -1,59 +1,60 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)delegate.cfg 1.3 08/08/15 SMI" # export STF_TIMEOUT=1800 export NISSTAFILE=$TMPDIR/nis_state export STAFF_GROUP=zfsgrp export STAFF1=staff1 export STAFF2=staff2 export OTHER_GROUP=othergrp export OTHER1=other1 export OTHER2=other2 export EVERYONE="$STAFF1 $STAFF2 $OTHER1 $OTHER2" export LOCAL_SET="snapshot" export LOCAL_DESC_SET="readonly,checksum" export DESC_SET="compression" export TESTVOL=testvol.${TESTCASE_ID} export VOLSIZE=150m export ROOT_TESTVOL=$TESTPOOL/$TESTVOL export ROOT_TESTFS=$TESTPOOL/$TESTFS export SUBFS=$ROOT_TESTFS/SUBFS export SUBFS2=$ROOT_TESTFS/SUBFS2 DATASETS="$ROOT_TESTFS" if is_global_zone ; then DATASETS="$DATASETS $ROOT_TESTVOL" fi export DATASETS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib (revision 329035) @@ -1,1899 +1,1900 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)delegate_common.kshlib 1.6 08/05/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # Cleanup exist user/group. # function cleanup_user_group { typeset i for i in $STAFF1 $STAFF2 $OTHER1 $OTHER2 ; do del_user $i done for i in $STAFF_GROUP $OTHER_GROUP ; do del_group $i done return 0 } # # Restore test file system to the original status. # function restore_root_datasets { if datasetexists $ROOT_TESTFS ; then log_must $ZFS destroy -Rf $ROOT_TESTFS fi log_must $ZFS create $ROOT_TESTFS if is_global_zone ; then if datasetexists $ROOT_TESTVOL ; then log_must $ZFS destroy -Rf $ROOT_TESTVOL fi log_must $ZFS create -V $VOLSIZE $ROOT_TESTVOL fi return 0 } # # Verify the specified user have permission on the dataset # # $1 dataset # $2 permissions which are separated by comma(,) # $3-n users # function verify_perm { typeset dtst=$1 typeset permissions=$2 shift 2 if [[ -z $@ || -z $permissions || -z $dtst ]]; then return 1 fi typeset type=$(get_prop type $dtst) permissions=$($ECHO $permissions | $TR -s "," " ") typeset user for user in $@; do typeset perm for perm in $permissions; do typeset -i ret=1 if [[ $type == "filesystem" ]]; then check_fs_perm $user $perm $dtst ret=$? elif [[ $type == "volume" ]]; then check_vol_perm $user $perm $dtst ret=$? fi if ((ret != 0)) ; then log_note "Fail: $user should have $perm " \ "on $dtst" return 1 fi done done return 0 } # # Verify the specified user have no permission on the dataset # # $1 dataset # $2 permissions which are separated by comma(,) # $3-n users # function verify_noperm { typeset dtst=$1 typeset permissions=$2 shift 2 if [[ -z $@ || -z $permissions || -z $dtst ]]; then return 1 fi typeset type=$(get_prop type $dtst) permissions=$($ECHO $permissions | $TR -s "," " ") typeset user for user in $@; do typeset perm for perm in $permissions; do typeset -i ret=1 if [[ $type == "filesystem" ]]; then check_fs_perm $user $perm $dtst ret=$? elif [[ $type == "volume" ]]; then check_vol_perm $user $perm $dtst ret=$? fi if ((ret == 0)) ; then log_note "Fail: $user should not have $perm " \ "on $dtst" return 1 fi done done return 0 } function user_run { typeset user=$1 typeset group=$($GROUPS $user) shift eval \$RUNWATTR -u \$user -g \$group \"$@\" > /dev/null 2>&1 return $? } function common_perm { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset -i ret=1 case $perm in send) verify_send $user $perm $dtst ret=$? ;; allow) verify_allow $user $perm $dtst ret=$? ;; userprop) verify_userprop $user $perm $dtst ret=$? ;; compression|checksum|readonly) verify_ccr $user $perm $dtst ret=$? ;; copies) verify_copies $user $perm $dtst ret=$? ;; reservation) verify_reservation $user $perm $dtst ret=$? ;; *) ret=1 ;; esac return $ret } function check_fs_perm { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset -i ret=1 case $perm in create) verify_fs_create $user $perm $fs ret=$? ;; destroy) verify_fs_destroy $user $perm $fs ret=$? ;; snapshot) verify_fs_snapshot $user $perm $fs ret=$? ;; rollback) verify_fs_rollback $user $perm $fs ret=$? ;; clone) verify_fs_clone $user $perm $fs ret=$? ;; rename) verify_fs_rename $user $perm $fs ret=$? ;; mount) verify_fs_mount $user $perm $fs ret=$? ;; share) verify_fs_share $user $perm $fs ret=$? ;; mountpoint) verify_fs_mountpoint $user $perm $fs ret=$? ;; promote) verify_fs_promote $user $perm $fs ret=$? ;; canmount) verify_fs_canmount $user $perm $fs ret=$? ;; recordsize) verify_fs_recordsize $user $perm $fs ret=$? ;; quota) verify_fs_quota $user $perm $fs ret=$? ;; aclmode) verify_fs_aclmode $user $perm $fs ret=$? ;; aclinherit) verify_fs_aclinherit $user $perm $fs ret=$? ;; snapdir) verify_fs_snapdir $user $perm $fs ret=$? ;; atime|exec|devices|setuid|xattr) verify_fs_aedsx $user $perm $fs ret=$? ;; zoned) verify_fs_zoned $user $perm $fs ret=$? ;; sharenfs) verify_fs_sharenfs $user $perm $fs ret=$? ;; shareiscsi) verify_fs_shareiscsi $user $perm $fs ret=$? ;; receive) verify_fs_receive $user $perm $fs ret=$? ;; *) common_perm $user $perm $fs ret=$? ;; esac return $ret } function check_vol_perm { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset -i ret=1 case $perm in destroy) verify_vol_destroy $user $perm $vol ret=$? ;; snapshot) verify_vol_snapshot $user $perm $vol ret=$? ;; rollback) verify_vol_rollback $user $perm $vol ret=$? ;; clone) verify_vol_clone $user $perm $vol ret=$? ;; rename) verify_vol_rename $user $perm $vol ret=$? ;; promote) verify_vol_promote $user $perm $vol ret=$? ;; volsize) verify_vol_volsize $user $perm $vol ret=$? ;; shareiscsi) verify_vol_shareiscsi $user $perm $vol ret=$? ;; *) common_perm $user $perm $vol ret=$? ;; esac return $ret } function setup_unallow_testenv { log_must restore_root_datasets log_must $ZFS create $SUBFS for dtst in $DATASETS ; do log_must $ZFS allow -l $STAFF1 $LOCAL_SET $dtst log_must $ZFS allow -d $STAFF2 $DESC_SET $dtst log_must $ZFS allow $OTHER1 $LOCAL_DESC_SET $dtst log_must $ZFS allow $OTHER2 $LOCAL_DESC_SET $dtst log_must verify_perm $dtst $LOCAL_SET $STAFF1 log_must verify_perm $dtst $LOCAL_DESC_SET $OTHER1 log_must verify_perm $dtst $LOCAL_DESC_SET $OTHER2 if [[ $dtst == $ROOT_TESTFS ]]; then log_must verify_perm $SUBFS $DESC_SET $STAFF2 log_must verify_perm $SUBFS $LOCAL_DESC_SET $OTHER1 log_must verify_perm $SUBFS $LOCAL_DESC_SET $OTHER2 fi done return 0 } # # Verify permission send for specified user on the dataset # $1 user # $2 permission # $3 dataset # function verify_send { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset oldval typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset snap=$dtst@snap.$stamp typeset -i ret=1 log_must $ZFS snapshot $snap typeset bak_user=$TMPDIR/bak.$user.$stamp typeset bak_root=$TMPDIR/bak.root.$stamp user_run $user eval "$ZFS send $snap > $bak_user" log_must eval "$ZFS send $snap > $bak_root" if [[ $(checksum $bak_user) == $(checksum $bak_root) ]]; then ret=0 fi $RM -rf $bak_user > /dev/null $RM -rf $bak_root > /dev/null return $ret } function verify_fs_receive { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset newfs=$fs/newfs.$stamp typeset newvol=$fs/newvol.$stamp typeset bak_user=$TMPDIR/bak.$user.$stamp typeset bak_root=$TMPDIR/bak.root.$stamp log_must $ZFS create $newfs typeset datasets="$newfs" if is_global_zone ; then log_must $ZFS create -V $VOLSIZE $newvol datasets="$newfs $newvol" fi for dtst in $datasets ; do typeset dtstsnap=$dtst@snap.$stamp log_must $ZFS snapshot $dtstsnap log_must eval "$ZFS send $dtstsnap > $bak_root" log_must $ZFS destroy -rf $dtst user_run $user eval "$ZFS receive $dtst < $bak_root" if datasetexists $dtstsnap ; then return 1 fi log_must $ZFS allow $user create $fs user_run $user eval "$ZFS receive $dtst < $bak_root" log_must $ZFS unallow $user create $fs if datasetexists $dtstsnap ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user eval "$ZFS receive $dtst < $bak_root" log_must $ZFS unallow $user mount $fs if datasetexists $dtstsnap ; then return 1 fi log_must $ZFS allow $user mount,create $fs user_run $user eval "$ZFS receive $dtst < $bak_root" log_must $ZFS unallow $user mount,create $fs if ! datasetexists $dtstsnap ; then return 1 fi # check the data integrity log_must eval "$ZFS send $dtstsnap > $bak_user" log_must $ZFS destroy -rf $dtst log_must eval "$ZFS receive $dtst < $bak_root" log_must eval "$ZFS send $dtstsnap > $bak_root" log_must $ZFS destroy -rf $dtst if [[ $(checksum $bak_user) != $(checksum $bak_root) ]]; then return 1 fi $RM -rf $bak_user > /dev/null $RM -rf $bak_root > /dev/null done return 0 } function verify_userprop { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') user_run $user $ZFS set "$user:ts=$stamp" $dtst if [[ $stamp != $(get_prop "$user:ts" $dtst) ]]; then return 1 fi return 0 } function verify_ccr { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset oldval set -A modes "on" "off" oldval=$(get_prop $perm $dtst) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $dtst" user_run $user $ZFS set $perm=${modes[$n]} $dtst if [[ ${modes[$n]} != $(get_prop $perm $dtst) ]]; then return 1 fi return 0 } function verify_copies { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset oldval set -A modes 1 2 3 oldval=$(get_prop $perm $dtst) if [[ $oldval -eq 1 ]]; then n=1 elif [[ $oldval -eq 2 ]]; then n=2 elif [[ $oldval -eq 3 ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $dtst" user_run $user $ZFS set $perm=${modes[$n]} $dtst if [[ ${modes[$n]} != $(get_prop $perm $dtst) ]]; then return 1 fi return 0 } function verify_reservation { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset value32m=$(( 1024 * 1024 * 32 )) typeset oldval=$(get_prop reservation $dtst) user_run $user $ZFS set reservation=$value32m $dtst if [[ $value32m != $(get_prop reservation $dtst) ]]; then log_must $ZFS set reservation=$oldval $dtst return 1 fi log_must $ZFS set reservation=$oldval $dtst return 0 } function verify_fs_create { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset newfs=$fs/nfs.$stamp typeset newvol=$fs/nvol.$stamp typeset check_refrev=false user_run $user $ZFS create $newfs if datasetexists $newfs ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $ZFS create $newfs log_must $ZFS unallow $user mount $fs if ! datasetexists $newfs ; then return 1 fi if support_refrev $newfs; then check_refrev=true fi log_must $ZFS destroy $newfs if is_global_zone ; then # mount permission is required for sparse volume user_run $user $ZFS create -V 150m -s $newvol if datasetexists $newvol ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $ZFS create -V 150m -s $newvol log_must $ZFS unallow $user mount $fs if ! datasetexists $newvol ; then return 1 fi log_must $ZFS destroy $newvol # mount and reserveration permission are # required for normal volume user_run $user $ZFS create -V 150m $newvol if datasetexists $newvol ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $ZFS create -V 150m $newvol log_must $ZFS unallow $user mount $fs if datasetexists $newvol ; then return 1 fi log_must $ZFS allow $user reservation $fs user_run $user $ZFS create -V 150m $newvol log_must $ZFS unallow $user reservation $fs if datasetexists $newvol ; then return 1 fi if [[ $check_refrev == true ]]; then log_must $ZFS allow $user refreservation $fs user_run $user $ZFS create -V 150m $newvol log_must $ZFS unallow $user refreservation $fs if datasetexists $newvol ; then return 1 fi fi log_must $ZFS allow $user mount $fs log_must $ZFS allow $user reservation $fs if [[ $check_refrev == true ]]; then log_must $ZFS allow $user refreservation $fs fi user_run $user $ZFS create -V 150m $newvol log_must $ZFS unallow $user mount $fs log_must $ZFS unallow $user reservation $fs if [[ $check_refrev == true ]]; then log_must $ZFS unallow $user refreservation $fs fi if ! datasetexists $newvol ; then return 1 fi log_must $ZFS destroy $newvol fi return 0 } function verify_fs_destroy { typeset user=$1 typeset perm=$2 typeset fs=$3 if ! ismounted $fs ; then user_run $user $ZFS destroy $fs if datasetexists $fs ; then return 1 fi fi if ismounted $fs ; then user_run $user $ZFS destroy $fs if ! datasetexists $fs ; then return 1 fi # mount permission is required log_must $ZFS allow $user mount $fs user_run $user $ZFS destroy $fs if datasetexists $fs ; then return 1 fi fi return 0 } function verify_fs_snapshot { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset snap=$fs@snap.$stamp typeset mntpt=$(get_prop mountpoint $fs) if [[ "yes" == $(get_prop mounted $fs) ]]; then log_must $ZFS umount $fs fi user_run $user $ZFS snapshot $snap if datasetexists $snap ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $ZFS snapshot $snap log_must $ZFS unallow $user mount $fs if ! datasetexists $snap ; then return 1 fi log_must $ZFS destroy $snap if [[ "no" == $(get_prop mounted $fs) ]]; then log_must $ZFS mount $fs fi user_run $user $ZFS snapshot $snap if datasetexists $snap ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $ZFS snapshot $snap log_must $ZFS unallow $user mount $fs if ! datasetexists $snap ; then return 1 fi log_must $ZFS destroy $snap typeset snapdir=${mntpt}/$(get_snapdir_name)/snap.$stamp user_run $user $MKDIR $snapdir if datasetexists $snap ; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $MKDIR $snapdir log_must $ZFS unallow $user mount $fs if ! datasetexists $snap ; then return 1 fi log_must $ZFS destroy $snap return 0 } function verify_fs_rollback { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset snap=$fs@snap.$stamp typeset mntpt=$(get_prop mountpoint $fs) oldval=$(datasetcksum $fs) log_must $ZFS snapshot $snap if ! ismounted $fs; then log_must $ZFS mount $fs fi log_must $TOUCH $mntpt/testfile.$stamp user_run $user $ZFS rollback -R $snap $SLEEP 10 if is_global_zone ; then if [[ $oldval == $(datasetcksum $fs) ]]; then return 1 fi else # datasetcksum can not be used in local zone if [[ ! -e $mntpt/testfile.$stamp ]]; then return 1 fi fi # rollback on mounted fs has to be with mount permission log_must $ZFS allow $user mount $fs user_run $user $ZFS rollback -R $snap log_must $ZFS unallow $user mount $fs $SLEEP 10 if is_global_zone ; then if [[ $oldval != $(datasetcksum $fs) ]]; then return 1 fi else # datasetcksum can not be used in local zone if [[ -e $mntpt/testfile.$stamp ]]; then return 1 fi fi return 0 } function verify_fs_clone { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basefs=${fs%/*} typeset snap=$fs@snap.$stamp typeset clone=$basefs/cfs.$stamp log_must $ZFS snapshot $snap user_run $user $ZFS clone $snap $clone if datasetexists $clone ; then return 1 fi log_must $ZFS allow $user create $basefs user_run $user $ZFS clone $snap $clone log_must $ZFS unallow $user create $basefs if datasetexists $clone ; then return 1 fi log_must $ZFS allow $user mount $basefs user_run $user $ZFS clone $snap $clone log_must $ZFS unallow $user mount $basefs if datasetexists $clone ; then return 1 fi log_must $ZFS allow $user mount $basefs log_must $ZFS allow $user create $basefs user_run $user $ZFS clone $snap $clone log_must $ZFS unallow $user create $basefs log_must $ZFS unallow $user mount $basefs if ! datasetexists $clone ; then return 1 fi log_must $ZFS destroy -R $snap return 0 } function verify_fs_rename { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basefs=${fs%/*} typeset snap=$fs@snap.$stamp typeset renamefs=$basefs/nfs.$stamp if ! ismounted $fs; then log_must $ZFS mount $fs fi # case 1 user_run $user $ZFS rename $fs $renamefs if datasetexists $renamefs ; then return 1 fi # case 2 log_must $ZFS allow $user create $basefs user_run $user $ZFS rename $fs $renamefs log_must $ZFS unallow $user create $basefs if datasetexists $renamefs ; then return 1 fi # case 3 log_must $ZFS allow $user mount $basefs user_run $user $ZFS rename $fs $renamefs log_must $ZFS unallow $user mount $basefs if datasetexists $renamefs ; then return 1 fi # case 4 log_must $ZFS allow $user mount $fs user_run $user $ZFS rename $fs $renamefs if datasetexists $renamefs ; then log_must $ZFS unallow $user mount $renamefs return 1 fi log_must $ZFS unallow $user mount $fs # case 5 log_must $ZFS allow $user create $basefs log_must $ZFS allow $user mount $fs user_run $user $ZFS rename $fs $renamefs log_must $ZFS unallow $user create $basefs if datasetexists $renamefs ; then log_must $ZFS unallow $user mount $renamefs return 1 fi log_must $ZFS unallow $user mount $fs # case 6 log_must $ZFS allow $user mount $basefs log_must $ZFS allow $user mount $fs user_run $user $ZFS rename $fs $renamefs log_must $ZFS unallow $user mount $basefs if datasetexists $renamefs ; then log_must $ZFS unallow $user mount $renamefs return 1 fi log_must $ZFS unallow $user mount $fs # case 7 log_must $ZFS allow $user create $basefs log_must $ZFS allow $user mount $basefs user_run $user $ZFS rename $fs $renamefs log_must $ZFS unallow $user mount $basefs log_must $ZFS unallow $user create $basefs if ! datasetexists $renamefs ; then return 1 fi log_must $ZFS rename $renamefs $fs return 0 } function verify_fs_mount { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset mntpt=$(get_prop mountpoint $fs) typeset newmntpt=$TMPDIR/mnt.$stamp if ismounted $fs ; then user_run $user $ZFS unmount $fs if ismounted $fs ; then return 1 fi fi if ! ismounted $fs ; then log_must $ZFS set mountpoint=$newmntpt $fs log_must $RM -rf $newmntpt log_must $MKDIR $newmntpt user_run $user $ZFS mount $fs if ismounted $fs ; then return 1 fi # mountpoint's owner must be the user log_must $CHOWN $user $newmntpt user_run $user $ZFS mount $fs if ! ismounted $fs ; then return 1 fi log_must $ZFS umount $fs log_must $RM -rf $newmntpt log_must $ZFS set mountpoint=$mntpt $fs fi return 0 } function verify_fs_share { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset mntpt=$(get_prop mountpoint $fs) typeset stat=$($SVCS -H -o STA nfs/server:default) if [[ $stat != "ON" ]]; then log_note "Current nfs/server status: $stat" # legacy share user_run $user $SHARE $mntpt if is_shared $fs; then return 1 fi # sharenfs=on log_must $ZFS set sharenfs=on $fs user_run $user $ZFS share $fs if is_shared $fs; then log_must $ZFS set sharenfs=off $fs return 1 fi log_must $ZFS set sharenfs=off $fs fi # turn on nfs/server service if it is not enabled typeset tmpshare=$TMPDIR/a.${TESTCASE_ID} $RM -rf $tmpshare log_must $MKDIR -p $tmpshare log_must $SHARE $tmpshare # legacy share user_run $user $SHARE $mntpt if ! is_shared $fs ; then log_must $UNSHARE $tmpshare log_must $RM -rf $tmpshare return 1 fi user_run $user $UNSHARE $mntpt if is_shared $fs ; then log_must $UNSHARE $tmpshare log_must $RM -rf $tmpshare return 1 fi # sharenfs=on log_must $ZFS set sharenfs=on $fs user_run $user $ZFS share $fs if ! is_shared $fs; then log_must $ZFS set sharenfs=off $fs return 1 fi user_run $user $ZFS unshare $fs if is_shared $fs; then log_must $ZFS set sharenfs=off $fs return 1 fi log_must $ZFS set sharenfs=off $fs log_must $UNSHARE $tmpshare log_must $RM -rf $tmpshare return 0 } function verify_fs_mountpoint { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset mntpt=$(get_prop mountpoint $fs) typeset newmntpt=$TMPDIR/mnt.$stamp if ! ismounted $fs ; then user_run $user $ZFS set mountpoint=$newmntpt $fs if [[ $newmntpt != \ $(get_prop mountpoint $fs) ]] ; then return 1 fi log_must $ZFS set mountpoint=$mntpt $fs fi if ismounted $fs ; then user_run $user $ZFS set mountpoint=$newmntpt $fs if [[ $mntpt != $(get_prop mountpoint $fs) ]] ; then return 1 fi # require mount permission when fs is mounted log_must $ZFS allow $user mount $fs user_run $user $ZFS set mountpoint=$newmntpt $fs log_must $ZFS unallow $user mount $fs if [[ $newmntpt != \ $(get_prop mountpoint $fs) ]] ; then return 1 fi log_must $ZFS set mountpoint=$mntpt $fs fi return 0 } function verify_fs_promote { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basefs=${fs%/*} typeset snap=$fs@snap.$stamp typeset clone=$basefs/cfs.$stamp log_must $ZFS snapshot $snap log_must $ZFS clone $snap $clone log_must $ZFS promote $clone typeset fs_orig=$(get_prop origin $fs) typeset clone_orig=$(get_prop origin $clone) user_run $user $ZFS promote $fs # promote should fail if original fs does not have # promote permission if [[ $fs_orig != $(get_prop origin $fs) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi log_must $ZFS allow $user promote $clone user_run $user $ZFS promote $fs log_must $ZFS unallow $user promote $clone if [[ $fs_orig != $(get_prop origin $fs) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi log_must $ZFS allow $user mount $fs user_run $user $ZFS promote $fs log_must $ZFS unallow $user mount $fs if [[ $fs_orig != $(get_prop origin $fs) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi log_must $ZFS allow $user mount $fs log_must $ZFS allow $user promote $clone user_run $user $ZFS promote $fs log_must $ZFS unallow $user promote $clone log_must $ZFS unallow $user mount $fs if [[ $snap != $(get_prop origin $clone) || \ $clone_orig != $(get_prop origin $fs) ]]; then return 1 fi return 0 } function verify_fs_canmount { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') if ! ismounted $fs ; then set -A modes "on" "off" oldval=$(get_prop $perm $fs) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $fs" user_run $user $ZFS set $perm=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop $perm $fs) ]]; then return 1 fi fi # fs is mounted if ismounted $fs ; then # property value does not change if # no mount permission set -A modes "on" "off" oldval=$(get_prop $perm $fs) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $fs" log_must $ZFS allow $user mount $fs user_run $user $ZFS set $perm=${modes[$n]} $fs log_must $ZFS unallow $user mount $fs if [[ ${modes[$n]} != $(get_prop $perm $fs) ]]; then return 1 fi fi return 0 } function verify_fs_recordsize { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset value8k=$(( 1024 * 8 )) user_run $user $ZFS set recordsize=$value8k $fs if [[ $value8k != $(get_prop recordsize $fs) ]]; then return 1 fi return 0 } function verify_fs_quota { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset value32m=$(( 1024 * 1024 * 32 )) user_run $user $ZFS set quota=$value32m $fs if [[ $value32m != $(get_prop quota $fs) ]]; then return 1 fi return 0 } function verify_fs_aclmode { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval set -A modes "discard" "groupmask" "passthrough" oldval=$(get_prop $perm $fs) if [[ $oldval == "discard" ]]; then n=1 elif [[ $oldval == "groupmask" ]]; then n=2 elif [[ $oldval == "passthrough" ]]; then n=0 fi log_note "$user $ZFS set aclmode=${modes[$n]} $fs" user_run $user $ZFS set aclmode=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop aclmode $fs) ]]; then return 1 fi return 0 } function verify_fs_aclinherit { typeset user=$1 typeset perm=$2 typeset fs=$3 # # PSARC/2008/231 change the default value of aclinherit to "restricted" # but still keep the old interface of "secure" # typeset oldval set -A modes "discard" "noallow" "secure" "passthrough" oldval=$(get_prop $perm $fs) if [[ $oldval == "discard" ]]; then n=1 elif [[ $oldval == "noallow" ]]; then n=2 elif [[ $oldval == "secure" || $oldval == "restricted" ]]; then n=3 elif [[ $oldval == "passthrough" ]]; then n=0 fi log_note "$user $ZFS set aclinherit=${modes[$n]} $fs" user_run $user $ZFS set aclinherit=${modes[$n]} $fs typeset newval=$(get_prop aclinherit $fs) if [[ ${modes[$n]} == "secure" && $newval == "restricted" ]]; then return 0 elif [[ ${modes[$n]} != $(get_prop aclinherit $fs) ]]; then return 1 fi return 0 } function verify_fs_snapdir { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval set -A modes "visible" "hidden" oldval=$(get_prop $perm $fs) if [[ $oldval == "visible" ]]; then n=1 elif [[ $oldval == "hidden" ]]; then n=0 fi log_note "$user $ZFS set snapdir=${modes[$n]} $fs" user_run $user $ZFS set snapdir=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop snapdir $fs) ]]; then return 1 fi return 0 } function verify_fs_aedsx { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval set -A modes "on" "off" oldval=$(get_prop $perm $fs) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $fs" user_run $user $ZFS set $perm=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop $perm $fs) ]]; then return 1 fi return 0 } function verify_fs_zoned { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval set -A modes "on" "off" oldval=$(get_prop $perm $fs) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $fs" if is_global_zone ; then if ! ismounted $fs ; then user_run $user $ZFS set \ $perm=${modes[$n]} $fs if [[ ${modes[$n]} != \ $(get_prop $perm $fs) ]]; then return 1 fi if [[ $n -eq 0 ]]; then log_mustnot $ZFS mount $fs else log_must $ZFS mount $fs fi fi if ismounted $fs; then # n always is 1 in this case user_run $user $ZFS set \ $perm=${modes[$n]} $fs if [[ $oldval != \ $(get_prop $perm $fs) ]]; then return 1 fi # mount permission is needed # to make zoned=on log_must $ZFS allow $user mount $fs user_run $user $ZFS set \ $perm=${modes[$n]} $fs log_must $ZFS unallow $user mount $fs if [[ ${modes[$n]} != \ $(get_prop $perm $fs) ]]; then return 1 fi fi fi if ! is_global_zone; then user_run $user $ZFS set $perm=${modes[$n]} $fs if [[ $oldval != $(get_prop $perm $fs) ]]; then return 1 fi fi return 0 } function verify_fs_sharenfs { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval set -A modes "on" "off" oldval=$(get_prop $perm $fs) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $fs" user_run $user $ZFS set $perm=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop $perm $fs) ]]; then return 1 fi log_must $ZFS set $perm=$oldval $fs # turn on nfs/server service if it is not enabled typeset tmpshare=$TMPDIR/a.${TESTCASE_ID} $RM -rf $tmpshare log_must $MKDIR -p $tmpshare log_must $SHARE $tmpshare log_note "$user $ZFS set $perm=${modes[$n]} $fs" user_run $user $ZFS set $perm=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop $perm $fs) ]]; then return 1 fi user_run $user $ZFS share $fs if is_shared $fs; then return 1 fi # share permission is needed log_must $ZFS allow $user share $fs user_run $user $ZFS share $fs log_must $ZFS unallow $user share $fs if [[ $n -eq 0 ]] && ! is_shared $fs ; then log_must $UNSHARE $tmpshare log_must $RM -rf $tmpshare return 1 fi if [[ $n -eq 1 ]] && is_shared $fs ; then log_must $UNSHARE $tmpshare log_must $RM -rf $tmpshare return 1 fi log_must $UNSHARE $tmpshare log_must $RM -rf $tmpshare return 0 } function verify_fs_shareiscsi { typeset user=$1 typeset perm=$2 typeset fs=$3 typeset oldval set -A modes "on" "off" oldval=$(get_prop $perm $fs) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $fs" user_run $user $ZFS set $perm=${modes[$n]} $fs if [[ ${modes[$n]} != $(get_prop $perm $fs) ]]; then return 1 fi return 0 } function verify_vol_destroy { typeset user=$1 typeset perm=$2 typeset vol=$3 user_run $user $ZFS destroy $vol if ! datasetexists $vol ; then return 1 fi # mount permission is required log_must $ZFS allow $user mount $vol user_run $user $ZFS destroy $vol if datasetexists $vol ; then return 1 fi return 0 } function verify_vol_snapshot { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp user_run $user $ZFS snapshot $snap if datasetexists $snap ; then return 1 fi log_must $ZFS allow $user mount $vol user_run $user $ZFS snapshot $snap log_must $ZFS unallow $user mount $vol if ! datasetexists $snap ; then return 1 fi return 0 } function verify_vol_rollback { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset oldval log_must $ZFS snapshot $snap oldval=$(datasetcksum $vol) log_must $DD if=/dev/random of=/dev/zvol/rdsk/$vol \ bs=512 count=1 user_run $user $ZFS rollback -R $snap $SLEEP 10 if [[ $oldval == $(datasetcksum $vol) ]]; then return 1 fi # rollback on volume has to be with mount permission log_must $ZFS allow $user mount $vol user_run $user $ZFS rollback -R $snap $SLEEP 10 log_must $ZFS unallow $user mount $vol if [[ $oldval != $(datasetcksum $vol) ]]; then return 1 fi return 0 } function verify_vol_clone { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset clone=$basevol/cvol.$stamp log_must $ZFS snapshot $snap user_run $user $ZFS clone $snap $clone if datasetexists $clone ; then return 1 fi log_must $ZFS allow $user create $basevol user_run $user $ZFS clone $snap $clone log_must $ZFS unallow $user create $basevol if datasetexists $clone ; then return 1 fi log_must $ZFS allow $user mount $basevol user_run $user $ZFS clone $snap $clone log_must $ZFS unallow $user mount $basevol if datasetexists $clone ; then return 1 fi # require create permission on parent and # mount permission on itself as well log_must $ZFS allow $user mount $basevol log_must $ZFS allow $user create $basevol user_run $user $ZFS clone $snap $clone log_must $ZFS unallow $user create $basevol log_must $ZFS unallow $user mount $basevol if ! datasetexists $clone ; then return 1 fi return 0 } function verify_vol_rename { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset clone=$basevol/cvol.$stamp typeset renamevol=$basevol/nvol.$stamp user_run $user $ZFS rename $vol $renamevol if datasetexists $renamevol ; then return 1 fi log_must $ZFS allow $user create $basevol user_run $user $ZFS rename $vol $renamevol log_must $ZFS unallow $user create $basevol if datasetexists $renamevol ; then return 1 fi log_must $ZFS allow $user mount $basevol user_run $user $ZFS rename $vol $renamevol log_must $ZFS unallow $user mount $basevol if datasetexists $renamevol ; then return 1 fi # require both create permission on parent and # mount permission on parent as well log_must $ZFS allow $user mount $basevol log_must $ZFS allow $user create $basevol user_run $user $ZFS rename $vol $renamevol log_must $ZFS unallow $user mount $basevol log_must $ZFS unallow $user create $basevol if ! datasetexists $renamevol ; then return 1 fi log_must $ZFS rename $renamevol $vol return 0 } function verify_vol_promote { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset stamp=${perm}.${user}.$($DATE +'%F-%R:%S') typeset basevol=${vol%/*} typeset snap=$vol@snap.$stamp typeset clone=$basevol/cvol.$stamp log_must $ZFS snapshot $snap log_must $ZFS clone $snap $clone log_must $ZFS promote $clone typeset vol_orig=$(get_prop origin $vol) typeset clone_orig=$(get_prop origin $clone) # promote should fail if $vol and $clone # miss either mount or promote permission # case 1 user_run $user $ZFS promote $vol if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote should fail if $vol and $clone # miss either mount or promote permission # case 2 log_must $ZFS allow $user promote $clone user_run $user $ZFS promote $vol log_must $ZFS unallow $user promote $clone if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote should fail if $vol and $clone # miss either mount or promote permission # case 3 log_must $ZFS allow $user mount $vol user_run $user $ZFS promote $vol log_must $ZFS unallow $user mount $vol if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote should fail if $vol and $clone # miss either mount or promote permission # case 4 log_must $ZFS allow $user mount $clone user_run $user $ZFS promote $vol log_must $ZFS unallow $user mount $clone if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote should fail if $vol and $clone # miss either mount or promote permission # case 5 log_must $ZFS allow $user promote $clone log_must $ZFS allow $user mount $vol user_run $user $ZFS promote $vol log_must $ZFS unallow $user promote $clone log_must $ZFS unallow $user mount $vol if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote should fail if $vol and $clone # miss either mount or promote permission # case 6 log_must $ZFS allow $user promote $clone log_must $ZFS allow $user mount $clone user_run $user $ZFS promote $vol log_must $ZFS unallow $user promote $clone log_must $ZFS unallow $user mount $vol if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote should fail if $vol and $clone # miss either mount or promote permission # case 7 log_must $ZFS allow $user mount $vol log_must $ZFS allow $user mount $clone user_run $user $ZFS promote $vol log_must $ZFS unallow $user mount $vol log_must $ZFS unallow $user mount $clone if [[ $vol_orig != $(get_prop origin $vol) || \ $clone_orig != $(get_prop origin $clone) ]]; then return 1 fi # promote only succeeds when $vol and $clone # have both mount and promote permission # case 8 log_must $ZFS allow $user promote $clone log_must $ZFS allow $user mount $vol log_must $ZFS allow $user mount $clone user_run $user $ZFS promote $vol log_must $ZFS unallow $user promote $clone log_must $ZFS unallow $user mount $vol log_must $ZFS unallow $user mount $clone if [[ $snap != $(get_prop origin $clone) || \ $clone_orig != $(get_prop origin $vol) ]]; then return 1 fi return 0 } function verify_vol_volsize { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset oldval oldval=$(get_prop volsize $vol) (( newval = oldval * 2 )) typeset check_refrev=false if support_refrev $vol; then check_refrev=true fi typeset reserv_size if [[ $check_refrev == true ]]; then reserv_size=$(get_prop refreservation $vol) else reserv_size=$(get_prop reservation $vol) fi if [[ "0" == $reserv_size ]]; then # sparse volume user_run $user $ZFS set volsize=$newval $vol if [[ $oldval == $(get_prop volsize $vol) ]]; then return 1 fi else # normal volume, reservation permission # is required user_run $user $ZFS set volsize=$newval $vol if [[ $newval == $(get_prop volsize $vol) ]]; then return 1 fi log_must $ZFS allow $user reservation $vol if [[ $check_refrev == true ]]; then log_must $ZFS allow $user refreservation $vol fi user_run $user $ZFS set volsize=$newval $vol log_must $ZFS unallow $user reservation $vol if [[ $check_refrev == true ]]; then log_must $ZFS unallow $user refreservation $vol fi if [[ $oldval == $(get_prop volsize $vol) ]]; then return 1 fi fi return 0 } function verify_vol_shareiscsi { typeset user=$1 typeset perm=$2 typeset vol=$3 typeset oldval set -A modes "on" "off" oldval=$(get_prop $perm $vol) if [[ $oldval == "on" ]]; then n=1 elif [[ $oldval == "off" ]]; then n=0 fi log_note "$user $ZFS set $perm=${modes[$n]} $vol" user_run $user $ZFS set $perm=${modes[$n]} $vol if [[ ${modes[$n]} != $(get_prop $perm $vol) ]]; then return 1 fi iscsitgt_setup if [[ $n -eq 1 ]] && is_iscsi_target $vol ; then iscsitgt_cleanup return 1 fi if [[ $n -eq 0 ]] && ! is_iscsi_target $vol ; then iscsitgt_cleanup return 1 fi iscsitgt_cleanup return 0 } function verify_allow { typeset user=$1 typeset perm=$2 typeset dtst=$3 typeset -i ret user_run $user $ZFS allow $user allow $dtst ret=$? if [[ $ret -eq 0 ]]; then return 1 fi log_must $ZFS allow $user copies $dtst user_run $user $ZFS allow $user copies $dtst ret=$? log_must $ZFS unallow $user copies $dtst if [[ $ret -eq 1 ]]; then return 1 fi return 0 } function support_refrev { typeset dataset=$1 $ZFS get refreservation $dataset > /dev/null 2>&1 if (( $? != 0 )); then return 1 fi return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/devices/devices.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/devices/devices.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/devices/devices.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)devices.cfg 1.3 08/08/15 SMI" # export TESTFILE1=testfile1${TESTCASE_ID} export TESTFILE2=testfile2${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/devices/devices_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/devices/devices_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/devices/devices_common.kshlib (revision 329035) @@ -1,117 +1,118 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)devices_common.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # Create block file or charactor file according to parameter. # # $1 device file type # $2 file name # function create_dev_file { typeset filetype=$1 typeset filename=$2 case $filetype in b) devtype=$($DF -n / | $AWK '{print $3}') case $devtype in zfs) rootpool=$($DF / | \ $AWK '{print $2}') rootpool=${rootpool#\(} rootpool=${rootpool%%/*} devstr=$(get_disklist $rootpool) devstr=$($ECHO "$devstr" | \ $AWK '{print $1}') [[ -z $devstr ]] && \ log_fail "Can not get block device file." devstr=/dev/dsk/${devstr} ;; ufs) # # Get the existing block device file in current system. # And bring out the first one. # devstr=$($DF -lhF ufs | \ $GREP "^/dev/dsk" | \ $AWK '{print $1}') devstr=$($ECHO "$devstr" | \ $AWK '{print $1}') [[ -z $devstr ]] && \ log_fail "Can not get block device file." ;; *) log_unsupported "Unsupported fstype " \ "for / ($devtype)," \ "only ufs|zfs is supported." ;; esac # # Get the device file information. i.e: # /dev/dsk/c0t0d0s0: block special (28/768) # devstr=$($FILE $devstr) # # Bring out major and minor number. # major=${devstr##*\(} major=${major%%/*} minor=${devstr##*/} minor=${minor%\)} log_must $MKNOD $filename b $major $minor ;; c) # # Create device file '/dev/null' # log_must $MKNOD $filename c 13 2 ;; *) log_fail "'$filetype' is wrong." ;; esac return 0 } function cleanup { log_must $ZFS set devices=on $TESTPOOL/$TESTFS log_must $RM -f $TESTDIR/$TESTFILE1 log_must $RM -f $TESTDIR/$TESTFILE2 log_must $RM -f $TESTDIR/$TESTFILE1.out log_must $RM -f $TESTDIR/$TESTFILE2.out } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg (revision 329035) @@ -1,43 +1,44 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)grow_pool.cfg 1.3 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib export DISK_ARRAY_LIMIT=2 export BLOCK_SIZE=8192 set_disks # # Do not make SIZE too large as the three slices may exceed # the size of the disk, and also slow down the test # which involves filling until ENOSPC # export SIZE="100mb" export PARTITION=1 export SMALL_WRITE_COUNT=100 export TESTFILE1=file${TESTCASE_ID}.1 export WRITE_COUNT=65536000 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_replicas/grow_replicas.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_replicas/grow_replicas.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_replicas/grow_replicas.cfg (revision 329035) @@ -1,71 +1,72 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)grow_replicas.cfg 1.4 08/11/03 SMI" # . $STF_SUITE/include/libtest.kshlib function set_disks { set -A disk_array $(find_disks $DISKS) typeset -i i=0 typeset -i limit=4 while (( i < limit )); do if [[ -n ${disk_array[$i]} ]]; then export DISK${i}="${disk_array[$i]}" else export DISK=${DISKS%% *} return fi ((i = i + 1)) done export DISK="" } typeset -i index=`expr $RANDOM % 2` if (( $index == 0 )); then POOLTYPE="mirror" else POOLTYPE="raidz" fi export POOLTYPE export BLOCK_SIZE=8192 set_disks # # Do not make SIZE too large as the three slices may exceed # the size of the disk, and also slow down the test # which involves filling until ENOSPC # export SIZE="100mb" if [[ $WRAPPER != *"smi"* ]]; then export PARTITION=1 else export PARTITION=2 fi export SMALL_WRITE_COUNT=100 export TESTFILE1=file${TESTCASE_ID}.1 export WRITE_COUNT=65536000 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/history/history.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/history/history.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/history/history.cfg (revision 329035) @@ -1,45 +1,46 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)history.cfg 1.5 08/08/15 SMI" # export ZFSROOT= export MPOOL=mpool.${TESTCASE_ID} export EXPECT_HISTORY=$TMPDIR/exp_history.${TESTCASE_ID} export REAL_HISTORY=$TMPDIR/real_history.${TESTCASE_ID} export ADD_HISTORY=$TMPDIR/add_history.${TESTCASE_ID} export MIGRATEDPOOLNAME=${MIGRATEDPOOLNAME:-history_pool} export TIMEZONE=${TIMEZONE:-US/Mountain} export STF_TIMEOUT=1800 export HIST_USER="huser" export HIST_GROUP="hgroup" export TESTVOL=testvol.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/history/history_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/history/history_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/history/history_common.kshlib (revision 329035) @@ -1,265 +1,266 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)history_common.kshlib 1.3 07/07/31 SMI" # . $STF_SUITE/include/libtest.kshlib # # Execute arguments and record them to the log file. # Notice: EXPECT_HISTORY need be defined. # # $1-n arguments for execution. # function exec_record { [[ -z $EXPECT_HISTORY ]] && log_fail "EXPECT_HISTORY is undefined." typeset long_hist typeset user='root' typeset opt while getopts ":lu:" opt; do case $opt in l) long_hist=1;; u) user=$OPTARG ;; esac done shift $(($OPTIND -1)) if [[ $user == 'root' ]]; then log_must "$@" else log_must $SU $user -c "$@" fi user_id=$(id -u $user) typeset cmdline="$@" # Remove "eval" ">*" & "<*" for 'zfs send' and 'zfs receive'. cmdline=${cmdline#eval} cmdline=${cmdline%%\>*} cmdline=${cmdline%%\<*} # Remove additional blank cmdline=${cmdline## } cmdline=${cmdline%% } # Get the basename of command. i.e: /usr/sbin/zpool -> zpool typeset cmd=$($ECHO $cmdline | $AWK '{print $1}') eval cmdline=\${cmdline#$cmd} cmd=${cmd##*/} # Write basic history to file print -n $cmd $cmdline >> $EXPECT_HISTORY if [[ -n $long_hist ]]; then # Write long history to file hn=$($HOSTNAME) zn=$($ZONENAME) [ "$zn" = "global" ] && zn="" [ -n "$zn" ] && zn=":$zn" print -n " [user $user_id ($user) on $hn$zn]" >> $EXPECT_HISTORY fi # Plus enter in the end of line print >> $EXPECT_HISTORY } # # Format 'zpool history' output to specified file. # # $1 pool name # $2 output file. # $3 option # function format_history { typeset pool=$1 typeset outfile=$2 typeset option=$3 [[ -z $pool || -z $outfile ]] && \ log_fail "Usage: format_history [option]" typeset temp_history=$TMPDIR/temp_history.format_history.${TESTCASE_ID} $ZPOOL history $option $pool > $temp_history # Truncate output file $CAT /dev/null > $outfile typeset line typeset -i n=0 while read line; do # Ignore the first line and empty line if [[ $n -eq 0 || -z $line ]]; then n=1; continue fi $ECHO ${line#* } >> $outfile done < $temp_history $RM -f $temp_history } # # Get the additional pool history. # # $1 pool name # $2 additional history file # $3 option # function additional_history { typeset pool=$1 typeset add_his_file=$2 typeset option=$3 if [[ -z $pool || -z $add_his_file ]]; then log_fail "Usage: additional_history " \ " [option]" fi typeset temp_history=$TMPDIR/temp_history.additional_history.${TESTCASE_ID} # Current current history format_history $pool $temp_history $option # Figure out new history $DIFF $temp_history $REAL_HISTORY | $GREP "^<" | $SED 's/^<[ ]*//' > \ $add_his_file $CP $temp_history $REAL_HISTORY $RM -f $temp_history } # # Get given dataset id # # $1 dataset name # function get_dataset_id { typeset ds=$1 # # The zdb information looks like: # # Dataset pool/fs [ZPL], ID 21, cr_txg 6, 18.0K, 4 objects # typeset dst_id=$($ZDB $ds | $GREP "^Dataset $ds " | \ $AWK -F\, '{print $2}' | $AWK '{print $2}') $ECHO $dst_id } # # Special case of verify_history, but only for destroyed datasets. This is # needed because get_dataset_id depends on still having the original dataset # in order to obtain its dataset id. # function verify_destroyed # { typeset his_file=$1 typeset ds_id=$2 $GREP -E "\[txg:[0-9]+\] destroy [^ ]+ \($ds_id\)" $his_file \ > /dev/null 2>&1 (($? == 0)) && return 0 return 1 } # # Verify directly executed commands in a history file. This differs from # verify_history in that it checks for explicit commands as opposed to # internally generated commands. # function verify_direct_history # { typeset his_file=$1 typeset subcmd=$2 typeset ds=$3 $GREP "zfs ${subcmd} ${ds}" ${his_file} > /dev/null 2>&1 (($? == 0)) && return 0 return 1 } # This function mostly just helps to collapse the case statement # in verify_history. It returns whether the line matches (1==true). function verify_history_line { typeset line=$1 typeset subcmd=$2 typeset ds=$3 typeset keyword=$4 typeset dst_id=$(get_dataset_id $ds) log_note "Line: '$line'" log_note "Checking cmd($subcmd) for $ds, keyword='$keyword'" $ECHO $line | $GREP -E "\[txg:[0-9]+\] $subcmd $ds \($dst_id\)" | \ $GREP $keyword >/dev/null 2>&1 [[ $? == 0 ]] && return 1 return 0 } # # Scan history file and check if it include expected internal history # information # # $1 history file # $2 subcmd # $3 dataset # $4 keyword # function verify_history # [keyword] { typeset his_file=$1 typeset subcmd=$2 typeset ds=$3 typeset keyword=$4 typeset line found=0 log_note "Test1" while read line; do case $subcmd in snapshot|rollback|inherit) # [txg:12] snapshot system/foo@0 (46) keyword="$subcmd" verify_history_line "$line" $subcmd $ds $keyword [[ $? == 0 ]] && return 0 ;; allow) # [txg:10] permission update testpool.1477/testfs.1477 (40) s-$@basic snapshot _subcmd="permission update" verify_history_line "$line" "$_subcmd" $ds "$keyword" [[ $? == 0 ]] && return 0 ;; unallow) # [txg:174] permission remove testpool.1477/testfs.1477 (40) El$ @set _subcmd="permission remove" verify_history_line "$line" "$_subcmd" $ds "$keyword" [[ $? == 0 ]] && return 0 ;; *) ;; esac done < $his_file return 1 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)hotplug.cfg 1.3 08/08/15 SMI" # export DEV_DISKS="$DISK0 $DISK1 $DISK2" export SPARE_DISKS="$DISK3" export ALL_DISKS="$DEV_DISKS $SPARE_DISKS" set_disks Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib (revision 329035) @@ -1,460 +1,461 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)hotplug.kshlib 1.4 08/11/03 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/include/libgnop.kshlib . $STF_SUITE/tests/hotplug/hotplug.cfg # # create lofi devices # # $1-n files # function create_lofi_device { typeset lofi_files="$@" typeset file for file in $lofi_files ; do if ! $LOFIADM $file > /dev/null 2>&1 ; then insert_device $file if (($? != 0)); then return 1 fi fi shift done return 0 } # # Check and destroy lofi devices # # $1-n lofi files or deviece # function destroy_lofi_device { typeset -i ret=0 typeset dev_file="$@" typeset file for file in $dev_file ; do if $LOFIADM $file > /dev/null 2>&1; then $LOFIADM -d $file -f if (($? != 0)); then ((ret += 1)) fi fi done return $ret } # # Setup test environment using DISKS[1-4] # # $1 pool type # function setup_testenv { typeset type=$1 if [[ -z $type ]]; then log_fail "Usage: setup_testenv " fi log_must $ZPOOL create -f \ $TESTPOOL $type ${DISK0}.nop ${DISK1}.nop ${DISK2}.nop ${DISK3}.nop } # # Cleanup test envirnment according to pool name # # $1 pool # function cleanup_testenv { destroy_pool $TESTPOOL } # # Start a background process to write file on given pool. # # $1 pool # function start_bg_write { typeset pool=$1 if datasetnonexists $pool; then return 1 fi typeset mntpnt=$(get_prop mountpoint $pool) while true; do $DD if=/dev/random of=$mntpnt/foo count=10 $SYNC $SLEEP 1 done & BG_PID=$! return 0 } # # Kill the background write process. # function kill_bg_write { typeset -i ret=0 if [[ -n $BG_PID ]]; then kill -9 $BG_PID ret=$? if ((ret == 0)); then BG_PID='' fi fi $SLEEP 10 return $ret } # # Insert a given file into a given device slot # # $1 file # $2 device # function insert_device { typeset file=$1 typeset device=$2 if [[ -z $file ]]; then return 1 fi # # Make sure insert device succeed within 60 seconds # typeset -i i=0 while ((i < 6)); do $SLEEP 10 $LOFIADM -a $file $device -f > /dev/null 2>&1 if (($? == 0)); then return 0 fi ((i += 1)) done return 1 } # # Remove the given lofi device # # $1 device or file # function remove_device { typeset devfile=$1 if [[ -z $devfile ]]; then return 1 fi # # Make sure remove device succeed within 60 seconds # typeset -i i=0 while ((i < 6)); do $SLEEP 10 $LOFIADM -d $devfile -f if (($? == 0)); then return 0 fi ((i += 1)) done return 1 } # # Verify the given devices have expected status in pool # # $1 pool # $2 device # $3 expected status # function verify_device_status { typeset pool=$1 typeset device=$2 typeset expect_stat=$3 if [[ -z $pool || -z $expect_stat || -z $device ]]; then log_note "Usage: verify_device_status " return 1 fi # # 1.5 minute disk status checking, make sure zpool sync disk status. # typeset -i i=0 while ((i < 9)); do $SLEEP 10 typeset str=$($ZPOOL status $pool | $GREP "lofi" | \ $AWK '{print $1 " " $2}') typeset real_stat=${str##*$device } real_stat=$($ECHO $real_stat | $AWK '{print $1}') if [[ "$expect_stat" == "$real_stat" ]]; then return 0 fi ((i += 1)) done log_note "Expected status($expect_stat), " \ "see status($real_stat) for $device" $ZPOOL status -v $pool return 1 } # # Output fma event id to given file, the default output file is $FILE_EVENT_ID # function getfmri { eval typeset output_file=${1:-$FILE_EVENT_ID} # # fmadm faulty output include several sections below # # --------------- ------------------------------------ -------------- --------- # TIME EVENT-ID MSG-ID SEVERITY # --------------- ------------------------------------ -------------- --------- # Aug 31 22:34:19 ec648a9e-0c9f-c495-e176-e38ba212e278 ZFS-8000-D3 Major # Aug 31 19:44:59 d69cdd12-b0cf-62ea-d0a3-8d2e9ebfeb50 ZFS-8000-D3 # Aug 31 19:35:16 7213f0d5-00d4-ea32-ddfc-98cdd683c27e ZFS-8000-D3 # Aug 31 19:29:11 33424bef-a973-4dae-94ef-cb97f2cb0759 ZFS-8000-D3 # Aug 31 17:07:26 74219b66-ead4-6d2b-bbad-bc40547ca02e ZFS-8000-GH # # Fault class : fault.fs.zfs.device # # Description : A ZFS device failed. Refer to http://sun.com/msg/ZFS-8000-D3 for # more information. # # Response : No automated response will occur. # # Impact : Fault tolerance of the pool may be compromised. # # Action : Run 'zpool status -x' and replace the bad device. # $FMADM faulty | $NAWK ' BEGIN { start = 0 } /^---/ && /---$/ { if (start == 0) { start = 1 } } /^TIME/ && /SEVERITY$/ { if (start == 1) { start = 2 } } /^---/ && /---$/ { if (start == 2) { start = 3 continue } } /^$/ { start = 0 } (start == 3) {print $4}' > $output_file } # # Verify if ZFS FMA faulty error message are generated. # # $1 TRUE or FALSE # function fma_faulty { # # 1.5 minute for FMA faulty checking, make sure FMA sync with ZFS status # typeset expect=${1:-TRUE} typeset -i fsize typeset -i i=0 while ((i < 9)); do $SLEEP 10 # # try to get fma faulty # getfmri $FILE_EVENT_ID fsize=$($LS -ld $FILE_EVENT_ID | $AWK '{print $5}') case $expect in TRUE) if (( fsize != 0 )); then return 0 fi ;; FALSE) if (( fsize == 0 )); then return 0 fi ;; *) return 1 esac ((i += 1)) done return 1 } # # Create fresh file # # $1 file size # $2 file name # function create_file { typeset size=$1 typeset file=$2 if [[ -z $size || -z $file ]]; then log_note "Usage: create_file " return 1 fi if [[ -f $file ]]; then $RM -f $file fi $MKFILE $size $file return $? } # # Unmount all filesystem, and disable syseventd and fmd piror to # unloading ZFS module # function unload_zfs { # destroy /dev/zvol link log_must $ZFS volfini log_must $ZFS unmount -f -a log_must $SVCADM disable -t sysevent fmd $SLEEP 10 # # 1 minute for ZFS module unload checking # # For example: # # 192 fffffffff7c92000 99858 182 1 zfs (ZFS storage pool version 6) # typeset -i i=0 while ((i < 10)); do typeset id=$($MODINFO | $GREP "ZFS storage" | $AWK '{print $1}') if [[ -n $id ]]; then $MODUNLOAD -i $id if (($? == 0)) ; then return 0 fi else return 0 fi $SLEEP 6 ((i += 1)) done return 1 } # # Load ZFS module and remount all filesystem # function load_zfs { typeset -i ret=0 $SVCADM enable sysevent fmd ((ret |= $?)) $SLEEP 10 $ZFS mount -a ((ret |= $?)) # create /dev/zvol link $ZFS volinit ((ret |= $?)) return $ret } # # Convert file name to device name or reverse. # # $1-n lofi files or devices # function convert_lofi { typeset n list for n in "$@"; do typeset item=$($LOFIADM $n) list="$list $item" shift done $ECHO $list } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg (revision 329035) @@ -1,57 +1,58 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)hotspare.cfg 1.4 08/02/27 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib export DISK_ARRAY_NUM=0 export DISKSARRAY="" # # Variables for hotspare_detach_001 # export STF_TIMEOUT=3600 set_disks export FILESIZE="100m" export FILESIZE1="150m" export SIZE="100m" export SIZE1="80m" export N_DEVARRAY_FILES=8 export HOLES_FILESIZE=${HOLES_FILESIZE-"67108864"} # 64 Mb export HOLES_BLKSIZE=${HOLES_BLKSIZE-"512"} export HOLES_SEED=${HOLES_SEED-""} export HOLES_FILEOFFSET=${HOLES_FILEOFFSET-""} export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8 export HOLES_VERBOSE=${HOLES_VERBOSE-""} export MYTESTFILE=$STF_SUITE/include/default.cfg export TESTFILE=testfile.${TESTCASE_ID} export HOTSPARE_TMPDIR="$TMPDIR/hotspare_tmpdir" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.kshlib (revision 329035) @@ -1,125 +1,126 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)hotspare.kshlib 1.6 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cli_root/zpool_add/zpool_add.kshlib function cleanup_devices_all { $RM -f ${devarray[*]} [ -d "$HOTSPARE_TMPDIR" ] && rmdir $HOTSPARE_TMPDIR return 0 } typeset -a pooldevs typeset -a sparedevs typeset -a logdevs typeset -a keywords=("" "mirror" "raidz" "raidz2") typeset -a devarray function set_devs { mkdir $HOTSPARE_TMPDIR typeset -i i=0 while (( i < $N_DEVARRAY_FILES )) ; do eval devarray[$i]=$HOTSPARE_TMPDIR/file.$i log_must create_vdevs ${devarray[$i]} (( i = i + 1 )) done sparedevs=("${devarray[0]}" "${devarray[1]}") pooldevs=("${devarray[3]}" "${devarray[4]}" "${devarray[5]}") if verify_slog_support ; then logdevs="${devarray[7]}" fi } function partition_cleanup { cleanup_devices_all return 0 } # # $1: keyword, should be "" "mirror" "raidz" "raidz2" # $2: hotspare list, default as $sparedevs # function setup_hotspares # keyword, spares { typeset keyword=$1 shift typeset spares=${@:-${sparedevs[@]}} create_pool "$TESTPOOL" "$keyword" \ ${pooldevs[@]} log_must poolexists "$TESTPOOL" log_must $ZPOOL set autoreplace=on "$TESTPOOL" log_must $ZPOOL add -f "$TESTPOOL" spare $spares log_must iscontained "$TESTPOOL" "$spares" if [[ -n ${logdevs[@]} ]] ; then log_must $ZPOOL add -f "$TESTPOOL" log ${logdevs[@]} log_must iscontained "$TESTPOOL" "${logdevs[@]}" fi } # # $1: the function name that run for all hotspares # $2: hotspare list, default as $sparedevs # function iterate_over_hotspares # function, spares { typeset function=$1 typeset spares=${2:-${sparedevs[@]}} for spare in $spares do $function $spare done } wait_until_resilvered() { typeset -i i=0 typeset -i timeout=60 while [[ $i -lt $timeout ]]; do if is_pool_resilvered $TESTPOOL; then break fi (( i += 1 )) if [[ $i == $timeout ]]; then $ZPOOL status $TESTPOOL log_fail "Pool didn't resilver in ${timeout} seconds" fi $SLEEP 1 done } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config001.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config001.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config001.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config001.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR - TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config002.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config002.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config002.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config002.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config003.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config003.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config003.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config003.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR default TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config004.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config004.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config004.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config004.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config005.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config005.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config005.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config005.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config006.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config006.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config006.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config006.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR - TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config007.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config007.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config007.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config007.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config008.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config008.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config008.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config008.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR default TESTPOOL/TESTCTR/TESTFS1 FS default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config009.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config009.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config009.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config009.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR default TESTPOOL/TESTCTR/TESTFS1 FS default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config010.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config010.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config010.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config010.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR default TESTPOOL/TESTCTR/TESTFS1 FS default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config011.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config011.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config011.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config011.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR default TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config012.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config012.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config012.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config012.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR default TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config013.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config013.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config013.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config013.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config014.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config014.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config014.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config014.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config015.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config015.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config015.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config015.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config016.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config016.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config016.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config016.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL default TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config017.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config017.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config017.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config017.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config018.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config018.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config018.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config018.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config019.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config019.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config019.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config019.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR - TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config020.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config020.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config020.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config020.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR - TESTPOOL/TESTCTR/TESTFS1 FS - Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config021.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config021.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config021.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config021.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR - TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config022.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config022.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config022.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config022.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR - TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config023.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config023.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config023.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config023.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config024.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config024.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/config024.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)config024.cfg 1.2 07/01/09 SMI" # TESTPOOL POOL local TESTPOOL/TESTCTR CTR local TESTPOOL/TESTCTR/TESTFS1 FS local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/inherit.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/inherit.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/inherit.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)inherit.cfg 1.3 08/08/15 SMI" # export ZFSROOT= export STF_TIMEOUT=2800 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/inherit.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/inherit.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/inherit.kshlib (revision 329035) @@ -1,112 +1,113 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)inherit.kshlib 1.3 09/05/19 SMI" # # # Simple function to get the source of the specified property. # If unable to get the property then exits. # function get_prop_src # property dataset { typeset prop_val typeset prop=$1 typeset dataset=$2 prop_val=`$ZFS get -H -o source $prop $dataset` if [[ $? -ne 0 ]]; then log_fail "Unable to determine the source of $prop " \ "property for dataset $dataset" else print $prop_val fi } # # Function to check the 'source' of a property. The source can # either be "default", "local", or "inherited from ". # # The 'expected src' argument must be either "default", "local", or # a dataset name. # # Returns 0 on success, 1 on failure. # function verify_prop_src # child_dataset property expected_src { typeset target=$1 typeset prop=$2 typeset expected=$3 prop_src=`get_prop_src $prop $target` # # Rather than just checking if $prop_src == $expected # we first determine what value $expected should have. # This allows us to catch the case where a property # has a source of "local" but we expected it to be # "default" # if [[ $expected == "default" ]]; then if [[ $prop_src != $expected ]]; then log_note "Property $prop of $target has source"\ " $prop_src rather than $expected" return 1 fi elif [[ $expected == "local" ]]; then if [[ $prop_src != $expected ]]; then log_note "Property $prop of $target has source"\ " $prop_src rather than $expected" return 1 fi elif [[ $prop_src != "inherited from $expected" ]]; then log_note "Property $prop of $expected has source $prop_src"\ " rather than 'inherited from $expected'" return 1 fi return 0 } # # Simple function to set a property to a # specified value and verify it has changed # correctly. # function set_n_verify_prop #property value dataset { typeset prop=$1 typeset prop_val=$2 typeset dataset=$3 $ZFS set $prop=$prop_val $dataset check_val=`get_prop $prop $dataset` if [[ $check_val != $prop_val ]]; then log_fail "Property $prop of $dataset has value $check_val"\ " rather than $prop_val" fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state001.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state001.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state001.cfg (revision 329035) @@ -1,41 +1,42 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state001.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that the property that was set on the top level pool # via the 'local' keyword (in the config1.cfg file) has correctly # propogated down the hierarchy. # # *** ASSERTION DESCRIPTION *** # -:- # local local TESTPOOL TESTPOOL TESTPOOL TESTPOOL Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state002.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state002.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state002.cfg (revision 329035) @@ -1,42 +1,43 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state002.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that the property that was set on the middle level # dataset via the 'local' keyword (in the configX.cfg file) has # correctly propogated down the hierarchy to the filesystem underneath, # while leaving the top level pools properties unchanged. # # *** ASSERTION DESCRIPTION *** # -:- # default default local local TESTPOOL/TESTCTR TESTPOOL/TESTCTR Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state003.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state003.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state003.cfg (revision 329035) @@ -1,40 +1,41 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state003.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that setting the filesystem's properties does not affect # the properties of datasets above it in the hierarchy. # # *** ASSERTION DESCRIPTION *** # -:- # default default default default local local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state004.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state004.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state004.cfg (revision 329035) @@ -1,41 +1,42 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state004.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that setting a property on a middle level dataset does # not prevent us from setting a property on the bottom level filesystem, # and that neither affects the top level pools properties. # # *** ASSERTION DESCRIPTION *** # -:- # default default local local local local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state005.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state005.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state005.cfg (revision 329035) @@ -1,42 +1,43 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state005.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that when we set a property on a top level pool, followed # by a middle level dataset, that the bottom level filesystem inherits # the property from the middle level dataset, and not from the top level # pool. # # *** ASSERTION DESCRIPTION *** # -:- # local local local local TESTPOOL/TESTCTR TESTPOOL/TESTCTR Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state006.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state006.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state006.cfg (revision 329035) @@ -1,44 +1,45 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state006.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that when we set a property on a top level pool, followed # by a bottom level filesystem, that the middle level dataset inherits # the property from the top level pool, and not from the bottom level # filesystem. # # *** ASSERTION DESCRIPTION *** # -:- # # # local local TESTPOOL TESTPOOL local local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state007.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state007.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state007.cfg (revision 329035) @@ -1,42 +1,43 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state007.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that when we can set properties on each level of the # hierarchy independently. # # *** ASSERTION DESCRIPTION *** # -:- # # # local local local local local local Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state008.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state008.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state008.cfg (revision 329035) @@ -1,41 +1,42 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state008.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # No command is actually run (hence '-:-') but rather this state file is # used to verify that when we create a dataset hierarchy that the # properties of each dataset have their default values. # # *** ASSERTION DESCRIPTION *** # -:- # # default default default default default default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state009.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state009.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state009.cfg (revision 329035) @@ -1,54 +1,55 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state009.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' at different levels of a # data hierarchy where the properties of each dataset have their # default values leaves the values unchanged. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit # default default default default default default # TESTPOOL/TESTCTR:inherit # default default default default default default # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state010.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state010.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state010.cfg (revision 329035) @@ -1,53 +1,54 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state010.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit -r' at different levels of a # data hierarchy where the properties of each dataset have their # default values leaves the values unchanged. # # *** ASSERTION DESCRIPTION *** # TESTPOOL:inherit -r # default default default default default default # TESTPOOL/TESTCTR:inherit -r # default default default default default default # TESTPOOL/TESTCTR/TESTFS1:inherit -r # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state011.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state011.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state011.cfg (revision 329035) @@ -1,55 +1,56 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state011.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that running 'zfs inherit' at each level of the data hierarchy # when the bottom filesystem level properties have been set locally has # no effect except at the bottom level where the property values are # inherited from the middle level dataset. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit # default default default default local local # TESTPOOL/TESTCTR:inherit # default default default default local local # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default local default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state012.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state012.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state012.cfg (revision 329035) @@ -1,59 +1,60 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state012.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that running 'zfs inherit -r' at each level of the data hierarchy # when the bottom filesystem level properties have been set locally results # in the top level property values being propogated down the data # hierarchy. # # Executing inherit -r at the middle level and bottom levels after # running it at the top level is somewhat redundant as the top level value # should propogate down the entire data hierarchy. Done for completeness # sake. # # *** ASSERTION DESCRIPTION *** # TESTPOOL:inherit -r # default default default default local default # TESTPOOL/TESTCTR:inherit -r # default default default default default default # TESTPOOL/TESTCTR/TESTFS1:inherit -r # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state013.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state013.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state013.cfg (revision 329035) @@ -1,53 +1,54 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state013.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' on each level when the middle # and bottom levels properties are set locally results in the middle and # bottom levels inheriting values from the next level up in the hierarchy. # # *** ASSERTION DESCRIPTION *** # TESTPOOL:inherit # default default local local local local # TESTPOOL/TESTCTR:inherit # default default local default local local # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default local default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state014.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state014.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state014.cfg (revision 329035) @@ -1,59 +1,60 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state014.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that running 'zfs inherit -r' at each level of the data hierarchy # when the bottom and middle level properties have been set locally results # in the top level property values being propogated down the data # hierarchy. # # Note : executing inherit -r at the middle level and bottom levels after # running it at the top level is somewhat redundant as the top level value # should propogate down the entire data hierarchy. Done for completeness # sake. # # *** ASSERTION DESCRIPTION *** # TESTPOOL:inherit -r # default default local default local default # TESTPOOL/TESTCTR:inherit -r # default default default default default default # TESTPOOL/TESTCTR/TESTFS1:inherit -r # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state015.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state015.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state015.cfg (revision 329035) @@ -1,63 +1,64 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state015.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' at the top level in the hierarchy # when the middle level properties are set locally, and the bottom # level has inherited its value from the middle level, results in no change # to the top level properties. # # Executing 'zfs inherit' at the middle level results in the middle level # inheriting its value from the top level, and passing the values down to # the bottom level. # # Executing 'zfs inherit' at the bottom level is somewhat redundant but # is done for completness sake. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit # default default local local TESTPOOL/TESTCTR TESTPOOL/TESTCTR # # TESTPOOL/TESTCTR:inherit # default default local default TESTPOOL/TESTCTR default # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default default default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state016.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state016.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state016.cfg (revision 329035) @@ -1,59 +1,60 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state016.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit -r' at the top level in the hierarchy # when the middle level properties are set locally, and the bottom # level has inherited its value from the middle level, results in no change # to the top level properties and the middle and bottom properties changing # to the top level (default) values. # # Executing 'zfs inherit -r' at the bottom and middle levels after executing # at the top level is somewhat redundant but ss done for completness sake. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit -r # default default local default TESTPOOL default # TESTPOOL/TESTCTR:inherit -r # default default default default default default # TESTPOOL/TESTCTR/TESTFS1:inherit -r # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state017.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state017.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state017.cfg (revision 329035) @@ -1,64 +1,65 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state017.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' at the top level in the hierarchy # when the top level and middle level datasets properties are set locally, # and the bottom level has inherited its properties from the middle # level, results in the top level properties reverting back to their # default values. # # Executing 'zfs inherit' at the middle level results in the middle level # inheriting its value from the top level (which is now default), and passing # the values down to the bottom level. # # Executing 'zfs inherit' at the bottom level is somewhat redundant but # is done for completness sake. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit # local default local local TESTPOOL/TESTCTR TESTPOOL/TESTCTR # # TESTPOOL/TESTCTR:inherit # default default local default TESTPOOL/TESTCTR default # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default default default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state018.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state018.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state018.cfg (revision 329035) @@ -1,61 +1,62 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state018.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit -r' at the top level in the hierarchy # when the top level and middle level datasets properties are set locally, # and the bottom level has inherited its properties from the middle # level, results in the top level properties reverting back to their # default values and being propogated down to the other datasets in the # hierarchy. # # Executing 'zfs inherit -r' at the middle and bottom levels after executing # it at the top level is somewhat redundant but is done for completness sake. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit -r # local default local default TESTPOOL/TESTCTR default # # TESTPOOL/TESTCTR:inherit -r # default default default default default default # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default default default Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state019.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state019.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state019.cfg (revision 329035) @@ -1,60 +1,61 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state019.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' at the top level in the hierarchy # when the top level properties are set locally and the middle and bottom # datasets have inherited from the top level, results in the top level # properties reverting back to their default values, the middle and bottom # levels inheriting the changed values. # # Executing 'zfs inherit' at the middle and bottom levels is somewhat # redundant but is done for completness sake. # # *** ASSERTION DESCRIPTION *** # TESTPOOL:inherit # local default TESTPOOL default TESTPOOL default # # TESTPOOL/TESTCTR:inherit # default default default default default default # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state020.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state020.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state020.cfg (revision 329035) @@ -1,61 +1,62 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state020.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit -r' at the top level in the hierarchy # when the top level properties are set locally and the middle and bottom # datasets have inherited from the top level, results in the top level # properties reverting back to their default values, the middle and bottom # levels inheriting the changed values. # # Executing 'zfs inherit -r' at the middle and bottom levels is somewhat # redundant but is done for completness sake. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit -r # local default TESTPOOL default TESTPOOL default # # TESTPOOL/TESTCTR:inherit -r # default default default default default default # # TESTPOOL/TESTCTR/TESTFS1:inherit -r # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state021.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state021.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state021.cfg (revision 329035) @@ -1,61 +1,62 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state021.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' at the top level in the hierarchy # when the top level and bottom level properties are set locally and the # middle dataset has inherited from the top level, results in the top level # properties reverting back to their default values, and the middle level # inheriting the new top level value. # # Executing 'zfs inherit' at the bottom level results in it inheriting # the middle level values. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit # local default TESTPOOL default local local # # TESTPOOL/TESTCTR:inherit # default default default default local local # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default local default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state022.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state022.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state022.cfg (revision 329035) @@ -1,60 +1,61 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state022.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit -r' at the top level in the hierarchy # when the top level and bottom level properties are set locally and the # middle dataset has inherited from the top level, results in the top level # properties reverting back to their default values, the middle and bottom # levels inheriting the changed values. # # Executing 'zfs inherit -r' at the middle and bottom levels is somewhat # redundant but is done for completness sake. # # *** ASSERTION DESCRIPTION *** # TESTPOOL:inherit -r # local default TESTPOOL default local default # # TESTPOOL/TESTCTR:inherit -r # default default default default default default # # TESTPOOL/TESTCTR/TESTFS1:inherit -r # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state023.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state023.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state023.cfg (revision 329035) @@ -1,62 +1,63 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state023.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit' at the top level in the hierarchy # when each levels properties are set locally, results in the top level # properties reverting back to their default values. # # Executing 'zfs inherit' at the middle level results in it inheriting # the top levels (now default) values # # Executing 'zfs inherit' at the bottom level results in it inheriting # the middle levels (now default) values # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit # local default local local local local # # TESTPOOL/TESTCTR:inherit # default default local default local local # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default local default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state024.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state024.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inheritance/state024.cfg (revision 329035) @@ -1,60 +1,61 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)state024.cfg 1.2 07/01/09 SMI" # # *** ASSERTION DESCRIPTION *** # # Verify that executing 'zfs inherit -r' at the top level in the hierarchy # when each levels properties are set locally, results in the top level # properties reverting back to their default values, and the changed # values being propogated down the hierarchy. # # Executing 'zfs inherit -r' at the middle and bottom levels after doing so # at the top level is somewhat redundant but is done for completeness. # # *** ASSERTION DESCRIPTION *** # # TESTPOOL:inherit -r # local default local default local default # # TESTPOOL/TESTCTR:inherit # default default default default default default # # TESTPOOL/TESTCTR/TESTFS1:inherit # default default default default default default # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/interop/interop.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/interop/interop.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/interop/interop.cfg (revision 329035) @@ -1,79 +1,80 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)interop.cfg 1.3 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib set -A disk_array $(find_disks $DISKS) case "${#disk_array[*]}" in 0) DISK_COUNT=0 ;; 1) # We need to repartition the single disk to two slices DISK_COUNT=1 META_DISK0=${disk_array[0]} SINGLE_DISK=$META_DISK0 META_DISK1=$META_DISK0 ZFS_DISK2=$META_DISK0 META_SIDE0=${SINGLE_DISK}s0 META_SIDE1=${SINGLE_DISK}s1 ZFS_SIDE2=${SINGLE_DISK}s3 ;; 2) # We need to repartition the single disk to two slices and allocate # the 2nd disk to ZFS DISK_COUNT=2 META_DISK0=${disk_array[0]} SINGLE_DISK=$META_DISK0 META_DISK1=$META_DISK0 ZFS_DISK2=${disk_array[1]} META_SIDE0=${SINGLE_DISK}s0 META_SIDE1=${SINGLE_DISK}s1 ZFS_SIDE2=${ZFS_DISK2}s0 ;; *) # In this case there are at least enough disks to use. DISK_COUNT=3 META_DISK0=${disk_array[0]} META_DISK1=${disk_array[1]} ZFS_DISK2=${disk_array[2]} META_SIDE0=${META_DISK0}s0 META_SIDE1=${META_DISK1}s0 ZFS_SIDE2=${ZFS_DISK2}s0 ;; esac export DISK_COUNT META_DISK0 META_DISK1 ZFS_DISK2 export META_SIDE0 META_SIDE1 ZFS_SIDE2 SINGLE_DISK export TESTFILE=testfile export FS_SIZE=500m export META_DEVICE_ID=d99 export META_DEVICE_PATH=/dev/md/dsk/$META_DEVICE_ID export FILE_COUNT=20 export FILE_SIZE=$(( 1024 * 1024 )) Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/inuse/inuse.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/inuse/inuse.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/inuse/inuse.cfg (revision 329035) @@ -1,123 +1,124 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)inuse.cfg 1.7 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib verify_disk_count "$DISKS" 2 set -A disk_array $(find_disks $DISKS) case "${#disk_array[@]}" in 2) FS_DISK0=${disk_array[0]} FS_DISK1=${disk_array[1]} FS_DISK2=${disk_array[0]} FS_DISK3=${disk_array[1]} FS_SIDE0=${FS_DISK0}p1 FS_SIDE1=${FS_DISK0}p2 FS_SIDE2=${FS_DISK1}p1 FS_SIDE3=${FS_DISK1}p2 disk0="$FS_SIDE0" disk1="$FS_SIDE1" disk2="$FS_SIDE2" disk3="$FS_SIDE3" disktargets="$disk0 $disk2" rawdisk0="$FS_SIDE0" rawdisk1="$FS_SIDE1" rawdisk2="$FS_SIDE2" rawdisk3="$FS_SIDE3" rawtargets="$rawdisk0 $rawdisk2" vdisks="$FS_DISK0" sdisks="$FS_DISK1" vslices="$FS_SIDE0 $FS_SIDE1 $FS_SIDE2" sslices="$FS_SIDE3" ;; 3) FS_DISK0=${disk_array[0]} FS_DISK1=${disk_array[1]} FS_DISK2=${disk_array[2]} FS_DISK3=${disk_array[0]} FS_SIDE0=${FS_DISK0}p1 FS_SIDE1=${FS_DISK0}p2 FS_SIDE2=${FS_DISK1}p1 FS_SIDE3=${FS_DISK2}p1 disk0="$FS_SIDE0" disk1="$FS_SIDE1" disk2="$FS_SIDE2" disk3="$FS_SIDE3" disktargets="$disk0 $disk2 $disk3" rawdisk0="$FS_SIDE0" rawdisk1="$FS_SIDE1" rawdisk2="$FS_SIDE2" rawdisk3="$FS_SIDE3" rawtargets="$rawdisk0 $rawdisk2 $rawdisk3" vdisks="$FS_DISK0 $FS_DISK1" sdisks="$FS_DISK2" vslices="$FS_SIDE0 $FS_SIDE2 $FS_SIDE3" sslices="$FS_SIDE1" ;; *) FS_DISK0=${disk_array[0]} FS_DISK1=${disk_array[1]} FS_DISK2=${disk_array[2]} FS_DISK3=${disk_array[3]} FS_SIDE0=${FS_DISK0}p1 FS_SIDE1=${FS_DISK1}p1 FS_SIDE2=${FS_DISK2}p1 FS_SIDE3=${FS_DISK3}p1 disk0="$FS_SIDE0" disk1="$FS_SIDE1" disk2="$FS_SIDE2" disk3="$FS_SIDE3" disktargets="$disk0 $disk1 $disk2 $disk3" rawdisk0="$FS_SIDE0" rawdisk1="$FS_SIDE1" rawdisk2="$FS_SIDE2" rawdisk3="$FS_SIDE3" rawtargets="$rawdisk0 $rawdisk1 $rawdisk2 $rawdisk3" vdisks="$FS_DISK0 $FS_DISK1 $FS_DISK2" sdisks="$FS_DISK3" vslices="$FS_SIDE0 $FS_SIDE1 $FS_SIDE2" sslices="$FS_SIDE3" ;; esac export FS_DISK0 FS_DISK1 FS_DISK2 FS_DISK3 SINGLE_DISK export FS_SIDE0 FS_SIDE1 FS_SIDE2 FS_SIDE3 export disk0 disk1 disk2 disk3 disktargets export rawdisk0 rawdisk1 rawdisk2 rawdisk3 rawtargets export vdisks sdisks vslices sslices export UFSMP=$TESTDIR/testinuseufsdump export FS_SIZE=1g export PREVDUMPDEV="" export PIDUFSDUMP="" export PIDUFSRESTORE="" # size of block to be written to test file - currently 1mb export BLOCK_SIZE=$(( 1024 * 1024 )) # number of blocks to write == size of file export BLOCK_COUNT=100 export STF_TIMEOUT=1200 # 20 minutes max. Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/iscsi/iscsi.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/iscsi/iscsi.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/iscsi/iscsi.cfg (revision 329035) @@ -1,31 +1,32 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)iscsi.cfg 1.3 08/08/15 SMI" # export TESTVOL=testvol${TESTCASE_ID} export VOLSIZE=512m export TESTVOL1=testvol1${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/iscsi/iscsi_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/iscsi/iscsi_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/iscsi/iscsi_common.kshlib (revision 329035) @@ -1,84 +1,85 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)iscsi_common.kshlib 1.2 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # Check if a volume is a valide iscsi target # $1 volume name # return 0 if suceeds, otherwise, return 1 # function is_iscsi_target { typeset dataset=$1 typeset target targets [[ -z $dataset ]] && return 1 targets=$($ISCSITADM list target | $GREP "Target:" | $AWK '{print $2}') [[ -z $targets ]] && return 1 for target in $targets; do [[ $dataset == $target ]] && return 0 done return 1 } # # Get the iSCSI name of a target # $1 target name # function iscsi_name { typeset target=$1 typeset name [[ -z $target ]] && log_fail "No parameter." if ! is_iscsi_target $target ; then log_fail "Not a target." fi name=$($ISCSITADM list target $target | $GREP "iSCSI Name:" \ | $AWK '{print $2}') return $name } # # Check shareiscsi option is supported or not # return 0 if it is supported, otherwise return 1 # function check_shareiscsi { $ZFS set 2>&1 | $GREP shareiscsi [[ $? -ne 0 ]] && return 1 return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/large_files/large_files.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/large_files/large_files.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/large_files/large_files.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)large_files.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/largest_pool/largest_pool.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/largest_pool/largest_pool.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/largest_pool/largest_pool.cfg (revision 329035) @@ -1,42 +1,43 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)largest_pool.cfg 1.3 08/08/15 SMI" # export TESTVOL=testvol${TESTCASE_ID} export STF_TIMEOUT=1800 export VOL_PATH=/dev/zvol/dsk/${TESTPOOL2}/$TESTVOL export VOLSIZES=${VOLSIZES-"2pb 5pb 10pb 2eb 5eb 8eb 9eb"} # There're 3 different prompt messages while create # a volume that great than 1TB on 32-bit # - volume size exceeds limit for this system. (happy gate) # - max volume size is 1TB on 32-bit systems (s10u2) # - value is too large (old) export VOL_LIMIT_KEYWORD1="1TB on 32-bit" export VOL_LIMIT_KEYWORD2="value is too large" export VOL_LIMIT_KEYWORD3="volume size exceeds limit" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/link_count/link_count.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/link_count/link_count.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/link_count/link_count.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)link_count.cfg 1.3 08/08/15 SMI" # export ITERS=10 export NUMFILES=10000 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/mdb/mdb.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/mdb/mdb.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mdb/mdb.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)mdb.cfg 1.3 08/08/15 SMI" # export OUTFILE="mdb.out.${TESTCASE_ID}" export STF_TIMEOUT=1800 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/migration/migration.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/migration/migration.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/migration/migration.cfg (revision 329035) @@ -1,64 +1,65 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)migration.cfg 1.3 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib set -A disk_array $(find_disks $DISKS) case "${#disk_array[*]}" in 0) DISK_COUNT=0 ;; 1) # We need to repartition the single disk to two partitions. DISK_COUNT=1 ZFS_DISK=${disk_array[0]} SINGLE_DISK=$ZFS_DISK NONZFS_DISK=$ZFS_DISK ZFSSIDE_DISK=${SINGLE_DISK}p1 NONZFSSIDE_DISK=${SINGLE_DISK}p2 ;; *) # In this case there are at least enough disks to use. DISK_COUNT=2 ZFS_DISK=${disk_array[0]} NONZFS_DISK=${disk_array[1]} ZFSSIDE_DISK=${ZFS_DISK}p1 NONZFSSIDE_DISK=${NONZFS_DISK}p1 ;; esac export DISK_COUNT ZFS_DISK NONZFS_DISK SINGLE_DISK ZFSSIDE_DISK NONZFSSIDE_DISK export TESTFILE=/etc/passwd export NONZFS_TESTDIR=$TESTDIR/nonzfstestdir${TESTCASE_ID} tmp=`$SUM $TESTFILE` export SUMA=`$ECHO $tmp | $AWK '{print $1}'` export SUMB=`$ECHO $tmp | $AWK '{print $2}'` export FS_SIZE=1g export BNAME=`$BASENAME $TESTFILE` export DNAME=`$DIRNAME $TESTFILE` Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/migration/migration.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/migration/migration.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/migration/migration.kshlib (revision 329035) @@ -1,149 +1,150 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)migration.kshlib 1.2 07/01/09 SMI" # # # This function creates the test archive for migration. # # Usage: # prepare srcdir cmd # # Return value: 0 on success # 1 on failure # # Where: # srcdir: is the directory where the testfile is # cmd: is the command to be executed. # E.g. # $TAR cf $TESTDIR/tar${TESTCASE_ID}.tar # function prepare #srcdir cmd { typeset srcdir=$1 typeset cmd=$2 typeset -i retval=0 cwd=$PWD cd $srcdir (( $? != 0 )) && return 1 $cmd (( $? != 0 )) && return 1 cd $cwd (( $? != 0 )) && return 1 return 0 } # # This function executes a passed in command and then determines the chksum # of the resulting file. The chksum components are checked against the ones # passed in to determine if they are equal. If they are equal, 0 is returned # otherwise 1 is returned. # # Usage: # migrate destdir oldsuma oldsumb command_to_execute # # Return value: 0 on success # 1 on failure # # Where: # destdir: is the directory where the command is to be executed on # oldsuma: is the first part of the values returned by sum # oldsumb: is the second part of the values returned by sum # cmd: is the command to be executed; # E.g. # "$TAR xf $TESTDIR/tar${TESTCASE_ID}.tar" # function migrate #destdir oldsuma oldsumb cmd { typeset destdir=$1 typeset oldsuma=$2 typeset oldsumb=$3 typeset cmd=$4 typeset -i retval=0 cwd=$PWD cd $destdir (( $? != 0 )) && return 1 $cmd (( $? != 0 )) && return 1 sumy=`$SUM ./$BNAME` suma=`$ECHO $sumy | $AWK '{print $1}'` sumb=`$ECHO $sumy | $AWK '{print $2}'` if (( $oldsuma != $suma )); then log_note "$SUM values are not the same" retval=1 fi if (( $oldsumb != $sumb )); then log_note "$SUM values are not the same" retval=1 fi cd $cwd (( $? != 0 )) && return 1 return $retval } function migrate_cpio { typeset destdir=$1 typeset archive=$2 typeset oldsuma=$3 typeset oldsumb=$4 typeset -i retval=0 cwd=$PWD cd $destdir (( $? != 0 )) && return 1 $CPIO -iv < $archive (( $? != 0 )) && return 1 sumy=`$SUM ./$BNAME` suma=`$ECHO $sumy | $AWK '{print $1}'` sumb=`$ECHO $sumy | $AWK '{print $2}'` if (( $oldsuma != $suma )); then log_note "$SUM values are not the same" retval=1 fi if (( $oldsumb != $sumb )); then log_note "$SUM values are not the same" retval=1 fi cd $cwd (( $? != 0 )) && return 1 return $retval } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_read/mmap_read.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)mmap_read.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/mmap_write.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/mmap_write.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mmap/mmap_write/mmap_write.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)mmap_write.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/mount/vars.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/mount/vars.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mount/vars.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)vars.cfg 1.4 08/08/15 SMI" # export FS_CNT=3 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/mv_files/mv_files.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/mv_files/mv_files.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mv_files/mv_files.cfg (revision 329035) @@ -1,43 +1,44 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)mv_files.cfg 1.3 08/08/15 SMI" # export DISK=${DISKS%% *} export TESTFILE=testfile${TESTCASE_ID} export TESTDIR_TGT=${TEST_BASE_DIR%%/}/testdir_tgt${TESTCASE_ID} export TESTFS_TGT=testzfs_tgt${TESTCASE_ID} export OLDDIR=$TESTDIR/olddir${TESTCASE_ID} export NEWDIR_IN_FS=$TESTDIR/newdir${TESTCASE_ID} export NEWDIR_ACROSS_FS=$TESTDIR_TGT/newdir${TESTCASE_ID} export MVNUMFILES=2000 # export MVNUMINCR=1000 # export GANGPIDS=50 # export STF_TIMEOUT=1200 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/mv_files/mv_files_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/mv_files/mv_files_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/mv_files/mv_files_common.kshlib (revision 329035) @@ -1,213 +1,214 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)mv_files_common.kshlib 1.5 09/06/22 SMI" # # # Determine whether this version of the ksh being # executed has a bug where the limit of background # processes of 25. # function check_bg_procs_limit_num { $ECHO "#!/usr/local/bin/ksh93" > $TMPDIR/exitsZero.ksh $ECHO "exit 0" >> $TMPDIR/exitsZero.ksh $CHMOD 777 $TMPDIR/exitsZero.ksh $CAT < $TMPDIR/testbackgprocs.ksh #!/usr/local/bin/ksh93 # # exitsZero.ksh is a one line script # that exit with status of "0" # PIDS="" typeset -i i=1 while [ \$i -le 50 ] do $TMPDIR/exitsZero.ksh & PIDS="\$PIDS \$!" (( i = i + 1 )) done \$SLEEP 1 for pid in \$PIDS do \$WAIT \$pid (( \$? == 127 )) && exit 1 done exit 0 EOF $KSH93 $TMPDIR/testbackgprocs.ksh if [[ $? -eq 1 ]]; then # # Current ksh being executed has a limit # of 25 background processes. # return 1 else return 0 fi } function init_setup { typeset disklist=$1 create_pool $TESTPOOL "$disklist" if ! is_global_zone ; then reexport_pool fi $RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR $MKDIR -p $TESTDIR || log_unresolved Could not create $TESTDIR $RM -rf $TESTDIR_TGT || log_unresolved Could not remove $TESTDIR_TGT $MKDIR -p $TESTDIR_TGT || log_unresolved Could not create $TESTDIR_TGT log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS log_must $ZFS create $TESTPOOL/$TESTFS_TGT log_must $ZFS set mountpoint=$TESTDIR_TGT $TESTPOOL/$TESTFS_TGT $MKDIR -p $OLDDIR || log_unresolved Could not create $OLDDIR $MKDIR -p $NEWDIR_IN_FS || log_unresolved Could not create $NEWDIR_IN_FS $MKDIR -p $NEWDIR_ACROSS_FS || log_unresolved Could not create $NEWDIR_ACROSS_FS } function wait_pid { for pid in $1 do $PS -e | $GREP $pid >/dev/null 2>&1 (( $? == 0 )) && $WAIT $pid done } # # Generate given number files in a # directory of zfs file system # $1 - the directory holds the generated files # $2 - number of to-be-generated files # function generate_files { typeset -i count typeset -i proc_num=0 if (( $2 == $MVNUMFILES )); then count=1 else count=$MVNUMFILES+1 fi while (( count <= $2 )) do $CP /etc/passwd $1/file_$count \ > /dev/null 2>&1 & PIDS="$PIDS $!" proc_num=`$ECHO $PIDS | $WC -w` if (( proc_num >= GANGPIDS )); then wait_pid "$PIDS" proc_num=0 PIDS="" fi (( count = count + 1 )) done } # # Move given number files from one directory to # another directory in parallel # $1 - source directory # $2 - target directory # function mv_files { $FIND $1 -type f -print | xargs -J % \ $MV % $2 > /dev/null 2>&1 } # # Count the files number after moving, and # compare it with the original number # $1 - directory that to be operated # $2 - original files number # function count_files { typeset -i file_num file_num=`$FIND $1 -type f -print | \ wc -l` (( file_num != $2 )) && \ log_fail "The file number of target directory"\ "$2 is not equal to that of the source "\ "directory $1" } # # Running the 'mv' test # $1 - old directory # $2 - new directory # function mv_test { typeset old=$1 typeset new=$2 typeset -i inc_num=$(( MVNUMFILES + MVNUMINCR )) typeset -i num=0 for num in $MVNUMFILES $inc_num do generate_files $old $num mv_files $old $new count_files $new $num mv_files $new $old count_files $old $num done typeset dir=$(get_device_dir $DISKS) verify_filesys "$TESTPOOL" "$TESTPOOL/$TESTFS" "$dir" return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/nestedfs/nestedfs.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/nestedfs/nestedfs.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/nestedfs/nestedfs.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)nestedfs.cfg 1.3 08/08/15 SMI" # export TESTFILE0=testfile0.${TESTCASE_ID} export TESTFILE1=testfile1.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/no_space/enospc.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/no_space/enospc.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/no_space/enospc.cfg (revision 329035) @@ -1,36 +1,37 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)enospc.cfg 1.3 08/08/15 SMI" # export TESTFILE0=testfile0.${TESTCASE_ID} export TESTFILE1=testfile1.${TESTCASE_ID} export SIZE=100mb export ENOSPC=28 export BLOCKSZ=8192 export NUM_WRITES=65536 export DATA=0 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/online_offline/online_offline.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/online_offline/online_offline.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/online_offline/online_offline.cfg (revision 329035) @@ -1,28 +1,29 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Copyright 2014 Spectra Logic Corporation # Use is subject to license terms. # export TESTFILE=testfile.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/pool_names/pool_names.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/pool_names/pool_names.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/pool_names/pool_names.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)pool_names.cfg 1.3 08/08/15 SMI" # export STF_TIMEOUT=1200 export DISK=${DISKS%% *} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/privilege/privilege.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/privilege/privilege.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/privilege/privilege.cfg (revision 329035) @@ -1,48 +1,49 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)privilege.cfg 1.3 07/03/14 SMI" # # a variable we set during setup to indicate whether we need to # re-enable the nis/client during cleanup. USES_NIS=false # A username we can create for the course of the zfs privileges # testing (modified by setup if it already exists) ZFS_USER=zfsrbac # These variables may also have been tweaked by the setup script # Let's import them if necessary. if [ -f $TMPDIR/zfs-privs-test-nis.txt ]; then USES_NIS=$($CAT $TMPDIR/zfs-privs-test-nis.txt) fi if [ -f $TMPDIR/zfs-privs-test-user.txt ]; then ZFS_USER=$($CAT $TMPDIR/zfs-privs-test-user.txt) fi export ZFS_USER export USES_NIS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/quota/quota.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/quota/quota.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/quota/quota.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)quota.cfg 1.3 08/08/15 SMI" # export BLOCK_SIZE=8192 export QUOTA_VALUE=10000000 export TESTFILE1=file1.${TESTCASE_ID} export TESTFILE2=file2.${TESTCASE_ID} export TOLERANCE=131071 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/quota/quota.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/quota/quota.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/quota/quota.kshlib (revision 329035) @@ -1,85 +1,86 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)quota.kshlib 1.2 07/01/09 SMI" # # BLOCK_SIZE, QUOTA_VALUE and TOLERANCE set in quota.cfg readonly EDQUOT=69 # # Function to fill the quota of a zfs filesystem # # $1 - The File system or container to fill. # $2 - The mountpoint to use. # function fill_quota { typeset FILESYSTEM="$1" typeset MNTPT="$2" log_must $ZFS set quota=$QUOTA_VALUE $FILESYSTEM typeset -i write_size=0 (( write_size = 2 * QUOTA_VALUE )) typeset -i zret=0 $FILE_WRITE -o create -f $MNTPT/$TESTFILE1 -b $BLOCK_SIZE \ -c $write_size -d 0 zret=$? [[ $zret -ne EDQUOT ]] && log_fail "Got error $zret; expected $EDQUOT" typeset -i file_size=`$LS -ls $MNTPT/$TESTFILE1 | $AWK '{ print $1 }'` typeset -i limit=0 (( file_size = file_size * 512 )) (( limit = QUOTA_VALUE + TOLERANCE )) (( file_size > limit )) && \ log_fail "File was created larger than the quota value, aborting!!!" return 0 } # # Function attempts to write another file in a ZFS filesystem # that has already filled its quota # function exceed_quota { typeset FILESYSTEM="$1" typeset MNTPT="$2" log_must fill_quota $FILESYSTEM $MNTPT typeset -i write_size=0 (( write_size = 2 * QUOTA_VALUE )) typeset -i zret=0 # # Writing a file without API to access return code # log_note "Creating a file in a FS that has already exceeded its quota" $FILE_WRITE -o create -f $MNTPT/$TESTFILE2 \ -b $BLOCK_SIZE -c $write_size -d 0 zret=$? [[ $zret -ne EDQUOT ]] && log_fail "Got error $zret; expected $EDQUOT" return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.cfg (revision 329035) @@ -1,40 +1,41 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)redundancy.cfg 1.4 08/08/15 SMI" # export BASEDIR=$TMPDIR/basedir.${TESTCASE_ID} export TESTFILE=testfile.${TESTCASE_ID} export PRE_RECORD_FILE=$BASEDIR/pre-record-file.${TESTCASE_ID} export PST_RECORD_FILE=$BASEDIR/pst-record-file.${TESTCASE_ID} export DEV_SIZE=64M export STF_TIMEOUT=1800 export BLOCKSZ=$(( 1024 * 1024 )) export NUM_WRITES=40 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib (revision 329035) @@ -1,301 +1,302 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)redundancy.kshlib 1.8 09/01/12 SMI" # . ${STF_SUITE}/include/libtest.kshlib function cleanup { # Log the status of the pool to assist failures. poolexists $TESTPOOL && $ZPOOL status -v $TESTPOOL destroy_pool $TESTPOOL typeset dir for dir in $TESTDIR $BASEDIR; do if [[ -d $dir ]]; then log_must $RM -rf $dir fi done } # # Record the directories construction and checksum all the files which reside # within the specified pool # # $1 The specified pool # $2 The file which save the record. # function record_data { typeset pool=$1 typeset recordfile=$2 [[ -z $pool ]] && log_fail "No specified pool." [[ -f $recordfile ]] && log_must $RM -f $recordfile typeset mntpnt mntpnt=$(get_prop mountpoint $pool) log_must eval "$DU -a $mntpnt > $recordfile 2>&1" # # When the data was damaged, checksum is failing and return 1 # So, will not use log_must # $FIND $mntpnt -type f -exec $CKSUM {} + >> $recordfile 2>&1 } # # Create test pool and fill with files and directories. # # $1 pool name # $2 pool type # $3 virtual devices number # function setup_test_env { typeset pool=$1 typeset keyword=$2 typeset -i vdev_cnt=$3 typeset vdevs typeset -i i=0 while (( i < vdev_cnt )); do vdevs="$vdevs $BASEDIR/vdev$i" ((i += 1)) done log_must $MKDIR -p $BASEDIR destroy_pool $pool log_must create_vdevs $vdevs $ECHO $vdevs | tr ' ' '\n' > $BASEDIR/vdevs log_must $ZPOOL create -m $TESTDIR $pool $keyword $vdevs typeset file=$TESTDIR/file log_must $FILE_WRITE -o create -f $file -b $BLOCKSZ -c $NUM_WRITES log_must force_sync_path $TESTDIR record_data $TESTPOOL $PRE_RECORD_FILE } # # Check pool data is valid # # $1 pool # function is_data_valid { typeset pool=$1 record_data $pool $PST_RECORD_FILE if ! $DIFF $PRE_RECORD_FILE $PST_RECORD_FILE > /dev/null 2>&1; then return 1 fi return 0 } # # Get the specified count devices name # # $1 pool name # $2 devices count # function get_vdevs #pool cnt { typeset pool=$1 typeset -i cnt=$2 head -$cnt $BASEDIR/vdevs | tr '\n' ' ' } # # Synchronize all the data in pool # # $1 pool name # function sync_pool #pool { typeset pool=$1 log_must force_sync_path $pool # If the OS has detected corruption on the pool, it will have # automatically initiated a scrub. In that case, our "zpool scrub" # command will fail. So we ignore its exit status and just check that # the pool is scrubbing or has been scrubbed. $ZPOOL scrub $pool >/dev/null 2>&1 is_pool_scrubbing $pool || is_pool_scrubbed $pool || \ log_fail "$ZPOOL scrub $pool failed." log_note "$pool: $ZPOOL scrub issued." } # # Create and replace the same name virtual device files # # $1 pool name # $2-n virtual device files # function replace_missing_devs { typeset pool=$1 shift typeset vdev for vdev in $@; do [ ! -f $vdev ] && log_must create_vdevs $vdev log_must $ZPOOL replace -f $pool $vdev $vdev wait_for 20 1 is_pool_resilvered $pool done } # # Damage the labels of the specified devices. Returns 0 if all such devices # are UNAVAIL, 1 otherwise. # function damage_dev_labels # pool [vdev ...] { typeset pool=$1 typeset -i ret=0 shift for vdev in $*; do check_state $pool $vdev UNAVAIL && continue log_must create_vdevs $vdev ret=1 done [ $ret -eq 0 ] && return $ret sync_pool $pool return $ret } # # Damage the pool's virtual device files. # # $1 pool name # $2 Failing devices count # $3 damage vdevs method, if not null, we keep the label for the vdevs # function damage_devs { typeset pool=$1 typeset -i cnt=$2 typeset label="$3" typeset vdevs typeset -i bs_count vdevs=$(get_vdevs $pool $cnt) log_note "Damaging pool $pool devices: $vdevs" if [[ -n $label ]]; then typeset -i i=0 log_mustnot pool_has_errors $pool while [ $i -lt $cnt ]; do corrupt_file $TESTPOOL /file $i (( i += 1 )) done sync_pool $pool wait_for 20 1 is_pool_scrubbed $pool log_must pool_has_errors $pool else # The pool can be syncing, thus fixing its labels. So we # have to keep trying until all the devices go offline. wait_for 20 1 damage_dev_labels $pool $vdevs fi log_note "Pool $pool vdevs $vdevs damage completed." } # # Clear errors in the pool caused by data corruptions # # $1 pool name # function clear_errors { typeset pool=$1 log_must $ZPOOL clear $pool # The pool may need to resilver (issued async by 'zpool clear'), # give it a chance to do so. wait_for 30 1 is_pool_healthy $pool if ! is_data_valid $pool ; then $ZPOOL status -x $pool log_note "Data should be valid in $pool." return 1 fi return 0 } # # Remove the specified pool's virtual device files # # $1 Pool name # $2 Missing devices count # function remove_devs { typeset pool=$1 typeset -i cnt=$2 typeset vdevs vdevs=$(get_vdevs $pool $cnt) log_note "Removing pool $pool vdevs: $vdevs" log_must $RM -f $vdevs sync_pool $pool for vdev in $vdevs; do wait_for 20 1 check_state $pool $vdev UNAVAIL done } # # Recover the bad or missing device files in the pool # # $1 Pool name # $2 Missing devices count # function recover_bad_missing_devs { typeset pool=$1 typeset -i cnt=$2 typeset vdevs vdevs=$(get_vdevs $pool $cnt) log_note "Replacing missing pool $pool vdevs: $vdevs" replace_missing_devs $pool $vdevs if ! is_pool_healthy $pool ; then log_note "$pool should be healthy." return 1 fi if ! is_data_valid $pool ; then log_note "Data should be valid in $pool." return 1 fi return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/refquota/refquota.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/refquota/refquota.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/refquota/refquota.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)refquota.cfg 1.2 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/refreserv/refreserv.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/refreserv/refreserv.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/refreserv/refreserv.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)refreserv.cfg 1.2 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/cross_endian/cross_endian.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/cross_endian/cross_endian.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/cross_endian/cross_endian.cfg (revision 329035) @@ -1,84 +1,85 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cross_endian.cfg 1.4 08/08/15 SMI" # . ${STF_TOOLS}/contrib/include/logapi.kshlib export TESTSNAP=testsnap.${TESTCASE_ID} export FILESZ=100m export TESTFILE1=testfile1.${TESTCASE_ID} export TESTFILE2=testfile2.${TESTCASE_ID} export TESTFILE3=testfile3.${TESTCASE_ID} export TESTFILE4=testfile4.${TESTCASE_ID} export TESTFILE5=testfile5.${TESTCASE_ID} export TESTFILE6=testfile6.${TESTCASE_ID} export TESTFILE7=testfile7.${TESTCASE_ID} export TESTFILE8=testfile8.${TESTCASE_ID} export NORMALPOOL=poolnormal.${TESTCASE_ID} export MIRRORPOOL=poolmirror.${TESTCASE_ID} export RAIDZPOOL=poolraidz.${TESTCASE_ID} export RAIDZ2POOL=poolraidz2.${TESTCASE_ID} export RTESTPOOL=rtestpool.${TESTCASE_ID} export RTESTFS=rtestfs.${TESTCASE_ID} export RTESTFILE=rtestfile.${TESTCASE_ID} # Among all given remote hosts, we only select one same arch machine and # one of each different arch type machines for testing. TESTHOSTS="" diff_archs="" typeset -i same_found=0 typeset -i diff_found=0 l_arch=`uname -m` for rhost in $RHOSTS; do r_arch=`$RSH -n $rhost "uname -m"` if [[ "$r_arch" != "$l_arch" ]]; then if (( ${#diff_archs} == 0 )); then TESTHOSTS="$TESTHOSTS $rhost" diff_archs=$r_arch continue else diff_found=0 for eacharch in $diff_archs; do if [[ "$r_arch" == "$eacharch" ]]; then diff_found=1 break fi done if (( $diff_found == 0 )); then TESTHOSTS="$TESTHOSTS $rhost" diff_archs="$diff_archs $r_arch" fi fi elif (( $same_found == 0 )); then TESTHOSTS="$TESTHOSTS $rhost" same_found=1 continue fi done export TESTHOSTS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/cross_endian/cross_endian_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/cross_endian/cross_endian_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/cross_endian/cross_endian_common.kshlib (revision 329035) @@ -1,53 +1,54 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)cross_endian_common.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib # # Generate the checksum for each file in # a given directory and store the checksum # in a specified file. # # $1 the diretory path # function gen_cksum_file # { typeset filepath=$1 typeset file typeset cksumfile=$TMPDIR/file_cksum.list [[ -e $cksumfile ]] && $RM -f $cksumfile log_must $TOUCH $cksumfile for file in `$FIND $filepath -type f`; do $ECHO "`$CKSUM $file`" >>$cksumfile done log_must $CP $cksumfile $filepath $RM -f $cksumfile } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/rebooting/rebooting.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/rebooting/rebooting.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/rebooting/rebooting.cfg (revision 329035) @@ -1,38 +1,39 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)rebooting.cfg 1.4 08/08/15 SMI" # . ${STF_TOOLS}/contrib/include/logapi.kshlib export STF_TIMEOUT=2400 export RTESTPOOL=rtestpool.${TESTCASE_ID} export RTESTFS=rtestfs.${TESTCASE_ID} export RTESTDIR=${TEST_BASE_DIR%%/}/rtestdir.${TESTCASE_ID} RHOST=`$ECHO $RHOSTS | $AWK '{print $1}'` export RHOST Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/remote_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/remote_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/remote_common.kshlib (revision 329035) @@ -1,140 +1,141 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)remote_common.kshlib 1.4 07/05/25 SMI" # # # Get the disk value from the $RDISKS variable according # to the hostname # # $1 remote host name # function get_disks # { typeset rhost=$1 typeset eachhost typeset -i i=0 eval set -A disks $RDISKS for eachhost in $RHOSTS; do if [[ "$eachhost" != "$rhost" ]]; then (( i = i + 1 )) continue else break fi done $ECHO ${disks[i]} } # # print an error and exit # $1 exit status # $2... error message # function _err_exit { typeset -i status=$1 shift print -u2 "$@" exit $status } # # Detect the available disks for use in a system # function detectdisks { typeset sfi=$TMPDIR/swaplist.${TESTCASE_ID} typeset msi=$TMPDIR/metastat.${TESTCASE_ID} typeset dmpi=$TMPDIR/dumpdev.${TESTCASE_ID} $SWAP -l > $sfi $METASTAT -c > $msi $DUMPADM > $dmpi # process the output of format # to produce a list of disks we know about. # ------------------- $CAT > $TMPDIR/find_disks.awk </dev/null (( $? == 0 )) && continue $GREP "${disk}[sp]" $sfi >/dev/null (( $? == 0 )) && continue $GREP "${disk}" $msi >/dev/null (( $? == 0 )) && continue $GREP "${disk}[sp]" $dmpi >/dev/null (( $? == 0 )) && continue unused_candidates="$unused_candidates $disk" done $RM $sfi $RM $msi $RM $dmpi # now just check to see if those disks do actually exist # by looking for a device pointing to the first slice in # each case. for disk in $unused_candidates do if [ -b /dev/dsk/${disk}s0 ] then unused="$unused $disk" fi done $ECHO $unused } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/sharing/sharing.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/sharing/sharing.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/remote/sharing/sharing.cfg (revision 329035) @@ -1,47 +1,48 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)sharing.cfg 1.4 08/08/15 SMI" # . ${STF_TOOLS}/contrib/include/logapi.kshlib export NFSMNTPT=${TESTDIR}/nfsmntpt.${TESTCASE_ID} export NFSMNTPT1=${TESTDIR}/nfsmntpt1.${TESTCASE_ID} export NFSMNTPT2=${TESTDIR}/nfsmntpt2.${TESTCASE_ID} # Set variables for remote host export RHOST=`$ECHO $RHOSTS | $AWK '{print $1}'` export RTESTPOOL=rtestpool.${TESTCASE_ID} export RTESTFS=rtestfs.${TESTCASE_ID} export RTESTFS1=rtestfs1.${TESTCASE_ID} export RTESTFS2=rtestfs2.${TESTCASE_ID} export SNAP=snap.${TESTCASE_ID} export SNAP1=snap1.${TESTCASE_ID} export SNAP2=snap2.${TESTCASE_ID} export RTESTDIR=${TEST_BASE_DIR%%/}/rtestdir.${TESTCASE_ID} export RTESTDIR1=${TEST_BASE_DIR%%/}/rtestdir1.${TESTCASE_ID} export RTESTDIR2=${TEST_BASE_DIR%%/}/rtestdir2.${TESTCASE_ID} export SHROPT="rw" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/rename_dirs/rename_dirs.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/rename_dirs/rename_dirs.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/rename_dirs/rename_dirs.cfg (revision 329035) @@ -1,30 +1,31 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)rename_dirs.cfg 1.2 08/08/15 SMI" # export WAITTIME=600 export STF_TIMEOUT=1200 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/replacement/replacement.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/replacement/replacement.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/replacement/replacement.kshlib (revision 329035) @@ -1,48 +1,49 @@ +# vim: filetype=sh # Common routines for replacement tests. function check_vdev_action # [disk2] { typeset action=$1 typeset expect=$2 typeset opt=$3 typeset disk1="$4" typeset disk2="$5" busy_path $TESTDIR $expect $ZPOOL $action $opt $TESTPOOL $disk1 $disk2 reap_children log_must $ZPOOL export $TESTPOOL log_must $ZPOOL import $TESTPOOL log_must $ZFS umount $TESTPOOL/$TESTFS log_must $ZDB -cdui $TESTPOOL/$TESTFS log_must $ZFS mount $TESTPOOL/$TESTFS } function pool_action # { typeset tvd_type=$1 typeset action=$2 typeset actionexpect=$3 typeset existexpect=$4 typeset disk=${disk_array[3]} typeset short=${disk##/dev/} for opt in "" "-f"; do [ "$action" = "detach" -a "$opt" = "-f" ] && continue create_pool $TESTPOOL $tvd_type ${disk_array[@]:0:3} log_must $ZFS create $TESTPOOL/$TESTFS log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS check_vdev_action $action $actionexpect "$opt" \ ${disk_array[0]} $disk $existexpect eval "$ZPOOL iostat -v $TESTPOOL | $GREP -q $short" destroy_pool $TESTPOOL done } function replacement_cleanup { poolexists $TESTPOOL && log_must $ZPOOL status $TESTPOOL reap_children } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/reservation/reservation.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/reservation/reservation.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/reservation/reservation.cfg (revision 329035) @@ -1,44 +1,45 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)reservation.cfg 1.3 08/08/15 SMI" # export RESV_DELTA=5242880 export RESV_TOLERANCE=5242880 # Acceptable limit (5MB) for diff in space stats export RESV_SIZE=52428800 # Default reservation size (50MB) export RESV_FREE_SPACE=52428800 # Amount of space (50MB) to leave free in a pool export RESV_NUM_FS=10 # Number of filesystems to create export RESV_ITER=10 # Number of iterations export VOLSIZE=64M export BLOCK_SIZE=8192 export ENOSPC=28 export ZFSROOT= export TESTVOL=testvol${TESTCASE_ID} export TESTVOL2=testvol2-${TESTCASE_ID} export TESTFILE1=file1.${TESTCASE_ID} export TESTFILE2=file2.${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/reservation/reservation.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/reservation/reservation.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/reservation/reservation.kshlib (revision 329035) @@ -1,177 +1,178 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)reservation.kshlib 1.3 09/01/12 SMI" # # # Function to set the reservation property of a dataset to # 'none' and verify that it is correctly set using both the # "normal" 'zfs get reservation' and the '-p' option which # gives a numerical value. # function zero_reservation { typeset resv_val dataset=$1 log_must $ZFS set reservation=none $dataset log_must $ZFS set refreservation=none $dataset resv_val=`$ZFS get -H refreservation $dataset | awk '{print $3}'` if [[ $? -ne 0 ]]; then log_fail "Unable to get reservation prop on $dataset" elif [[ $resv_val != "none" ]]; then log_fail "Reservation not 'none' ($resv_val) as expected" fi resv_val=`$ZFS get -pH refreservation $dataset | awk '{print $3}'` if [[ $? -ne 0 ]]; then log_fail "Unable to get reservation prop on $dataset" elif [[ $resv_val -ne 0 ]]; then log_fail "Reservation not 0 ($resv_val) as expected" fi return 0 } # # Utility function to see if two values are within a certain specified # limit of each other. Used primarily to check that a dataset's parent # is correctly accounting for space used/available. Need this function as # currently there is some slop in the way space is accounted (i.e. can't # do a direct comparison). # function within_limits { typeset -l valA=$1 typeset -l valB=$2 typeset -l delta=$3 if (( valA <= valB )); then if (( (valB - valA) <= delta )); then return 0 fi elif (( valB <= valA )); then if (( (valA - valB) <= delta )); then return 0 fi fi return 1 } # # Function to create and mount multiple filesystems. The filesystem # will be named according to the name specified with a suffix value # taken from the loop counter. # function create_multiple_fs # num_fs base_fs_name base_mnt_name { typeset -i iter=0 typeset -i count=$1 typeset FS_NAME=$2 typeset MNT_NAME=$3 while (( $iter < $count )); do log_must $ZFS create ${FS_NAME}$iter log_must $ZFS set mountpoint=${MNT_NAME}$iter ${FS_NAME}$iter (( iter = iter + 1 )) done } # # This function compute the largest volume size which is multiple of volume # block size (default 8K) and not greater than the largest expected volsize. # # $1 The largest expected volume size. # $2 The volume block size # function floor_volsize # [volblksize] { typeset -l largest_volsize=$1 typeset -l volblksize=${2:-8192} if (( largest_volsize < volblksize )); then log_fail "The largest_volsize must be greater than volblksize." fi typeset -l real_volsize typeset -l n (( n = largest_volsize / volblksize )) (( largest_volsize = volblksize * n )) print $largest_volsize } # # Simple function to get the expected reservation for a ZVOL given the # volume size, block size, and number of copies. # # NB: This routine must be kept in sync with the ZFS library function # libzfs_dataset.c:zvol_volsize_to_reservation(). Refer to that function # for the logic behind the calculations. # function zvol_volsize_to_reservation { typeset resv_val typeset nblocks typeset numdb typeset volsize=$1 typeset volblocksize=$2 typeset ncopies=$3 typeset ncopies_bp typeset DN_MAX_INDBLKSHIFT=17 typeset SPA_BLKPTRSHIFT=7 typeset SPA_DVAS_PER_BP=3 typeset DVAS_PER_BP typeset DNODES_PER_LEVEL_SHIFT typeset DNODES_PER_LEVEL typeset DN_MAX_INDBLKS (( DNODES_PER_LEVEL_SHIFT = DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT )) (( DNODES_PER_LEVEL = 1 << DNODES_PER_LEVEL_SHIFT )) (( DN_MAX_INDBLKS = 1 << DN_MAX_INDBLKSHIFT )) resv_val=$volsize (( nblocks = volsize / volblocksize )) numdb=7 while (( nblocks > 1 )); do (( nblocks = nblocks + DNODES_PER_LEVEL - 1 )) (( nblocks = nblocks / DNODES_PER_LEVEL )) (( numdb = numdb + nblocks )) done (( ncopies_bp = ncopies + 1 )) DVAS_PER_BP=$(min $SPA_DVAS_PER_BP $ncopies_bp) (( numdb = numdb * DVAS_PER_BP )) (( resv_val = volsize * ncopies )) (( numdb = numdb * DN_MAX_INDBLKS )) (( resv_val = resv_val + numdb )) $ECHO $resv_val return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/rsend/rsend.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/rsend/rsend.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/rsend/rsend.cfg (revision 329035) @@ -1,40 +1,41 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)rsend.cfg 1.2 08/08/15 SMI" # export BACKDIR=${TEST_BASE_DIR%%/}/backdir${TESTCASE_ID} export DISK1=$($ECHO $DISKS | $AWK '{print $1}') export DISK2=$($ECHO $DISKS | $AWK '{print $2}') export POOL=$TESTPOOL export POOL2=$TESTPOOL1 export FS=$TESTFS export CLONE=testclone.${TESTCASE_ID} export VOL=testvol.${TESTCASE_ID} export STF_TIMEOUT=2700 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/rsend/rsend.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/rsend/rsend.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/rsend/rsend.kshlib (revision 329035) @@ -1,370 +1,371 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)rsend.kshlib 1.3 09/01/12 SMI" # . $STF_SUITE/include/libtest.kshlib # # Set up test model which includes various datasets # # @final # @snapB # @init # | # ______ pclone # | / # |@psnap # || @final # ||@final @final @snapC # ||@snapC @snapC @snapB # ||@snapA @snapB @snapA # ||@init @init @init # ||| | | # $pool -------- $FS ------- fs1 ------- fs2 # \ \\_____ \ | # vol vol \____ \ @fsnap # | | \ \ \ # @init @vsnap | ------------ fclone # @snapA @init \ | | # @final @snapB \ | @init # @snapC vclone @snapA # @final | @final # @init # @snapC # @final # # $1 pool name # function setup_test_model { typeset pool=$1 log_must $ZFS create -p $pool/$FS/fs1/fs2 log_must $ZFS snapshot $pool@psnap log_must $ZFS clone $pool@psnap $pool/pclone if is_global_zone ; then log_must $ZFS create -V 16M $pool/vol log_must $ZFS create -V 16M $pool/$FS/vol log_must $ZFS snapshot $pool/$FS/vol@vsnap log_must $ZFS clone $pool/$FS/vol@vsnap $pool/$FS/vclone fi log_must snapshot_tree $pool/$FS/fs1/fs2@fsnap log_must $ZFS clone $pool/$FS/fs1/fs2@fsnap $pool/$FS/fs1/fclone log_must $ZFS snapshot -r $pool@init log_must snapshot_tree $pool@snapA log_must snapshot_tree $pool@snapC log_must snapshot_tree $pool/pclone@snapB log_must snapshot_tree $pool/$FS@snapB log_must snapshot_tree $pool/$FS@snapC log_must snapshot_tree $pool/$FS/fs1@snapA log_must snapshot_tree $pool/$FS/fs1@snapB log_must snapshot_tree $pool/$FS/fs1@snapC log_must snapshot_tree $pool/$FS/fs1/fclone@snapA if is_global_zone ; then log_must $ZFS snapshot $pool/vol@snapA log_must $ZFS snapshot $pool/$FS/vol@snapB log_must $ZFS snapshot $pool/$FS/vol@snapC log_must $ZFS snapshot $pool/$FS/vclone@snapC fi log_must $ZFS snapshot -r $pool@final return 0 } # # Cleanup the BACKDIR and given pool content and all the sub datasets # # $1 pool name # function cleanup_pool { typeset pool=$1 log_must $RM -rf $BACKDIR/* if is_global_zone ; then log_must $ZFS destroy -Rf $pool else typeset list=$($ZFS list -H -r -t filesystem,snapshot,volume -o name $pool) for ds in $list ; do if [[ $ds != $pool ]] ; then if datasetexists $ds ; then log_must $ZFS destroy -Rf $ds fi fi done fi typeset mntpnt=$(get_prop mountpoint $pool) if ! ismounted $pool ; then # Make sure mountpoint directory is empty if [[ -d $mntpnt ]]; then log_must $RM -rf $mntpnt/* fi log_must $ZFS mount $pool fi if [[ -d $mntpnt ]]; then log_must $RM -rf $mntpnt/* fi return 0 } # # Detect if the given two filesystems have same sub-datasets # # $1 source filesystem # $2 destination filesystem # function cmp_ds_subs { typeset src_fs=$1 typeset dst_fs=$2 $ZFS list -r -H -t filesystem,snapshot,volume -o name $src_fs > $BACKDIR/src1 $ZFS list -r -H -t filesystem,snapshot,volume -o name $dst_fs > $BACKDIR/dst1 eval $SED -e 's:^$src_fs:PREFIX:g' < $BACKDIR/src1 > $BACKDIR/src eval $SED -e 's:^$dst_fs:PREFIX:g' < $BACKDIR/dst1 > $BACKDIR/dst $DIFF $BACKDIR/src $BACKDIR/dst typeset -i ret=$? $RM -f $BACKDIR/src $BACKDIR/dst $BACKDIR/src1 $BACKDIR/dst1 return $ret } # # Compare all the directores and files in two filesystems # # $1 source filesystem # $2 destination filesystem # function cmp_ds_cont { typeset src_fs=$1 typeset dst_fs=$2 typeset srcdir dstdir srcdir=$(get_prop mountpoint $src_fs) dstdir=$(get_prop mountpoint $dst_fs) $DIFF -r $srcdir $dstdir > /dev/null 2>&1 print $? } # # Compare the given two dataset properties # # $1 dataset 1 # $2 dataset 2 # function cmp_ds_prop { typeset dtst1=$1 typeset dtst2=$2 for item in "type" "origin" "volblocksize" "aclinherit" "aclmode" \ "atime" "canmount" "checksum" "compression" "copies" "devices" \ "exec" "quota" "readonly" "recordsize" "reservation" "setuid" \ "shareiscsi" "sharenfs" "snapdir" "version" "volsize" "xattr" \ "zoned" "mountpoint"; do $ZFS get -H -o property,value,source $item $dtst1 >> \ $BACKDIR/dtst1 $ZFS get -H -o property,value,source $item $dtst2 >> \ $BACKDIR/dtst2 done eval $SED -e 's:$dtst1:PREFIX:g' < $BACKDIR/dtst1 > $BACKDIR/dtst1 eval $SED -e 's:$dtst2:PREFIX:g' < $BACKDIR/dtst2 > $BACKDIR/dtst2 $DIFF $BACKDIR/dtst1 $BACKDIR/dtst2 typeset -i ret=$? $RM -f $BACKDIR/dtst1 $BACKDIR/dtst2 return $ret } # # Random create directories and files # # $1 directory # function random_tree { typeset dir=$1 if [[ -d $dir ]]; then $RM -rf $dir fi $MKDIR -p $dir typeset -i ret=$? typeset -i nl nd nf ((nl = RANDOM % 6 + 1)) ((nd = RANDOM % 3 )) ((nf = RANDOM % 5 )) $MKTREE -b $dir -l $nl -d $nd -f $nf ((ret |= $?)) return $ret } # # Put data in filesystem and take snapshot # # $1 snapshot name # function snapshot_tree { typeset snap=$1 typeset ds=${snap%%@*} typeset type=$(get_prop "type" $ds) typeset -i ret=0 if [[ $type == "filesystem" ]]; then typeset mntpnt=$(get_prop mountpoint $ds) ((ret |= $?)) if ((ret == 0)) ; then eval random_tree $mntpnt/${snap##$ds} ((ret |= $?)) fi fi if ((ret == 0)) ; then $ZFS snapshot $snap ((ret |= $?)) fi return $ret } # # Destroy the given snapshot and stuff # # $1 snapshot # function destroy_tree { typeset -i ret=0 typeset snap for snap in "$@" ; do $ZFS destroy $snap ret=$? typeset ds=${snap%%@*} typeset type=$(get_prop "type" $ds) if [[ $type == "filesystem" ]]; then typeset mntpnt=$(get_prop mountpoint $ds) ((ret |= $?)) if ((ret != 0)); then $RM -r $mntpnt/$snap ((ret |= $?)) fi fi if ((ret != 0)); then return $ret fi done return 0 } # # Get all the sub-datasets of give dataset with specific suffix # # $1 Given dataset # $2 Suffix # function getds_with_suffix { typeset ds=$1 typeset suffix=$2 typeset list=$($ZFS list -r -H -t filesystem,snapshot,volume -o name $ds \ | $GREP "$suffix$") $ECHO $list } # # Output inherited properties whitch is edited for file system # function fs_inherit_prop { typeset fs_prop if is_global_zone ; then fs_prop=$($ZFS inherit 2>&1 | \ $AWK '$2=="YES" && $3=="YES" {print $1}') else fs_prop=$($ZFS inherit 2>&1 | \ $AWK '$2=="YES" && $3=="YES" {print $1}'| $EGREP -v "devices|sharenfs|sharesmb|zoned") fi $ECHO $fs_prop } # # Output inherited properties for volume # function vol_inherit_prop { $ECHO "checksum readonly shareiscsi" } # # Get the destination dataset to compare # function get_dst_ds { typeset srcfs=$1 typeset dstfs=$2 # # If the srcfs is not pool # if ! $ZPOOL list $srcfs > /dev/null 2>&1 ; then eval dstfs="$dstfs/${srcfs#*/}" fi $ECHO $dstfs } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg (revision 329035) @@ -1,54 +1,55 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)default.cfg 1.3 08/08/15 SMI" # typeset -i NUMBER_OF_DISKS=0 for i in $DISKS; do [[ -n $MIRROR_PRIMARY ]] && MIRROR_SECONDARY=$i [[ -z $MIRROR_PRIMARY ]] && MIRROR_PRIMARY=$i done if [[ -z $MIRROR_SECONDARY ]]; then # We need to repartition the single disk to two partitions SINGLE_DISK=$MIRROR_PRIMARY MIRROR_SECONDARY=$MIRROR_PRIMARY SIDE_PRIMARY=${SINGLE_DISK}p1 SIDE_SECONDARY=${SINGLE_DISK}p2 else SIDE_PRIMARY=${MIRROR_PRIMARY}p1 SIDE_SECONDARY=${MIRROR_SECONDARY}p1 fi export MIRROR_PRIMARY MIRROR_SECONDARY SINGLE_DISK SIDE_PRIMARY SIDE_SECONDARY export FILE_COUNT=30 export FILE_SIZE=$(( 1024 * 1024 )) export MIRROR_MEGS=70 export MIRROR_SIZE=${MIRROR_MEGS}m # default mirror size export BLOCKSZ=$(( 64 * 1024 )) export WRITE_COUNT=$(( MIRROR_MEGS * 1024 * 1024 / BLOCKSZ )) export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib (revision 329035) @@ -1,80 +1,81 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)scrub_mirror_common.kshlib 1.5 07/10/09 SMI" # function overwrite_verify_mirror { typeset POOL=$1 typeset AFFECTED_DEVICE=$2 typeset OVERWRITING_DEVICE=$3 typeset atfile=0 set -A files set -A cksums set -A newcksums fill_fs $TESTDIR -1 $FILE_COUNT $BLOCKSZ $WRITE_COUNT while [ "$atfile" -lt "$FILE_COUNT" ]; do if [ -f ${TESTDIR}/0/${TESTFILE}.${atfile} ]; then cksums[$atfile]=$($CKSUM ${TESTDIR}/0/${TESTFILE}.${atfile}) fi (( atfile = $atfile + 1 )) done # unmount and export before dd log_must $ZPOOL export $POOL # dd the affected side of the mirror log_must $DD if=$OVERWRITING_DEVICE of=$(bsddevmap $AFFECTED_DEVICE) \ seek=8 bs=$BLOCKSZ count=$(( WRITE_COUNT - 8 )) conv=notrunc # now remount and scrub log_must $ZPOOL import $POOL log_must $ZPOOL scrub $POOL wait_for 60 1 is_pool_scrubbed $POOL atfile=0 typeset -i failedcount=0 while [ "$atfile" -lt "$FILE_COUNT" ]; do if [ -f ${TESTDIR}/0/${TESTFILE}.${atfile} ]; then newcksum=$($CKSUM $TESTDIR/0/${TESTFILE}.${atfile}) if [[ $newcksum != ${cksums[$atfile]} ]]; then (( failedcount = $failedcount + 1 )) else log_note "${TESTFILE}.${atfile} checksums match:"\ "old ${cksums[$atfile]} new $newcksum" fi $RM -f ${files[$atfile]} fi (( atfile = $atfile + 1 )) done if [ "$failedcount" -gt 0 ]; then log_fail "of the $FILE_COUNT files $failedcount did not " \ "have the same checksum before and after." fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/slog/slog.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/slog/slog.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/slog/slog.cfg (revision 329035) @@ -1,41 +1,42 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)slog.cfg 1.1 07/07/31 SMI" # export SIZE=64M export VDIR=$TMPDIR/disk.${TESTCASE_ID} export VDIR2=$TMPDIR/disk2.${TESTCASE_ID} export VDEV="$VDIR/a $VDIR/b $VDIR/c" export SDEV="$VDIR/d" export LDEV="$VDIR/e $VDIR/f" export VDEV2="$VDIR2/a $VDIR2/b $VDIR2/c" export SDEV2="$VDIR2/d" export LDEV2="$VDIR2/e $VDIR2/f" export STF_TIMEOUT=1200 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/slog/slog.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/slog/slog.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/slog/slog.kshlib (revision 329035) @@ -1,178 +1,179 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)slog.kshlib 1.2 08/11/03 SMI" # . $STF_SUITE/include/libtest.kshlib function cleanup { poolexists $TESTPOOL && log_must $ZPOOL status $TESTPOOL poolexists $TESTPOOL && log_must $ZPOOL status $TESTPOOL2 destroy_pool $TESTPOOL destroy_pool $TESTPOOL2 } # # Try zpool status/iostat for given pool # # $1 pool # function display_status { typeset pool=$1 typeset -i ret=0 $ZPOOL status -xv $pool > /dev/null 2>&1 ret=$? $ZPOOL iostat > /dev/null 2>&1 ((ret |= $?)) typeset mntpnt=$(get_prop mountpoint $pool) $DD if=/dev/random of=$mntpnt/testfile.${TESTCASE_ID} & typeset pid=$! $ZPOOL iostat -v 1 3 > /dev/null ((ret |= $?)) kill -9 $pid return $ret } function slog_devstat_table { typeset pool=$1 $ZPOOL status -v $pool | $NAWK ' BEGIN { start = 0; } /\tlogs/ { start = 1; } (start == 0) { next; } /\t (\/|[a-zA-Z])/ { print "stripe:" $1 " " $2; } /\t (\/|[a-zA-Z])/ { print "mirror:" $1 " " $2; } /\t (\/|[0-9])/ {print "stripe:" $NF " " $2} /\t (\/|[0-9])/ {print "mirror:" $NF " " $2} # When a hotspare is replacing /\t (\/|[a-zA-Z])/ {print "mirror:" $1 " " $2} ' } # # Verify the given slog device have correct type and status # # $1 pool name # $2 device name # $3 device status # $4 device type # function verify_slog_device { typeset pool=$1 typeset device=$2 typeset status=$3 typeset type=$4 if [[ -z $pool || -z $device || -z $status ]]; then log_fail "Usage: verify_slog_device " \ " [type]" fi if [[ $WRAPPER == *"smi"* ]]; then $ECHO $device | $EGREP "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1 if (( $? == 0 )); then device=${device}s2 fi fi # # Get all the slog devices and status table like below # # mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE # set -A dev_stat_tab $(slog_devstat_table $pool) typeset find=0 for (( i = 0; i < ${#dev_stat_tab[@]}; i += 2 )); do typeset dev=${dev_stat_tab[$i]} typeset stat=${dev_stat_tab[((i+1))]} typeset statmsg="$dev: Status($stat) != Expected stat($status)" case $dev in stripe:$device) if [[ "$type" == 'mirror' ]]; then log_note "Unexpected type: mirror" return 1 fi if [[ $stat != $status ]]; then log_note statmsg return 1 fi return 0 ;; mirror:$device) if [[ -z "$type" || $type == 'stripe' ]]; then log_note "Unexpected type: stripe" return 1 fi if [[ $stat != $status ]]; then log_note statmsg return 1 fi return 0 ;; esac done return 1 } # Calls [args...] . function slog_foreach_nologtype # { typeset callback="$1" for pooltype in "" "mirror" "raidz" "raidz2"; do for sparetype in "" "spare"; do $callback "$pooltype" "$sparetype" done done } # Calls [args...] . # Unfortunately, this has to be duplicated because some arguments are empty, # so if they aren't explicitly forwarded they aren't arguments to $callback. function slog_foreach_all # { typeset callback="$1" for pooltype in "" "mirror" "raidz" "raidz2"; do for sparetype in "" "spare"; do for logtype in "" "mirror"; do $callback "$pooltype" "$sparetype" "$logtype" done done done } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot.cfg (revision 329035) @@ -1,59 +1,60 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)snapshot.cfg 1.4 08/08/15 SMI" # . $STF_SUITE/include/libtest.kshlib export ZFSROOT= export TESTVOL=testvol${TESTCASE_ID} export TESTVOL1=testvol1.${TESTCASE_ID} export TESTSNAP=testsnap${TESTCASE_ID} export TESTSNAP1=testsnap1.${TESTCASE_ID} export TESTCLONE=testclone${TESTCASE_ID} export TESTCLONE1=testclone1${TESTCASE_ID} export TESTCLONE2=testclone2${TESTCASE_ID} export TESTFILE=testfile${TESTCASE_ID} export TESTFILE1=testfile1${TESTCASE_ID} export SNAPROOT="$(get_snapdir_name)" export SNAPPOOL="$TESTPOOL@$TESTSNAP" export SNAPFS="$TESTPOOL/$TESTFS@$TESTSNAP" export SNAPFS1="$TESTPOOL/$TESTVOL@$TESTSNAP" export SNAPFS2="$TESTPOOL1/$TESTFS@$TESTSNAP" export SNAPCTR="$TESTPOOL/$TESTCTR/$TESTFS1@$TESTSNAP" export SNAPDIR="$TESTDIR/$SNAPROOT/$TESTSNAP" export SNAPDIR1="$TESTDIR1/$SNAPROOT/$TESTSNAP" export SNAPDIR2="$TESTDIR2/$SNAPROOT/$TESTSNAP" export SNAPDIR3="$ZFSROOT/$SNAPFS1" export VOLSIZE=1gb export BLOCKSZ=8192 export NUM_WRITES=20 export DATA=0 export LIMIT=524288 # tolerance measured in bytes, 512K export FSQUOTA=500m export FILESIZE=400m export FILESIZE1=200m Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/snapused/snapused.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/snapused/snapused.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/snapused/snapused.cfg (revision 329035) @@ -1,31 +1,32 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)snapused.cfg 1.1 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib export USEDTEST=$TESTPOOL/$TESTFS/usedtest${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/snapused/snapused.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/snapused/snapused.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/snapused/snapused.kshlib (revision 329035) @@ -1,188 +1,189 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)snapused.kshlib 1.1 09/05/19 SMI" # . $STF_SUITE/include/libtest.kshlib function usedby_supported { fs_prop_exist "usedbysnapshots" return $? } function _check_used # dataset { typeset dataset=$1 if [[ "$(get_prop type $dataset)" == "snapshot" ]]; then return fi used=$(get_prop used $dataset) usedbychildren=$(get_prop usedbychildren $dataset) usedbydataset=$(get_prop usedbydataset $dataset) usedbyrefreservation=$(get_prop usedbyrefreservation $dataset) usedbysnapshots=$(get_prop usedbysnapshots $dataset) (( used_sum = usedbychildren + usedbydataset + \ usedbyrefreservation + usedbysnapshots )) if (( used != used_sum )); then log_fail "$dataset: used($used) is not the sum($used_sum) of usedby*" fi } function check_used # dataset { typeset dataset=$1 for child in $($ZFS list -rH -t filesystem,volume -o name $dataset) do _check_used $child done } function check_usedbychildren # dataset { typeset dataset=$1 typeset -i usedbychildren_sum=0 typeset -i parent_usedbychildren=0 for child in $($ZFS list -rH -t filesystem,volume -o name $dataset) do if [[ "$(get_prop type $child)" == "snapshot" ]]; then continue fi # parent if [[ "$child" == "$dataset" ]]; then parent_usedbychildren=$(get_prop usedbychildren $child) else #child reservation=$(get_prop reservation $child) used=$(get_prop used $child) if (( reservation > used )); then (( usedbychildren_sum += reservation )) else (( usedbychildren_sum += used )) fi fi done if (( parent_usedbychildren != usedbychildren_sum )); then log_fail "$dataset: usedbychildren($parent_usedbychildren) is not the sum($usedbychildren_sum) of used by children" fi } function _check_usedbydataset # dataset { typeset dataset=$1 if [[ "$(get_prop type $dataset)" == "snapshot" ]]; then return fi usedbydataset=$(get_prop usedbydataset $dataset) referenced=$(get_prop referenced $dataset) is_cloned=$(get_prop is:cloned $dataset) if [[ "$is_cloned" == "yes" ]]; then if (( usedbydataset > referenced )); then log_fail "$dataset(cloned): usedbydataset($usedbydataset) is more than referenced($referenced)" fi else # # if non-clones, should usedbydataset == referenced # if (( usedbydataset != referenced )); then log_fail "$dataset: usedbydataset($usedbydataset) is not equal to referenced($referenced)" fi fi } function check_usedbydataset # dataset { typeset dataset=$1 for child in $($ZFS list -rH -t filesystem,volume -o name $dataset) do _check_usedbydataset $child done } function _check_usedbyrefreservation # dataset { typeset dataset=$1 if [[ "$(get_prop type $dataset)" == "snapshot" ]]; then return fi usedbyrefreservation=$(get_prop usedbyrefreservation $dataset) referenced=$(get_prop referenced $dataset) refreservation=$(get_prop refreservation $dataset) (( diff_ref = refreservation - referenced )) if (( usedbyrefreservation > refreservation || \ usedbyrefreservation < diff_ref )); then log_fail "$dataset: usedbyrefreservation($usedbyrefreservation) checking is not ok" fi } function check_usedbyrefreservation # dataset { typeset dataset=$1 for child in $($ZFS list -rH -t filesystem,volume -o name $dataset) do _check_usedbyrefreservation $child done } function check_usedbysnapshots # dataset { typeset dataset=$1 typeset -i usedbysnapshots_sum=0 typeset -i parent_usedbysnapshots=0 for child in $($ZFS list -rH -t filesystem,volume,snapshot -o name $dataset) do # parent if [[ "$child" == "$dataset" ]]; then parent_usedbysnapshots=$(get_prop usedbysnapshots $child) continue fi if [[ "$(get_prop type $child)" != "snapshot" ]]; then continue fi if [[ "$child" != "$dataset@"* ]]; then continue fi # snapshot used=$(get_prop used $child) (( usedbysnapshots_sum += used )) done if (( parent_usedbysnapshots < usedbysnapshots_sum )); then log_fail "$dataset: usedbysnapshots($parent_usedbysnapshots) is not more than or equal to" \ "the sum($usedbysnapshots_sum) of used of snapshots" fi } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/sparse/sparse.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/sparse/sparse.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/sparse/sparse.cfg (revision 329035) @@ -1,35 +1,36 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)sparse.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile.${TESTCASE_ID} export HOLES_FILESIZE=${HOLES_FILESIZE-"67108864"} # 64 Mb export HOLES_BLKSIZE=${HOLES_BLKSIZE-"512"} export HOLES_SEED=${HOLES_SEED-""} export HOLES_FILEOFFSET=${HOLES_FILEOFFSET-""} export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8 export STF_TIMEOUT=3600 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)threadsappend.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/truncate/truncate.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/truncate/truncate.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/truncate/truncate.cfg (revision 329035) @@ -1,35 +1,36 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)truncate.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile.${TESTCASE_ID} export TRUNC_FILESIZE=${TRUNC_FILESIZE-"67108864"} # 64 Mb export TRUNC_BLKSIZE=${TRUNC_BLKSIZE-"512"} export TRUNC_SEED=${TRUNC_SEED-""} export TRUNC_FILEOFFSET=${TRUNC_FILEOFFSET-""} export TRUNC_COUNT=${TRUNC_COUNT-"16384"} # FILESIZE/BLKSIZE/8 export STF_TIMEOUT=3600 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity.cfg (revision 329035) @@ -1,31 +1,32 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2011 Spectra logic. All rights reserved. # Use is subject to license terms. # # ident "@(#)transaction_group_integrity.cfg 1.0 10/20/11 SL" # export TESTFILE=testfile${TESTCASE_ID} export DISK="/dev/md${TESTCASE_ID}" export TESTDEV=${DISK} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/userquota/userquota.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/userquota/userquota.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/userquota/userquota.cfg (revision 329035) @@ -1,45 +1,46 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)userquota.cfg 1.1 09/06/22 SMI" # export QUSER1=quser1 export QUSER2=quser2 export QGROUP=qgroup export QGROUP1=qgroup1 export QGROUP1=qgroup2 export UQUOTA_SIZE=1000000 export GQUOTA_SIZE=4000000 export QFS=$TESTPOOL/$TESTFS export QFILE=$TESTDIR/qf.${TESTCASE_ID} export OFILE=$TESTDIR/of.${TESTCASE_ID} export SNAP_QUOTA=100m export TEST_QUOTA=88888 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/userquota/userquota_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/userquota/userquota_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/userquota/userquota_common.kshlib (revision 329035) @@ -1,144 +1,145 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)userquota_common.kshlib 1.1 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/userquota/userquota.cfg # # Check if the test box support userquota or not. # function is_userquota_supported { if ! fs_prop_exist "userquota@..."; then return 1 fi return 0 } # # reset the userquota and groupquota and delete temporary files # function cleanup_quota { if datasetexists $QFS; then log_must $ZFS set userquota@$QUSER1=none $QFS log_must $ZFS set userquota@$QUSER2=none $QFS log_must $ZFS set groupquota@$QGROUP=none $QFS recovery_writable $QFS fi [[ -f $QFILE ]] && log_must $RM -f $QFILE [[ -f $OFILE ]] && log_must $RM -f $OFILE return 0 } # # delete user and group that created during the test # function clean_user_group { for usr in $QUSER1 $QUSER2; do log_must del_user $usr done log_must del_group $QGROUP return 0 } # # make the $QFS's mountpoint writable for all users # function mkmount_writable { typeset fs=$1 typeset mntp=$(get_prop mountpoint $fs) log_must $CHMOD 0777 $mntp } # # recovery the directory permission for $QFS # function recovery_writable { typeset fs=$1 typeset mntp=$(get_prop mountpoint $fs) log_must $CHMOD 0755 $mntp } # # run command as specific user # function user_run { typeset user=$1 typeset group=$($GROUPS $user) shift eval \$RUNWATTR -u \$user -g \$group \"$@\" > /dev/null 2>&1 return $? } # # check the quota value of a specific FS # function check_quota { typeset fs=$2 typeset prop=$1 typeset expected=$3 typeset value=$(get_prop $prop $fs) if (( $value != $expected )); then return 1 fi } # # zfs get prop, which return raw value not -p value. # function get_value # property dataset { typeset prop_val typeset prop=$1 typeset dataset=$2 prop_val=$($ZFS get -H -o value $prop $dataset 2>/dev/null) if [[ $? -ne 0 ]]; then log_note "Unable to get $prop property for dataset " \ "$dataset" return 1 fi $ECHO $prop_val return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/utils_test/utils_test.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/utils_test/utils_test.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/utils_test/utils_test.cfg (revision 329035) @@ -1,38 +1,39 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)utils_test.cfg 1.3 08/08/15 SMI" # export TESTSNAP=testsnap${TESTCASE_ID} export TESTCLCT=testclct${TESTCASE_ID} export TESTFILE=testfile${TESTCASE_ID} export WRITE_COUNT=20 export BLOCKSZ=8192 export DATA=0 export NUM_FILES=10 export DISK=${DISKS%% *} Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/utils_test/utils_test.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/utils_test/utils_test.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/utils_test/utils_test.kshlib (revision 329035) @@ -1,27 +1,28 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)utils_test.kshlib 1.2 07/01/09 SMI" # Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)write_dirs.cfg 1.3 08/08/15 SMI" # export TESTFILE=testfile${TESTCASE_ID} export STF_TIMEOUT=1200 export SIZE="1gb" export PARTITION=1 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/xattr/xattr.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/xattr/xattr.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/xattr/xattr.cfg (revision 329035) @@ -1,51 +1,52 @@ #!/bin/ksh -p +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)xattr.cfg 1.3 08/08/15 SMI" # # a variable we set during setup to indicate whether we need to # re-enable the nis/client during cleanup. USES_NIS=false # A username we can create for the course of the zfs xattr # testing (modified by setup if it already exists) ZFS_USER=zxtr ZFS_GROUP=staff # These variables may also have been tweaked by the setup script # Let's import them if necessary. if [ -f $TMPDIR/zfs-xattr-test-nis.txt ] then USES_NIS=$($CAT $TMPDIR/zfs-xattr-test-nis.txt) fi if [ -f $TMPDIR/zfs-xattr-test-user.txt ] then ZFS_USER=$($CAT $TMPDIR/zfs-xattr-test-user.txt) fi export ZFS_USER export ZFS_GROUP export USES_NIS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/xattr/xattr_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/xattr/xattr_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/xattr/xattr_common.kshlib (revision 329035) @@ -1,105 +1,106 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)xattr_common.kshlib 1.3 08/02/27 SMI" # . $STF_SUITE/include/libtest.kshlib # a function that takes a file, then creates and verifies # an xattr on that file. The xattr_contents is the file # that should appear in the xattr namespace. function create_xattr { # filename xattr_name xattr_contents typeset FILE=$1 typeset XATTR_NAME=$2 typeset XATTR_CONTENTS=$3 # read any empty xattr on that file log_must $RUNAT $FILE $LS # create the xattr log_must $RUNAT $FILE $CP $XATTR_CONTENTS $XATTR_NAME verify_xattr $FILE $XATTR_NAME $XATTR_CONTENTS } # a function that compares the a single xattr between two files # and checks to see if their contents are identical function compare_xattrs { # filename1 filename2 xattr_name typeset FILE1=$1 typeset FILE2=$2 typeset XATTR_NAME=$3 $RUNAT $FILE1 $CAT $XATTR_NAME > $TMPDIR/file1.${TESTCASE_ID} $RUNAT $FILE2 $CAT $XATTR_NAME > $TMPDIR/file2.${TESTCASE_ID} log_must $DIFF $TMPDIR/file1.${TESTCASE_ID} $TMPDIR/file2.${TESTCASE_ID} log_must $RM $TMPDIR/file1.${TESTCASE_ID} $TMPDIR/file2.${TESTCASE_ID} } function verify_xattr { # filename xattr_name xattr_contents typeset FILE=$1 typeset XATTR_NAME=$2 typeset XATTR_CONTENTS=$3 # read the xattr, writing it to a temp file log_must eval "$RUNAT $FILE $CAT $XATTR_NAME > $TMPDIR/$XATTR_NAME.${TESTCASE_ID} 2>&1" log_must $DIFF $XATTR_CONTENTS $TMPDIR/$XATTR_NAME.${TESTCASE_ID} $RM $TMPDIR/$XATTR_NAME.${TESTCASE_ID} } function delete_xattr { # filename xattr_name typeset FILE=$1 typeset XATTR_NAME=$2 # delete the xattr log_must $RUNAT $FILE $RM $XATTR_NAME log_mustnot eval "$RUNAT $FILE $LS $XATTR_NAME > /dev/null 2>&1" } # not sure about this : really this should be testing write/append function verify_write_xattr { # filename xattr_name typeset FILE=$1 typeset XATTR_NAME=$2 log_must eval "$RUNAT $FILE $DD if=/etc/passwd of=$XATTR_NAME" log_must eval "$RUNAT $FILE $CAT $XATTR_NAME > $TMPDIR/$XATTR_NAME.${TESTCASE_ID} 2>&1" log_must $DD if=/etc/passwd of=$TMPDIR/passwd_dd.${TESTCASE_ID} log_must $DIFF $TMPDIR/passwd_dd.${TESTCASE_ID} $TMPDIR/$XATTR_NAME.${TESTCASE_ID} log_must $RM $TMPDIR/passwd_dd.${TESTCASE_ID} $TMPDIR/$XATTR_NAME.${TESTCASE_ID} } # this function is to create the expected output function create_expected_output { # expected_output_file contents_of_the_output typeset FILE=$1 shift if [[ -f $FILE ]]; then log_must $RM $FILE fi for line in $@ do log_must eval "$ECHO $line >> $FILE" done } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd.cfg (revision 329035) @@ -1,29 +1,30 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2012,2013 Spectra Logic Corporation. All rights reserved. # Use is subject to license terms. # # export TESTFILE=testfile.${TESTCASE_ID} export STF_TIMEOUT=300 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib (revision 329035) @@ -1,82 +1,83 @@ #!/usr/local/bin/ksh93 -p +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2013 Spectra Logic. All rights reserved. # Use is subject to license terms. # # Common routines used by multiple zfsd tests function wait_for_pool_dev_state_change { typeset -i timeout=$1 typeset disk=$2 typeset state=$3 log_note "Waiting up to $timeout seconds for $disk to become $state ..." for ((; $timeout > 0; timeout=$timeout-1)); do check_state $TESTPOOL "$disk" "$state" [ $? -eq 0 ] && return $SLEEP 1 done log_must $ZPOOL status $TESTPOOL log_fail "ERROR: Disk $disk not marked as $state in $TESTPOOL" } function wait_for_pool_removal { typeset -i timeout=$1 wait_for_pool_dev_state_change $timeout $REMOVAL_DISK "REMOVED|UNAVAIL" } function wait_until_scrubbed { typeset pool=$1 while is_pool_scrubbing $pool; do log_note "$pool still scrubbing..." $SLEEP 1 done } function corrupt_pool_vdev { typeset pool=$1 typeset vdev=$2 typeset file=$3 # do some IO on the pool log_must $DD if=/dev/zero of=$file bs=1024k count=128 $FSYNC $file # scribble on the underlying file to corrupt the vdev log_must $DD if=/dev/urandom of=$vdev bs=1024k count=64 conv=notrunc # Scrub the pool to detect the corruption log_must $ZPOOL scrub $pool wait_until_scrubbed $pool # ZFSD can take up to 60 seconds to degrade an array in response to # errors (though it's usually faster). wait_for_pool_dev_state_change 60 $vdev DEGRADED } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zil/zil.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zil/zil.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zil/zil.cfg (revision 329035) @@ -1,28 +1,29 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2012 Spectra Logic Corporation. All rights reserved. # Use is subject to license terms. # export POOLSIZE=1073741824 # 100MiB export BLOCK_SIZE=4096 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zil/zil.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zil/zil.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zil/zil.kshlib (revision 329035) @@ -1,52 +1,53 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2012 Spectra Logic Corporation. All rights reserved. # Use is subject to license terms. # # Every test must restart the frozen pool state. function zil_setup { log_must $ZPOOL list $TESTPOOL # In order for a frozen zpool to have a ZIL, it is necessary to # sync it first. If a sync is not done first, no ZIL will exist, # and consequently no post-freeze log records will be created. log_must $TOUCH $TESTDIR/initial_data log_must $FSYNC $TESTDIR/initial_data log_must $ZPOOL freeze $TESTPOOL log_must filesys_has_zil $TESTPOOL return 0 } function zil_reimport_pool { typeset pool="$1" log_must filesys_has_zil $pool log_must pool_maps_intact $pool log_must $ZPOOL export $pool log_must $ZPOOL import $pool log_must pool_maps_intact $pool log_mustnot filesys_has_zil $pool return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg (revision 329035) @@ -1,66 +1,67 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zinject.cfg 1.3 09/05/19 SMI" # . $STF_SUITE/tests/cli_root/cli.cfg . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cache/cache.kshlib if [[ -e /usr/sbin/zinject ]] ; then export ZINJECT="/usr/sbin/zinject" else log_untested "zinject is not integrated." fi export STF_TIMEOUT=1800 export DISK_ARRAY_LIMIT=4 export DISKSARRAY="" set_disks export SIZE="200m" export VDEV0=${DISK0}p1 export VDEV1=${DISK0}p2 export VDEV2=${DISK0}p3 export VDEV3=${DISK0}p4 export VDEV4=${DISK0}p5 export VDEV5=${DISK0}p6 export VDEV6=${DISK0}p7 export pooldevs="$VDEV0 $VDEV1 $VDEV2" export sparedevs="$VDEV3" if verify_slog_support ; then export logdevs="$VDEV4" fi if verify_cache_support ; then export cachedevs="$VDEV5" fi export alldevs="$pooldevs $sparedevs $logdevs $cachedevs" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.kshlib (revision 329035) @@ -1,224 +1,225 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zinject.kshlib 1.6 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/cli_root/zfs_set/zfs_set_common.kshlib . $STF_SUITE/tests/cache/cache.kshlib function cleanup_env { inject_clear poolexists $TESTPOOL && \ destroy_pool $TESTPOOL [[ -d $TESTDIR ]] && \ log_must $RM -rf $TESTDIR } # # Inject an error into object # $1: data,dnode,mos,mosdir,config,bplist,spacemap,metaslab,errlog # $2: if $1 is data or dnode, $2 should be a file or dir. # otherwise, $2 should be poolname # $3: "io" or "checksum" # $4: expect return value of zinject, default is 0 # function inject_fault #type, object, error, expect { typeset type=$1 typeset object=$2 typeset error=${3:-io} typeset -i expect=${4:-0} if (( expect == 0 )); then log_must eval '$ZINJECT -t $type -e $error \ -m -a -q $object > /dev/null 2>&1' else log_mustnot eval '$ZINJECT -t $type -e $error \ -m -a -q $object > /dev/null 2>&1' fi $SLEEP 1 return 0 } # # Clear all registrated handler and do scrub to keep integrity # function inject_clear { log_must eval '$ZINJECT -c all > /dev/null 2>&1' $SLEEP 1 if poolexists $TESTPOOL ; then while ! check_pool_status $TESTPOOL "state" "ONLINE" ; do log_must $ZPOOL clear $TESTPOOL $SLEEP 2 done log_must $ZPOOL scrub $TESTPOOL while ! is_pool_scrubbed $TESTPOOL && ! is_pool_resilvered $TESTPOOL ; do $SLEEP 2 done fi return 0 } # # Inject a fault into a particular device # $1: device name # $2: pool name # $3: errno, can either be 'nxio' (the default) or 'io'. # function inject_device #device, pool, errno { typeset device=$1 typeset pool=$2 typeset errno=$3 log_must eval '$ZINJECT -d $device -e $errno -q $pool > /dev/null 2>&1' $SLEEP 1 return 0 } # # Check if the ereport is occurred after the given timestamp # function check_ereport #timestamp, etype { typeset etime=$1 typeset ereport typeset -i i=0 typeset -i maxtimes=20 shift for type in $@ ; do i=0 while (( i < maxtimes )); do (( i = i + 1 )) ereport=$($FMDUMP -t "$etime" -e -v -c $type | \ $NAWK '(NR != 1) {print $0}') if [[ -n $ereport ]]; then break elif (( i == maxtimes )) ; then $FMDUMP -t "$etime" -e -v log_fail "$type not found" fi $SLEEP 3 done done return 0 } # # Check if the fault is occurred after the given timestamp # function check_fault #timestamp, fault_class { typeset after_time=$1 typeset ereport typeset -i i=0 typeset -i maxtimes=20 shift for fault in $@ ; do i=0 while (( i < maxtimes )); do (( i = i + 1 )) ereport=$($FMDUMP -av -t "$after_time" | $GREP $fault) if [[ -n $ereport ]]; then break elif (( i == maxtimes )) ; then $FMDUMP -av -t "$after_time" log_fail "$fault not found" fi $SLEEP 3 done done return 0 } # # Check if 'zpool status -v' contain the permanent error as expected # function check_status #poolname, errors { typeset poolname=$1 typeset errors=$2 for err in $errors ; do ereport=$($ZPOOL status -v $poolname | $GREP "$err") if [[ -z $ereport ]]; then $ZPOOL status -v $poolname log_fail "$err not found" fi done return 0 } # # Invoke the trigger function according to the fault type corresponded # function trigger_inject #etype, object, objtype { typeset etype=$1 typeset object=$2 typeset objtype=$3 if [[ $etype == "bplist" ]] ; then $ECHO "ZFS Fault Harness" > $object fi case $objtype in dir) $LS -l $object > /dev/null 2>&1 ;; file) $CAT $object > /dev/null 2>&1 ;; esac } function populate_test_env #basedir #count { typeset basedir=$1 typeset -i count=$2 typeset -i i=1 if [[ -d $basedir ]]; then log_must $RM -rf $basedir/* else log_must $MKDIR -p $basedir fi while (( i <= count )); do $ECHO "ZFS Fault Harness" > $basedir/testfile.$i $MKDIR -p $basedir/testdir.$i (( i = i + 1 )) done return 0 } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zones/zones.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zones/zones.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zones/zones.cfg (revision 329035) @@ -1,80 +1,81 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zones.cfg 1.5 08/08/15 SMI" # # Variables we'll use to name our zones # The first two zones are created by setup, # then destroyed in zones_004_pos - or cleanup. ZONE="${ZONE:=zone}" ZONE2="${ZONE2:=zonetwo}" # These zones are created and destroyed by zones_003_pos - or cleanup. ZONE3="${ZONE3:=zonethree}" ZONE4="${ZONE4:=zonefour}" # A function which runs through a loop, adding a different characters # to the stem passed as $1, to make sure we have a unique name that # doesn't clash with an existing zone name. Once we've found a unique # name, we echo that to stdout. # function find_unique_zonename { # initial name of zone NAME=$1 COUNT=0 while [ -z "$FOUND" ] do NAME="${NAME}${COUNT}" $ZONEADM -z $NAME list > /dev/null 2>&1 if [ $? -eq 1 ] then FOUND=true fi COUNT=$(( $COUNT + 1 )) done echo $NAME } # Need a longer timeout for zone installation export STF_TIMEOUT=3600 # Make sure that multiple sourcing of this script doesn't change the zone name if [ -z "${RUNCONFIG}" ] then ZONE=$(find_unique_zonename $ZONE) ZONE2=$(find_unique_zonename $ZONE2) ZONE3=$(find_unique_zonename $ZONE3) ZONE4=$(find_unique_zonename $ZONE4) log_note "zones.cfg gave us new zone names $ZONE,$ZONE2,$ZONE3,$ZONE4" export ZONE export ZONE2 export ZONE3 export ZONE4 export RUNCONFIG="true" fi Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zones/zones_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zones/zones_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zones/zones_common.kshlib (revision 329035) @@ -1,67 +1,68 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zones_common.kshlib 1.3 07/03/14 SMI" # . $STF_SUITE/include/libtest.kshlib . $STF_SUITE/tests/zones/zones.cfg # a simple zone creation function function create_zone { # $ZONENAME $ZONEPATH $BRAND (optional) ZNAME=$1 ZPATH=$2 BRAND=$3 if [ ! -z $BRAND ] then # The SUNWsn1 brand only works on debug kernels for sparc, so we # check for a known symbol to see if that's there. $ECHO "logmap_logscan_debug/p" | $MDB -k > /dev/null 2>&1 if [ $? -eq 1 ] then BRAND="" else BRAND="-t $BRAND " fi fi # create a zone config file $CAT > $TMPDIR/zone.${TESTCASE_ID}.cfg < /dev/null $RM $TMPDIR/zone.${TESTCASE_ID}.cfg } function install_zone { # $ZONENAME ZNAME=$1 log_note "Installing $ZNAME. This may take some time." log_must $ZONEADM -z $ZNAME install > /dev/null } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol.cfg (revision 329035) @@ -1,36 +1,37 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zvol.cfg 1.4 08/08/15 SMI" # export DISK=${DISKS%% *} export TESTVOL=testvol${TESTCASE_ID} export TESTFILE=testfile${TESTCASE_ID} export TESTSNAP=testsnap${TESTCASE_ID} export VOLSIZE=2g export DATA=0 export ENOSPC=28 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zvol_ENOSPC.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/zvol/zvol.cfg export BLOCKSZ=$(( 1024 * 1024 )) export NUM_WRITES=40 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zvol_cli.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/zvol/zvol.cfg export LONGPNAME="poolname50charslong_012345678901234567890123456789" export LONGVOLNAME="volumename50charslong_0123456789012345678901234567" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_common.kshlib =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_common.kshlib (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_common.kshlib (revision 329035) @@ -1,162 +1,163 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zvol_common.kshlib 1.6 09/06/22 SMI" # . $STF_SUITE/include/libtest.kshlib # # Create a simple zvol volume # # Where disk_device: is the name of the disk to be used # volume_size: is the size of the volume, e.g. 2G # function default_zvol_setup # disk_device volume_size { typeset disk=$1 typeset size=$2 typeset savedumpdev typeset -i output create_pool $TESTPOOL "$disk" log_must $ZFS create -V $size $TESTPOOL/$TESTVOL if [[ -n $DUMPADM ]]; then if is_dumpswap_supported $TESTPOOL ; then set_dumpsize $TESTPOOL/$TESTVOL fi fi } # # Destroy the default zvol which was setup using # default_zvol_setup(). # function default_zvol_cleanup { if datasetexists $TESTPOOL/$TESTVOL ; then log_must $ZFS destroy $TESTPOOL/$TESTVOL fi destroy_pool $TESTPOOL } # # Check if the given pool support "Swap and crash dumps" # function is_dumpswap_supported #pool { typeset pool=$1 if [[ -z $pool ]] ; then log_fail "No pool given." fi typeset -i SPA_VER_DUMPSWAP=10 typeset -i vp=$(get_pool_prop version $pool) if (( vp >= SPA_VER_DUMPSWAP )) ; then return 0 fi return 1 } function get_dumpdevice { typeset ret=$($DUMPADM | $GREP "Dump device:" | $AWK '{print $3}') print $ret } function set_dumpsize { typeset volume=$1 if [[ -z $volume ]] ; then log_note "No volume specified." return 1 fi log_must $ZFS set volsize=64m $volume output=$($DUMPADM -d /dev/zvol/dsk/$volume 2>&1 | \ $TAIL -1 | $AWK '{print $3}') if [[ -n $output ]]; then (( output = output / 1024 / 1024 )) (( output = output + output / 5 )) log_must $ZFS set volsize=${output}m $volume fi return 0 } function safe_dumpadm { typeset device=$1 if [[ -z $device || $device == "none" ]] ; then log_note "No dump device volume specified." return 1 fi if [[ $device == "/dev/zvol/dsk/"* ]] ; then typeset volume=${device#/dev/zvol/dsk/} set_dumpsize $volume log_must $DUMPADM -d $device else log_must $SWAPADD if ! is_swap_inuse $device ; then log_must $SWAP -a $device fi log_must $DUMPADM -d swap fi } function is_zvol_dumpified { typeset volume=$1 if [[ -z $volume ]] ; then log_note "No volume specified." return 1 fi $ZDB -dddd $volume 2 | $GREP "dumpsize" > /dev/null 2>&1 return $? } function is_swap_inuse { typeset device=$1 if [[ -z $device ]] ; then log_note "No device specified." return 1 fi $SWAP -l | $GREP -w $device > /dev/null 2>&1 return $? } Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc.cfg (revision 329035) @@ -1,33 +1,34 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zvol_misc.cfg 1.3 08/05/14 SMI" # . $STF_SUITE/tests/zvol/zvol.cfg export BLOCKSZ=$(( 1024 * 1024 )) export NUM_WRITES=40 export RESERVESNAP=%dumpdev Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap.cfg (revision 329035) @@ -1,38 +1,39 @@ +# vim: filetype=sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)zvol_swap.cfg 1.2 07/01/09 SMI" # . $STF_SUITE/tests/zvol/zvol.cfg # # Remember swap devices # SAVESWAPDEVS=$($SWAP -l | $NAWK '(NR != 1) {print $1}') export BLOCKSZ=$(( 1024 * 1024 )) export NUM_WRITES=40 export SAVESWAPDEVS Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg (revision 329034) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg (revision 329035) @@ -1,32 +1,33 @@ +# vim: filetype=sh # # Copyright (c) 2010 Spectra Logic Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions, and the following disclaimer, # without modification. # 2. Redistributions in binary form must reproduce at minimum a disclaimer # substantially similar to the "NO WARRANTY" disclaimer below # ("Disclaimer") and any redistribution must be conditioned upon # including a substantially similar Disclaimer requirement for further # binary redistribution. # # NO WARRANTY # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGES. # # $FreeBSD$ # export RUNTIME=180