mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +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
@@ -1,2 +0,0 @@
|
||||
/commands.cfg
|
||||
/default.cfg
|
||||
@@ -0,0 +1,156 @@
|
||||
#
|
||||
# These variables are used by zfs-tests.sh to constrain which utilities
|
||||
# may be used by the suite. The suite will create a directory which is
|
||||
# the only element of $PATH and create symlinks from that dir to the
|
||||
# binaries listed below.
|
||||
#
|
||||
# Please keep the contents of each variable sorted for ease of reading
|
||||
# and maintenance.
|
||||
#
|
||||
export SYSTEM_FILES='arp
|
||||
awk
|
||||
attr
|
||||
basename
|
||||
bc
|
||||
blockdev
|
||||
bunzip2
|
||||
bzcat
|
||||
cat
|
||||
chattr
|
||||
chgrp
|
||||
chmod
|
||||
chown
|
||||
cksum
|
||||
cmp
|
||||
cp
|
||||
cpio
|
||||
cut
|
||||
date
|
||||
dd
|
||||
df
|
||||
diff
|
||||
dirname
|
||||
du
|
||||
echo
|
||||
egrep
|
||||
exportfs
|
||||
expr
|
||||
false
|
||||
fdisk
|
||||
file
|
||||
find
|
||||
fio
|
||||
getconf
|
||||
getent
|
||||
getfacl
|
||||
grep
|
||||
groupadd
|
||||
groupdel
|
||||
groupmod
|
||||
gunzip
|
||||
gzip
|
||||
head
|
||||
hostname
|
||||
id
|
||||
iostat
|
||||
kill
|
||||
ksh
|
||||
ln
|
||||
logname
|
||||
ls
|
||||
lsblk
|
||||
lsmod
|
||||
lsscsi
|
||||
md5sum
|
||||
mkdir
|
||||
mknod
|
||||
mktemp
|
||||
modprobe
|
||||
mount
|
||||
mpstat
|
||||
mv
|
||||
net
|
||||
openssl
|
||||
parted
|
||||
pax
|
||||
pgrep
|
||||
ping
|
||||
pkill
|
||||
printf
|
||||
ps
|
||||
pwd
|
||||
python
|
||||
quotaon
|
||||
readlink
|
||||
rm
|
||||
rmdir
|
||||
sed
|
||||
seq
|
||||
setenforce
|
||||
setfacl
|
||||
setfattr
|
||||
sh
|
||||
sha256sum
|
||||
shuf
|
||||
sleep
|
||||
sort
|
||||
stat
|
||||
strings
|
||||
su
|
||||
sudo
|
||||
sum
|
||||
swapon
|
||||
sync
|
||||
tail
|
||||
tar
|
||||
timeout
|
||||
touch
|
||||
tr
|
||||
true
|
||||
truncate
|
||||
udevadm
|
||||
umask
|
||||
umount
|
||||
uname
|
||||
useradd
|
||||
userdel
|
||||
usermod
|
||||
uuidgen
|
||||
vmstat
|
||||
wait
|
||||
wc
|
||||
which
|
||||
xargs'
|
||||
|
||||
export ZFS_FILES='zdb
|
||||
zfs
|
||||
zhack
|
||||
zinject
|
||||
zpool
|
||||
ztest
|
||||
zpios
|
||||
raidz_test
|
||||
arc_summary.py
|
||||
arcstat.py
|
||||
dbufstat.py
|
||||
zed'
|
||||
|
||||
export ZFSTEST_FILES='chg_usr_exec
|
||||
devname2devid
|
||||
dir_rd_update
|
||||
file_check
|
||||
file_trunc
|
||||
file_write
|
||||
largest_file
|
||||
mkbusy
|
||||
mkfile
|
||||
mkfiles
|
||||
mktree
|
||||
mmap_exec
|
||||
mmapwrite
|
||||
randfree_file
|
||||
readmmap
|
||||
rename_dir
|
||||
rm_lnkcnt_zero_file
|
||||
threadsappend
|
||||
xattrtest'
|
||||
@@ -1,133 +0,0 @@
|
||||
export AWK="@AWK@"
|
||||
export BLOCKDEV="@BLOCKDEV@"
|
||||
export BASENAME="@BASENAME@"
|
||||
export BC="@BC@"
|
||||
export BUNZIP2="@BUNZIP2@"
|
||||
export BZCAT="@BZCAT@"
|
||||
export CAT="@CAT@"
|
||||
export CD="@CD@"
|
||||
export CHACL="@CHACL@"
|
||||
export CHGRP="@CHGRP@"
|
||||
export CHMOD="@CHMOD@"
|
||||
export CHOWN="@CHOWN@"
|
||||
export CKSUM="@CKSUM@"
|
||||
export CMP="@CMP@"
|
||||
export COMPRESS="@COMPRESS@"
|
||||
export COREADM="@COREADM@"
|
||||
export CP="@CP@"
|
||||
export CPIO="@CPIO@"
|
||||
export CUT="@CUT@"
|
||||
export DATE="@DATE@"
|
||||
export DD="@DD@"
|
||||
export DF="@DF@"
|
||||
export DIFF="@DIFF@"
|
||||
export DIRCMP="@DIRCMP@"
|
||||
export DIRNAME="@DIRNAME@"
|
||||
export DU="@DU@"
|
||||
export DUMPADM="@DUMPADM@"
|
||||
export ECHO="@ECHO@"
|
||||
export EGREP="@EGREP@"
|
||||
export FALSE="@FALSE@"
|
||||
export FDISK="@FDISK@"
|
||||
export FGREP="@FGREP@"
|
||||
export FILE="@FILE@"
|
||||
export FIND="@FIND@"
|
||||
export FIO="@FIO@"
|
||||
export FORMAT="@FORMAT@"
|
||||
export FREE="@FREE@"
|
||||
export FSCK="@FSCK@"
|
||||
export GETENT="@GETENT@"
|
||||
export GETFACL="@GETFACL@"
|
||||
export GETMAJOR="@GETMAJOR@"
|
||||
export GNUDD="@GNUDD@"
|
||||
export GREP="@GREP@"
|
||||
export GROUPADD="@GROUPADD@"
|
||||
export GROUPDEL="@GROUPDEL@"
|
||||
export GROUPMOD="@GROUPMOD@"
|
||||
export HEAD="@HEAD@"
|
||||
export HOSTNAME="@HOSTNAME@"
|
||||
export ID="@ID@"
|
||||
export IOSTAT="@IOSTAT@"
|
||||
export KILL="@KILL@"
|
||||
export KSH="@KSH@"
|
||||
export KSTAT="@KSTAT@"
|
||||
export LOCKFS="@LOCKFS@"
|
||||
export LOFIADM="@LOFIADM@"
|
||||
export LOGNAME="@LOGNAME@"
|
||||
export LS="@LS@"
|
||||
export LSBLK="@LSBLK@"
|
||||
export LSMOD="@LSMOD@"
|
||||
export LSSCSI="@LSSCSI@"
|
||||
export MD5SUM="@MD5SUM@"
|
||||
export MKDIR="@MKDIR@"
|
||||
export MKNOD="@MKNOD@"
|
||||
export MKTEMP="@MKTEMP@"
|
||||
export MNTTAB="@MNTTAB@"
|
||||
export MODINFO="@MODINFO@"
|
||||
export MODLOAD="@MODLOAD@"
|
||||
export MODUNLOAD="@MODUNLOAD@"
|
||||
export MOUNT="@MOUNT@"
|
||||
export MPSTAT="@MPSTAT@"
|
||||
export MV="@MV@"
|
||||
export NAWK="@AWK@"
|
||||
export NET="@NET@"
|
||||
export NEWFS="@NEWFS@"
|
||||
export NPROC="@NPROC@"
|
||||
export PAGESIZE="@PAGESIZE@"
|
||||
export PFEXEC="@PFEXEC@"
|
||||
export PGREP="@PGREP@"
|
||||
export PING="@PING@"
|
||||
export PKGINFO="@PKGINFO@"
|
||||
export PKILL="@PKILL@"
|
||||
export PRINTF="@PRINTF@"
|
||||
export PRTVTOC="@PRTVTOC@"
|
||||
export PS="@PS@"
|
||||
export PSRINFO="@PSRINFO@"
|
||||
export PYTHON="@PYTHON@"
|
||||
export READLINK="@READLINK@"
|
||||
export REBOOT="@REBOOT@"
|
||||
export RM="@RM@"
|
||||
export RMDIR="@RMDIR@"
|
||||
export RSH="@RSH@"
|
||||
export SED="@SED@"
|
||||
export SETFACL="@SETFACL@"
|
||||
export SHARE="@SHARE@"
|
||||
export SHUF="@SHUF@"
|
||||
export SLEEP="@SLEEP@"
|
||||
export SORT="@SORT@"
|
||||
export STAT="@STAT@"
|
||||
export STRINGS="@STRINGS@"
|
||||
export SU="@SU@"
|
||||
export SUM="@SUM@"
|
||||
export SVCADM="@SVCADM@"
|
||||
export SVCS="@SVCS@"
|
||||
export SWAP="@SWAP@"
|
||||
export SWAPADD="@SWAPADD@"
|
||||
export SYNC="@SYNC@"
|
||||
export TAIL="@TAIL@"
|
||||
export TAR="@TAR@"
|
||||
export TIMEOUT="@TIMEOUT@"
|
||||
export TOUCH="@TOUCH@"
|
||||
export TR="@TR@"
|
||||
export TRUNCATE="@TRUNCATE@"
|
||||
export TRUE="@TRUE@"
|
||||
export UDEVADM="@UDEVADM@"
|
||||
export UFSDUMP="@UFSDUMP@"
|
||||
export UFSRESTORE="@UFSRESTORE@"
|
||||
export UMASK="@UMASK@"
|
||||
export UMOUNT="@UMOUNT@"
|
||||
export UMOUNTALL="@UMOUNTALL@"
|
||||
export UNAME="@UNAME@"
|
||||
export UNCOMPRESS="@UNCOMPRESS@"
|
||||
export UNIQ="@UNIQ@"
|
||||
export UNSHARE="@UNSHARE@"
|
||||
export USERADD="@USERADD@"
|
||||
export USERDEL="@USERDEL@"
|
||||
export USERMOD="@USERMOD@"
|
||||
export UUIDGEN="@UUIDGEN@"
|
||||
export VMSTAT="@VMSTAT@"
|
||||
export WAIT="@WAIT@"
|
||||
export WC="@WC@"
|
||||
export ZONEADM="@ZONEADM@"
|
||||
export ZONECFG="@ZONECFG@"
|
||||
export ZONENAME="@ZONENAME@"
|
||||
@@ -30,35 +30,10 @@
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/commands.cfg
|
||||
|
||||
# Common paths
|
||||
bindir=@bindir@
|
||||
sbindir=@sbindir@
|
||||
etcdir=@sysconfdir@
|
||||
|
||||
# ZFS Directories
|
||||
export ZEDLETDIR=${ZEDLETDIR:-${etcdir}/zfs/zed.d}
|
||||
|
||||
# ZFS Commands
|
||||
export ZDB=${ZDB:-${sbindir}/zdb}
|
||||
export ZFS=${ZFS:-${sbindir}/zfs}
|
||||
export ZHACK=${ZHACK:-${sbindir}/zhack}
|
||||
export ZINJECT=${ZINJECT:-${sbindir}/zinject}
|
||||
export ZPOOL=${ZPOOL:-${sbindir}/zpool}
|
||||
export ZTEST=${ZTEST:-${sbindir}/ztest}
|
||||
export ZPIOS=${ZPIOS:-${sbindir}/zpios}
|
||||
export RAIDZ_TEST=${RAIDZ_TEST:-${bindir}/raidz_test}
|
||||
export ARC_SUMMARY=${ARC_SUMMARY:-${bindir}/arc_summary.py}
|
||||
export ARCSTAT=${ARCSTAT:-${bindir}/arcstat.py}
|
||||
export DBUFSTAT=${DBUFSTAT:-${bindir}/dbufstat.py}
|
||||
export ZED=${ZED:-${sbindir}/zed}
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
# Optionally override the installed ZFS commands to run in-tree
|
||||
if [[ -f "$SRCDIR/zfs-script-config.sh" ]]; then
|
||||
. $SRCDIR/zfs-script-config.sh
|
||||
fi
|
||||
# ZFS Directories
|
||||
export ZEDLETDIR=${ZEDLETDIR:-/etc/zfs/zed.d}
|
||||
|
||||
# Define run length constants
|
||||
export RT_LONG="3"
|
||||
@@ -69,28 +44,6 @@ export RT_SHORT="1"
|
||||
export ZONE_POOL="zonepool"
|
||||
export ZONE_CTR="zonectr"
|
||||
|
||||
# Test Suite Specific Commands
|
||||
helperdir=@datarootdir@/@PACKAGE@/zfs-tests/bin
|
||||
export CHG_USR_EXEC=${CHG_USR_EXEC:-${helperdir}/chg_usr_exec}
|
||||
export DEVNAME2DEVID=${DEVNAME2DEVID:-${helperdir}/devname2devid}
|
||||
export DIR_RD_UPDATE=${DIR_RD_UPDATE:-${helperdir}/dir_rd_update}
|
||||
export FILE_CHECK=${FILE_CHECK:-${helperdir}/file_check}
|
||||
export FILE_TRUNC=${FILE_TRUNC:-${helperdir}/file_trunc}
|
||||
export FILE_WRITE=${FILE_WRITE:-${helperdir}/file_write}
|
||||
export LARGEST_FILE=${LARGEST_FILE:-${helperdir}/largest_file}
|
||||
export MKBUSY=${MKBUSY:-${helperdir}/mkbusy}
|
||||
export MKFILE=${MKFILE:-${helperdir}/mkfile}
|
||||
export MKFILES=${MKFILES:-${helperdir}/mkfiles}
|
||||
export MKTREE=${MKTREE:-${helperdir}/mktree}
|
||||
export MMAP_EXEC=${MMAP_EXEC:-${helperdir}/mmap_exec}
|
||||
export MMAPWRITE=${MMAPWRITE:-${helperdir}/mmapwrite}
|
||||
export RANDFREE_FILE=${RANDFREE_FILE:-${helperdir}/randfree_file}
|
||||
export READMMAP=${READMMAP:-${helperdir}/readmmap}
|
||||
export RENAME_DIR=${RENAME_DIR:-${helperdir}/rename_dir}
|
||||
export RM_LNKCNT_ZERO_FILE=${RM_LNKCNT_ZERO_FILE:-${helperdir}/rm_lnkcnt_zero_file}
|
||||
export THREADSAPPEND=${THREADSAPPEND:-${helperdir}/threadsappend}
|
||||
export XATTRTEST=${XATTRTEST:-${helperdir}/xattrtest}
|
||||
|
||||
# ensure we're running in the C locale, since
|
||||
# localised messages may result in test failures
|
||||
export LC_ALL="C"
|
||||
@@ -181,6 +134,10 @@ export SPA_MINDEVSIZE=$((64 * 1024 * 1024))
|
||||
# For iscsi target support
|
||||
export ISCSITGTFILE=/tmp/iscsitgt_file
|
||||
export ISCSITGT_FMRI=svc:/system/iscsitgt:default
|
||||
if ! is_linux; then
|
||||
export AUTO_SNAP=$(svcs -a | grep auto-snapshot | grep online | awk \
|
||||
'{print $3}')
|
||||
fi
|
||||
|
||||
#
|
||||
# finally, if we're running in a local zone
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -30,14 +30,14 @@ function within_percent
|
||||
typeset percent=$3
|
||||
|
||||
# Set $a or $b to $2 such that a >= b
|
||||
[[ '1' = $($ECHO "if ($2 > $a) 1" | $BC) ]] && a=$2 || b=$2
|
||||
[[ '1' = $(echo "if ($2 > $a) 1" | bc) ]] && a=$2 || b=$2
|
||||
|
||||
# Prevent division by 0
|
||||
[[ $a =~ [1-9] ]] || return 1
|
||||
|
||||
typeset p=$($ECHO "scale=2; $b * 100 / $a" | $BC)
|
||||
typeset p=$(echo "scale=2; $b * 100 / $a" | bc)
|
||||
log_note "Comparing $a and $b given $percent% (calculated: $p%)"
|
||||
[[ '1' = $($ECHO "scale=2; if ($p >= $percent) 1" | $BC) ]] && return 0
|
||||
[[ '1' = $(echo "scale=2; if ($p >= $percent) 1" | bc) ]] && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
typeset -a compress_props=('on' 'off' 'lzjb' 'gzip' 'gzip-1' 'gzip-2' 'gzip-3'
|
||||
@@ -37,7 +37,7 @@ function get_rand_prop
|
||||
|
||||
typeset prop_max=$((${#prop_array[@]} - 1))
|
||||
typeset -i i
|
||||
for i in $($SHUF -i $start-$prop_max -n $num_props); do
|
||||
for i in $(shuf -i $start-$prop_max -n $num_props); do
|
||||
retstr="${prop_array[$i]} $retstr"
|
||||
done
|
||||
echo $retstr
|
||||
|
||||
Reference in New Issue
Block a user