mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-27 04:32:16 +03:00
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:
committed by
Brian Behlendorf
parent
7a4500a101
commit
c1d9abf905
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -38,7 +38,7 @@ function pool_in_cache {
|
||||
# the given cachefile, default is /etc/zfs/zpool.cache
|
||||
typeset cachefile=${2:-$CPATH}
|
||||
|
||||
RESULT=$($STRINGS $cachefile | $GREP -w $1)
|
||||
RESULT=$(strings $cachefile | grep -w $1)
|
||||
if [ -z "$RESULT" ]
|
||||
then
|
||||
return 1
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -56,7 +56,7 @@ function cleanup
|
||||
fi
|
||||
for file in $CPATH1 $CPATH2 ; do
|
||||
if [[ -f $file ]] ; then
|
||||
log_must $RM $file
|
||||
log_must rm $file
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -74,7 +74,7 @@ set -A opts "none" "false" "none" \
|
||||
typeset -i i=0
|
||||
|
||||
while (( i < ${#opts[*]} )); do
|
||||
log_must $ZPOOL create -o cachefile=${opts[i]} $TESTPOOL $DISKS
|
||||
log_must zpool create -o cachefile=${opts[i]} $TESTPOOL $DISKS
|
||||
case ${opts[((i+1))]} in
|
||||
false) log_mustnot pool_in_cache $TESTPOOL
|
||||
;;
|
||||
@@ -87,7 +87,7 @@ while (( i < ${#opts[*]} )); do
|
||||
log_fail "cachefile property not set as expected. " \
|
||||
"Expect: ${opts[((i+2))]}, Current: $PROP"
|
||||
fi
|
||||
log_must $ZPOOL destroy $TESTPOOL
|
||||
log_must zpool destroy $TESTPOOL
|
||||
(( i = i + 3 ))
|
||||
done
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -61,22 +61,22 @@ verify_runnable "global"
|
||||
log_assert "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZPOOL create -o cachefile=none $TESTPOOL $DISKS
|
||||
log_must zpool create -o cachefile=none $TESTPOOL $DISKS
|
||||
typeset DEVICEDIR=$(get_device_dir $DISKS)
|
||||
log_mustnot pool_in_cache $TESTPOOL
|
||||
|
||||
log_must $ZPOOL export $TESTPOOL
|
||||
log_must $ZPOOL import -d $DEVICEDIR $TESTPOOL
|
||||
log_must zpool export $TESTPOOL
|
||||
log_must zpool import -d $DEVICEDIR $TESTPOOL
|
||||
log_must pool_in_cache $TESTPOOL
|
||||
|
||||
log_must $ZPOOL export $TESTPOOL
|
||||
log_must $ZPOOL import -o cachefile=none -d $DEVICEDIR $TESTPOOL
|
||||
log_must zpool export $TESTPOOL
|
||||
log_must zpool import -o cachefile=none -d $DEVICEDIR $TESTPOOL
|
||||
log_mustnot pool_in_cache $TESTPOOL
|
||||
|
||||
log_must $ZPOOL export $TESTPOOL
|
||||
log_must $ZPOOL import -o cachefile=$CPATH -d $DEVICEDIR $TESTPOOL
|
||||
log_must zpool export $TESTPOOL
|
||||
log_must zpool import -o cachefile=$CPATH -d $DEVICEDIR $TESTPOOL
|
||||
log_must pool_in_cache $TESTPOOL
|
||||
|
||||
log_must $ZPOOL destroy $TESTPOOL
|
||||
log_must zpool destroy $TESTPOOL
|
||||
|
||||
log_pass "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -56,13 +56,13 @@ function cleanup
|
||||
|
||||
for file in $CPATH1 $CPATH2 ; do
|
||||
if [[ -f $file ]] ; then
|
||||
log_must $RM $file
|
||||
log_must rm $file
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d $TESTDIR ]
|
||||
then
|
||||
$RMDIR $TESTDIR
|
||||
rmdir $TESTDIR
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ set -A opts "none" "none" \
|
||||
|
||||
|
||||
while (( i < ${#opts[*]} )); do
|
||||
log_must $ZPOOL create -o altroot=$TESTDIR -o cachefile=${opts[i]} \
|
||||
log_must zpool create -o altroot=$TESTDIR -o cachefile=${opts[i]} \
|
||||
$TESTPOOL $DISKS
|
||||
if [[ ${opts[i]} != none ]]; then
|
||||
log_must pool_in_cache $TESTPOOL ${opts[i]}
|
||||
@@ -93,7 +93,7 @@ while (( i < ${#opts[*]} )); do
|
||||
log_fail "cachefile property not set as expected. " \
|
||||
"Expect: ${opts[((i+1))]}, Current: $PROP"
|
||||
fi
|
||||
log_must $ZPOOL destroy $TESTPOOL
|
||||
log_must zpool destroy $TESTPOOL
|
||||
(( i = i + 2 ))
|
||||
done
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -59,7 +59,7 @@ function cleanup
|
||||
typeset -i i=0
|
||||
while ((i < 2)); do
|
||||
if [[ -e $mntpnt/vdev$i ]]; then
|
||||
log_must $RM -f $mntpnt/vdev$i
|
||||
log_must rm -f $mntpnt/vdev$i
|
||||
fi
|
||||
((i += 1))
|
||||
done
|
||||
@@ -70,7 +70,7 @@ function cleanup
|
||||
|
||||
for file in $CPATH1 $CPATH2 ; do
|
||||
if [[ -f $file ]] ; then
|
||||
log_must $RM $file
|
||||
log_must rm $file
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -79,44 +79,44 @@ function cleanup
|
||||
log_assert "Verify set, export and destroy when cachefile is set on pool."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must $ZPOOL create $TESTPOOL $DISKS
|
||||
log_must zpool create $TESTPOOL $DISKS
|
||||
|
||||
mntpnt=$(get_prop mountpoint $TESTPOOL)
|
||||
typeset -i i=0
|
||||
while ((i < 2)); do
|
||||
log_must $MKFILE $MINVDEVSIZE $mntpnt/vdev$i
|
||||
log_must mkfile $MINVDEVSIZE $mntpnt/vdev$i
|
||||
eval vdev$i=$mntpnt/vdev$i
|
||||
((i += 1))
|
||||
done
|
||||
|
||||
log_must $ZPOOL create -o cachefile=$CPATH1 $TESTPOOL1 $vdev0
|
||||
log_must zpool create -o cachefile=$CPATH1 $TESTPOOL1 $vdev0
|
||||
log_must pool_in_cache $TESTPOOL1 $CPATH1
|
||||
log_must $ZPOOL create -o cachefile=$CPATH1 $TESTPOOL2 $vdev1
|
||||
log_must zpool create -o cachefile=$CPATH1 $TESTPOOL2 $vdev1
|
||||
log_must pool_in_cache $TESTPOOL2 $CPATH1
|
||||
|
||||
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL1
|
||||
log_must zpool set cachefile=$CPATH2 $TESTPOOL1
|
||||
log_must pool_in_cache $TESTPOOL1 $CPATH2
|
||||
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL2
|
||||
log_must zpool set cachefile=$CPATH2 $TESTPOOL2
|
||||
log_must pool_in_cache $TESTPOOL2 $CPATH2
|
||||
if [[ -f $CPATH1 ]]; then
|
||||
log_fail "Verify set when cachefile is set on pool."
|
||||
fi
|
||||
|
||||
log_must $ZPOOL export $TESTPOOL1
|
||||
log_must $ZPOOL export $TESTPOOL2
|
||||
log_must zpool export $TESTPOOL1
|
||||
log_must zpool export $TESTPOOL2
|
||||
if [[ -f $CPATH2 ]]; then
|
||||
log_fail "Verify export when cachefile is set on pool."
|
||||
fi
|
||||
|
||||
log_must $ZPOOL import -d $mntpnt $TESTPOOL1
|
||||
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL1
|
||||
log_must zpool import -d $mntpnt $TESTPOOL1
|
||||
log_must zpool set cachefile=$CPATH2 $TESTPOOL1
|
||||
log_must pool_in_cache $TESTPOOL1 $CPATH2
|
||||
log_must $ZPOOL import -d $mntpnt $TESTPOOL2
|
||||
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL2
|
||||
log_must zpool import -d $mntpnt $TESTPOOL2
|
||||
log_must zpool set cachefile=$CPATH2 $TESTPOOL2
|
||||
log_must pool_in_cache $TESTPOOL2 $CPATH2
|
||||
|
||||
log_must $ZPOOL destroy $TESTPOOL1
|
||||
log_must $ZPOOL destroy $TESTPOOL2
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
log_must zpool destroy $TESTPOOL2
|
||||
if [[ -f $CPATH2 ]]; then
|
||||
log_fail "Verify destroy when cachefile is set on pool."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user