Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

*** 24,34 **** # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/rsend/rsend.kshlib # --- 24,34 ---- # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013, 2016 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/rsend/rsend.kshlib #
*** 49,59 **** typeset dtst=$1 typeset prop=$2 shift 2 typeset value=$(random_get $@) ! log_must eval "$ZFS set $prop='$value' $dtst" } function edited_prop { typeset behaviour=$1 --- 49,59 ---- typeset dtst=$1 typeset prop=$2 shift 2 typeset value=$(random_get $@) ! log_must eval "zfs set $prop='$value' $dtst" } function edited_prop { typeset behaviour=$1
*** 60,78 **** typeset ds=$2 typeset backfile=$TESTDIR/edited_prop_$ds case $behaviour in "get") ! typeset props=$($ZFS inherit 2>&1 | \ ! $AWK '$2=="YES" {print $1}' | \ ! $EGREP -v "^vol|\.\.\.$") for item in $props ; do if [[ $item == "mlslabel" ]] && \ ! is_te_enabled ; then continue fi ! $ZFS get -H -o property,value $item $ds >> \ $backfile if (($? != 0)); then log_fail "zfs get -H -o property,value"\ "$item $ds > $backfile" fi --- 60,78 ---- typeset ds=$2 typeset backfile=$TESTDIR/edited_prop_$ds case $behaviour in "get") ! typeset props=$(zfs inherit 2>&1 | \ ! awk '$2=="YES" {print $1}' | \ ! egrep -v "^vol|\.\.\.$") for item in $props ; do if [[ $item == "mlslabel" ]] && \ ! is_te_enabled ; then continue fi ! zfs get -H -o property,value $item $ds >> \ $backfile if (($? != 0)); then log_fail "zfs get -H -o property,value"\ "$item $ds > $backfile" fi
*** 83,95 **** log_fail "$ds need backup properties firstly." fi typeset prop value while read prop value ; do ! eval $ZFS set $prop='$value' $ds if (($? != 0)); then ! log_fail "$ZFS set $prop=$value $ds" fi done < $backfile ;; *) log_fail "Unrecognized behaviour: $behaviour" --- 83,95 ---- log_fail "$ds need backup properties firstly." fi typeset prop value while read prop value ; do ! eval zfs set $prop='$value' $ds if (($? != 0)); then ! log_fail "zfs set $prop=$value $ds" fi done < $backfile ;; *) log_fail "Unrecognized behaviour: $behaviour"
*** 104,124 **** log_must edited_prop "set" $POOL log_must edited_prop "set" $POOL2 typeset prop for prop in $(fs_inherit_prop) ; do ! log_must $ZFS inherit $prop $POOL ! log_must $ZFS inherit $prop $POOL2 done #if is_shared $POOL; then ! # log_must $ZFS set sharenfs=off $POOL #fi log_must setup_test_model $POOL if [[ -d $TESTDIR ]]; then ! log_must $RM -rf $TESTDIR/* fi } log_assert "Verify zfs send -R will backup all the filesystem properties " \ "correctly." --- 104,124 ---- log_must edited_prop "set" $POOL log_must edited_prop "set" $POOL2 typeset prop for prop in $(fs_inherit_prop) ; do ! log_must zfs inherit $prop $POOL ! log_must zfs inherit $prop $POOL2 done #if is_shared $POOL; then ! # log_must zfs set sharenfs=off $POOL #fi log_must setup_test_model $POOL if [[ -d $TESTDIR ]]; then ! log_must rm -rf $TESTDIR/* fi } log_assert "Verify zfs send -R will backup all the filesystem properties " \ "correctly."
*** 163,174 **** rand_set_prop $POOL sharenfs "on" "off" "rw" # # Duplicate POOL2 for testing # ! log_must eval "$ZFS send -R $POOL@final > $BACKDIR/pool-final-R" ! log_must eval "$ZFS receive -d -F $POOL2 < $BACKDIR/pool-final-R" # # Define all the POOL/POOL2 datasets pair # set -A pair "$POOL" "$POOL2" \ --- 163,174 ---- rand_set_prop $POOL sharenfs "on" "off" "rw" # # Duplicate POOL2 for testing # ! log_must eval "zfs send -R $POOL@final > $BACKDIR/pool-final-R" ! log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final-R" # # Define all the POOL/POOL2 datasets pair # set -A pair "$POOL" "$POOL2" \
*** 186,196 **** ((i += 2)) done ! $ZPOOL upgrade -v | $GREP "Snapshot properties" > /dev/null 2>&1 if (( $? == 0 )) ; then i=0 while ((i < ${#pair[@]})); do log_must cmp_ds_prop ${pair[$i]}@final ${pair[((i+1))]}@final ((i += 2)) --- 186,196 ---- ((i += 2)) done ! zpool upgrade -v | grep "Snapshot properties" > /dev/null 2>&1 if (( $? == 0 )) ; then i=0 while ((i < ${#pair[@]})); do log_must cmp_ds_prop ${pair[$i]}@final ${pair[((i+1))]}@final ((i += 2))