OpenZFS 7290 - ZFS test suite needs to control what utilities it can run

Authored by: John Wren Kennedy <john.kennedy@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: George Melikov <mail@gmelikov.ru>

Porting Notes:
- Utilities which aren't available under Linux have been removed.
- Because of sudo's default secure path behavior PATH must be
  explicitly reset at the top of libtest.shlib.  This avoids the
  need for all users to customize secure path on their system.
- Updated ZoL infrastructure to manage constrained path
- Updated all test cases
- Check permissions for usergroup tests
- When testing in-tree create links under bin/
- Update fault cleanup such that missing files during
  cleanup aren't fatal.
- Configure su environment with constrained path

OpenZFS-issue: https://www.illumos.org/issues/7290
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1d32ba6
Closes #5903
This commit is contained in:
John Wren Kennedy
2017-04-05 20:18:22 -04:00
committed by Brian Behlendorf
parent 7a4500a101
commit c1d9abf905
797 changed files with 8038 additions and 7458 deletions
@@ -26,10 +26,10 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. ${STF_SUITE}/include/libtest.shlib
$RM -rf $TESTDIR.*
rm -rf $TESTDIR.*
default_cleanup
@@ -25,7 +25,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
#
@@ -38,7 +38,7 @@ function get_prop_src # property dataset
typeset prop=$1
typeset dataset=$2
prop_val=`$ZFS get -H -o source $prop $dataset`
prop_val=`zfs get -H -o source $prop $dataset`
if [[ $? -ne 0 ]]; then
log_fail "Unable to determine the source of $prop " \
@@ -104,7 +104,7 @@ function set_n_verify_prop #property value dataset
typeset prop_val=$2
typeset dataset=$3
$ZFS set $prop=$prop_val $dataset
zfs set $prop=$prop_val $dataset
check_val=`get_prop $prop $dataset`
if [[ $check_val != $prop_val ]]; then
@@ -25,7 +25,7 @@
# Use is subject to license terms.
#
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@@ -58,10 +58,10 @@ function create_dataset { #name type disks
if [[ $type == "POOL" ]]; then
create_pool "$dataset" "$disks"
elif [[ $type == "CTR" ]]; then
log_must $ZFS create $dataset
log_must $ZFS set canmount=off $dataset
log_must zfs create $dataset
log_must zfs set canmount=off $dataset
elif [[ $type == "FS" ]]; then
log_must $ZFS create $dataset
log_must zfs create $dataset
else
log_fail "Unrecognised type $type"
fi
@@ -143,7 +143,7 @@ function update_recordsize { #dataset init_code
def_val[idx]=$record_val
def_recordsize=1
elif [[ $init_code == "local" ]]; then
log_must $ZFS set recordsize=$record_val $dataset
log_must zfs set recordsize=$record_val $dataset
local_val[idx]=$record_val
fi
}
@@ -332,13 +332,13 @@ function scan_state { #state-file
log_note "No operation specified"
else
export __ZFS_POOL_RESTRICT="TESTPOOL"
log_must $ZFS unmount -a
log_must zfs unmount -a
unset __ZFS_POOL_RESTRICT
for p in ${prop[i]} ${prop[((i+1))]}; do
$ZFS $op $p $target
zfs $op $p $target
ret=$?
check_failure $ret "$ZFS $op $p \
check_failure $ret "zfs $op $p \
$target"
done
fi