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

1
.gitignore vendored
View File

@ -30,6 +30,7 @@ Makefile.in
#
# Top level generated files specific to this top level dir
#
/bin
/configure
/config.log
/config.status

View File

@ -1,185 +0,0 @@
dnl #
dnl # Commands common to multiple platforms. They generally behave
dnl # in the same way and take similar options.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_COMMANDS_COMMON], [
AC_PATH_TOOL(AWK, awk, "")
AC_PATH_TOOL(BASENAME, basename, "")
AC_PATH_TOOL(BC, bc, "")
AC_PATH_TOOL(BUNZIP2, bunzip2, "")
AC_PATH_TOOL(BZCAT, bzcat, "")
AC_PATH_TOOL(CAT, cat, "")
AC_PATH_TOOL(CD, cd, "cd") dnl # Builtin in bash
AC_PATH_TOOL(CHGRP, chgrp, "")
AC_PATH_TOOL(CHMOD, chmod, "")
AC_PATH_TOOL(CHOWN, chown, "")
AC_PATH_TOOL(CKSUM, cksum, "")
AC_PATH_TOOL(CMP, cmp, "")
AC_PATH_TOOL(CP, cp, "")
AC_PATH_TOOL(CPIO, cpio, "")
AC_PATH_TOOL(CUT, cut, "")
AC_PATH_TOOL(DATE, date, "")
AC_PATH_TOOL(DD, dd, "")
AC_PATH_TOOL(DF, df, "")
AC_PATH_TOOL(DIFF, diff, "")
AC_PATH_TOOL(DIRNAME, dirname, "")
AC_PATH_TOOL(DU, du, "")
AC_PATH_TOOL(ECHO, echo, "")
AC_PATH_TOOL(EGREP, egrep, "")
AC_PATH_TOOL(FALSE, false, "")
AC_PATH_TOOL(FDISK, fdisk, "")
AC_PATH_TOOL(FGREP, fgrep, "")
AC_PATH_TOOL(FILE, file, "")
AC_PATH_TOOL(FIND, find, "")
AC_PATH_TOOL(FIO, fio, "")
AC_PATH_TOOL(FSCK, fsck, "")
AC_PATH_TOOL(GNUDD, dd, "")
AC_PATH_TOOL(GETCONF, getconf, "")
AC_PATH_TOOL(GETENT, getent, "")
AC_PATH_TOOL(GREP, grep, "")
dnl # Due to permissions unpriviledged users may not detect group*.
AC_PATH_TOOL(GROUPADD, groupadd, "/usr/sbin/groupadd")
AC_PATH_TOOL(GROUPDEL, groupdel, "/usr/sbin/groupdel")
AC_PATH_TOOL(GROUPMOD, groupmod, "/usr/sbin/groupmod")
AC_PATH_TOOL(HEAD, head, "")
AC_PATH_TOOL(HOSTNAME, hostname, "")
AC_PATH_TOOL(ID, id, "")
AC_PATH_TOOL(KILL, kill, "")
AC_PATH_TOOL(KSH, ksh, "")
AC_PATH_TOOL(LOGNAME, logname, "")
AC_PATH_TOOL(LS, ls, "")
AC_PATH_TOOL(MD5SUM, md5sum, "")
AC_PATH_TOOL(MKDIR, mkdir, "")
AC_PATH_TOOL(MKNOD, mknod, "")
AC_PATH_TOOL(MKTEMP, mktemp, "")
AC_PATH_TOOL(MODINFO, modinfo, "")
AC_PATH_TOOL(MOUNT, mount, "")
AC_PATH_TOOL(MV, mv, "")
AC_PATH_TOOL(NAWK, nawk, "")
AC_PATH_TOOL(PGREP, pgrep, "")
AC_PATH_TOOL(PING, ping, "")
AC_PATH_TOOL(PKILL, pkill, "")
AC_PATH_TOOL(PRINTF, printf, "")
AC_PATH_TOOL(PS, ps, "")
AC_PATH_TOOL(PYTHON, python, "")
AC_PATH_TOOL(REBOOT, reboot, "")
AC_PATH_TOOL(RMDIR, rmdir, "")
AC_PATH_TOOL(RSH, rsh, "")
AC_PATH_TOOL(SED, sed, "")
AC_PATH_TOOL(SHUF, shuf, "")
AC_PATH_TOOL(SLEEP, sleep, "")
AC_PATH_TOOL(SORT, sort, "")
AC_PATH_TOOL(STAT, stat, "")
AC_PATH_TOOL(STRINGS, strings, "")
AC_PATH_TOOL(SU, su, "")
AC_PATH_TOOL(SUM, sum, "")
AC_PATH_TOOL(SYNC, sync, "")
AC_PATH_TOOL(TAIL, tail, "")
AC_PATH_TOOL(TAR, tar, "")
AC_PATH_TOOL(TIMEOUT, timeout, "")
AC_PATH_TOOL(TOUCH, touch, "")
AC_PATH_TOOL(TR, tr, "")
AC_PATH_TOOL(TRUNCATE, truncate, "")
AC_PATH_TOOL(TRUE, true, "")
AC_PATH_TOOL(UMASK, umask, "")
AC_PATH_TOOL(UMOUNT, umount, "")
AC_PATH_TOOL(UNAME, uname, "")
AC_PATH_TOOL(UNIQ, uniq, "")
dnl # Due to permissions unpriviledged users may not detect user*.
AC_PATH_TOOL(USERADD, useradd, "/usr/sbin/useradd")
AC_PATH_TOOL(USERDEL, userdel, "/usr/sbin/userdel")
AC_PATH_TOOL(USERMOD, usermod, "/usr/sbin/usermod")
AC_PATH_TOOL(UUIDGEN, uuidgen, "")
AC_PATH_TOOL(WAIT, wait, "wait") dnl # Builtin in bash
AC_PATH_TOOL(WC, wc, "")
])
dnl #
dnl # Linux commands, used within 'is_linux' blocks of test scripts.
dnl # These commands may take different command line arguments.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_COMMANDS_LINUX], [
AC_PATH_TOOL(BLOCKDEV, blockdev, "")
AC_PATH_TOOL(CHACL, chacl, "")
AC_PATH_TOOL(COMPRESS, gzip, "")
AC_PATH_TOOL(FORMAT, parted, "")
AC_PATH_TOOL(FREE, free, "")
AC_PATH_TOOL(GETFACL, getfacl, "")
AC_PATH_TOOL(IOSTAT, iostat, "")
AC_PATH_TOOL(LOCKFS, lsof, "")
AC_PATH_TOOL(LSBLK, lsblk, "")
AC_PATH_TOOL(LSMOD, lsmod, "")
AC_PATH_TOOL(LSSCSI, lsscsi, "")
AC_PATH_TOOL(MODLOAD, modprobe, "")
AC_PATH_TOOL(MODUNLOAD, rmmod, "")
AC_PATH_TOOL(MPSTAT, mpstat, "")
AC_PATH_TOOL(NEWFS, mke2fs, "")
AC_PATH_TOOL(NPROC, nproc, "")
AC_PATH_TOOL(PFEXEC, sudo, "")
AC_PATH_TOOL(READLINK, readlink, "")
AC_PATH_TOOL(SETFACL, setfacl, "")
AC_PATH_TOOL(SHARE, exportfs, "")
AC_PATH_TOOL(NET, net, "")
AC_PATH_TOOL(SWAP, swapon, "")
AC_PATH_TOOL(SWAPADD, swapon, "")
AC_PATH_TOOL(UDEVADM, udevadm, "")
AC_PATH_TOOL(UFSDUMP, dump, "")
AC_PATH_TOOL(UFSRESTORE, restore, "")
AC_PATH_TOOL(UNCOMPRESS, gunzip, "")
AC_PATH_TOOL(UNSHARE, exportfs, "")
AC_PATH_TOOL(VMSTAT, vmstat, "")
PAGESIZE=$($GETCONF PAGESIZE)
AC_SUBST(PAGESIZE)
MNTTAB=/proc/self/mounts
AC_SUBST(MNTTAB)
])
dnl #
dnl # BSD style commands, these have been kept in case at some point
dnl # we want to build these packages on a BSD style systems. Otherwise
dnl # they are unused and should be treated as such.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_COMMANDS_BSD], [
AC_PATH_TOOL(COMPRESS, compress, "")
AC_PATH_TOOL(COREADM, coreadm, "")
AC_PATH_TOOL(DIRCMP, dircmp, "")
AC_PATH_TOOL(DUMPADM, dumpadm, "")
AC_PATH_TOOL(FORMAT, format, "")
AC_PATH_TOOL(GETMAJOR, getmajor, "")
AC_PATH_TOOL(KSTAT, kstat, "")
AC_PATH_TOOL(LOCKFS, lockfs, "")
AC_PATH_TOOL(LOFIADM, lofiadm, "")
AC_PATH_TOOL(MODUNLOAD, modunload, "")
AC_PATH_TOOL(NEWFS, newfs, "")
AC_PATH_TOOL(PAGESIZE, pagesize, "")
AC_PATH_TOOL(PFEXEC, pfexec, "")
AC_PATH_TOOL(PKGINFO, pkginfo, "")
AC_PATH_TOOL(PRTVTOC, prtvtoc, "")
AC_PATH_TOOL(PSRINFO, psrinfo, "")
AC_PATH_TOOL(SHARE, share, "")
AC_PATH_TOOL(SVCADM, svcadm, "")
AC_PATH_TOOL(SVCS, svcs, "")
AC_PATH_TOOL(SWAP, swap, "")
AC_PATH_TOOL(SWAPADD, swapadd, "")
AC_PATH_TOOL(UFSDUMP, ufsdump, "")
AC_PATH_TOOL(UFSRESTORE, ufsrestore, "")
AC_PATH_TOOL(UMOUNTALL, umountall, "")
AC_PATH_TOOL(UNCOMPRESS, uncompress, "")
AC_PATH_TOOL(UNSHARE, unshare, "")
AC_PATH_TOOL(ZONEADM, zoneadm, "")
AC_PATH_TOOL(ZONECFG, zonecfg, "")
AC_PATH_TOOL(ZONENAME, zonename, "")
])
AC_DEFUN([ZFS_AC_CONFIG_USER_COMMANDS], [
ZFS_AC_CONFIG_USER_COMMANDS_COMMON
OS=$($UNAME -o)
AS_IF([test "$OS" == "GNU/Linux"], [
ZFS_AC_CONFIG_USER_COMMANDS_LINUX
], [
ZFS_AC_CONFIG_USER_COMMANDS_BSD
])
])

View File

@ -18,7 +18,6 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
ZFS_AC_CONFIG_USER_COMMANDS
ZFS_AC_TEST_FRAMEWORK
AC_CHECK_FUNCS([mlockall])

View File

@ -167,8 +167,6 @@ AC_CONFIG_FILES([
tests/zfs-tests/cmd/threadsappend/Makefile
tests/zfs-tests/cmd/xattrtest/Makefile
tests/zfs-tests/include/Makefile
tests/zfs-tests/include/commands.cfg
tests/zfs-tests/include/default.cfg
tests/zfs-tests/tests/Makefile
tests/zfs-tests/tests/functional/Makefile
tests/zfs-tests/tests/functional/acl/Makefile

View File

@ -29,11 +29,7 @@ else
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
fi
. "$STF_SUITE/include/default.cfg"
PROG=zfs-tests.sh
SUDO=/usr/bin/sudo
SETENFORCE=/usr/sbin/setenforce
VERBOSE=
QUIET=
CLEANUP=1
@ -59,16 +55,16 @@ cleanup() {
if [ $LOOPBACK -eq 1 ]; then
for TEST_LOOPBACK in ${LOOPBACKS}; do
LOOP_DEV=$(basename "$TEST_LOOPBACK")
DM_DEV=$(${SUDO} "${DMSETUP}" ls 2>/dev/null | \
DM_DEV=$(sudo "${DMSETUP}" ls 2>/dev/null | \
grep "${LOOP_DEV}" | cut -f1)
if [ -n "$DM_DEV" ]; then
${SUDO} "${DMSETUP}" remove "${DM_DEV}" ||
sudo "${DMSETUP}" remove "${DM_DEV}" ||
echo "Failed to remove: ${DM_DEV}"
fi
if [ -n "${TEST_LOOPBACK}" ]; then
${SUDO} "${LOSETUP}" -d "${TEST_LOOPBACK}" ||
sudo "${LOSETUP}" -d "${TEST_LOOPBACK}" ||
echo "Failed to remove: ${TEST_LOOPBACK}"
fi
done
@ -77,6 +73,11 @@ cleanup() {
for TEST_FILE in ${FILES}; do
rm -f "${TEST_FILE}" &>/dev/null
done
# Preserve in-tree symlinks to aid debugging.
if [ -z "${INTREE}" -a -d "$STF_PATH" ]; then
rm -Rf "$STF_PATH"
fi
}
trap cleanup EXIT
@ -88,9 +89,9 @@ trap cleanup EXIT
#
cleanup_all() {
local TEST_POOLS
TEST_POOLS=$(${SUDO} "${ZPOOL}" list -H -o name | grep testpool)
TEST_POOLS=$(sudo $ZPOOL list -H -o name | grep testpool)
local TEST_LOOPBACKS
TEST_LOOPBACKS=$(${SUDO} "${LOSETUP}" -a|grep file-vdev|cut -f1 -d:)
TEST_LOOPBACKS=$(sudo "${LOSETUP}" -a|grep file-vdev|cut -f1 -d:)
local TEST_FILES
TEST_FILES=$(ls /var/tmp/file-vdev* 2>/dev/null)
@ -98,21 +99,21 @@ cleanup_all() {
msg "--- Cleanup ---"
msg "Removing pool(s): $(echo "${TEST_POOLS}" | tr '\n' ' ')"
for TEST_POOL in $TEST_POOLS; do
${SUDO} "${ZPOOL}" destroy "${TEST_POOL}"
sudo $ZPOOL destroy "${TEST_POOL}"
done
msg "Removing dm(s): $(${SUDO} "${DMSETUP}" ls |
msg "Removing dm(s): $(sudo "${DMSETUP}" ls |
grep loop | tr '\n' ' ')"
${SUDO} "${DMSETUP}" remove_all
sudo "${DMSETUP}" remove_all
msg "Removing loopback(s): $(echo "${TEST_LOOPBACKS}" | tr '\n' ' ')"
for TEST_LOOPBACK in $TEST_LOOPBACKS; do
${SUDO} "${LOSETUP}" -d "${TEST_LOOPBACK}"
sudo "${LOSETUP}" -d "${TEST_LOOPBACK}"
done
msg "Removing files(s): $(echo "${TEST_FILES}" | tr '\n' ' ')"
for TEST_FILE in $TEST_FILES; do
${SUDO} rm -f "${TEST_FILE}"
sudo rm -f "${TEST_FILE}"
done
}
@ -151,6 +152,81 @@ find_runfile() {
echo "$RESULT"
}
#
# Symlink file if it appears under any of the given paths.
#
create_links() {
local dir_list="$1"
local file_list="$2"
[ -n $STF_PATH ] || fail "STF_PATH wasn't correctly set"
for i in $file_list; do
for j in $dir_list; do
[ ! -e "$STF_PATH/$i" ] || continue
if [ ! -d "$j/$i" -a -e "$j/$i" ]; then
ln -s $j/$i $STF_PATH/$i || \
fail "Couldn't link $i"
break
fi
done
[ ! -e $STF_PATH/$i ] && STF_MISSING_BIN="$STF_MISSING_BIN$i "
done
}
#
# Constrain the path to limit the available binaries to a known set.
# When running in-tree a top level ./bin/ directory is created for
# convenience, otherwise a temporary directory is used.
#
constrain_path() {
. $STF_SUITE/include/commands.cfg
if [ -n "${INTREE}" ]; then
STF_PATH="$BUILDDIR/bin"
if [ ! -d "$STF_PATH" ]; then
mkdir "$STF_PATH"
fi
else
SYSTEMDIR=${SYSTEMDIR:-/var/tmp/constrained_path.XXXX}
STF_PATH=$(/bin/mktemp -d "$SYSTEMDIR")
fi
STF_MISSING_BIN=""
chmod 755 $STF_PATH || fail "Couldn't chmod $STF_PATH"
# Standard system utilities
create_links "/bin /usr/bin /sbin /usr/sbin" "$SYSTEM_FILES"
if [ -z "${INTREE}" ]; then
# Special case links for standard zfs utilities
create_links "/bin /usr/bin /sbin /usr/sbin" "$ZFS_FILES"
# Special case links for zfs test suite utilties
create_links "$TESTSDIR/bin" "$ZFSTEST_FILES"
else
# Special case links for standard zfs utilities
DIRS="$(find "$CMDDIR" -type d \( ! -name .deps -a \
! -name .libs \) -print | tr '\n' ' ')"
create_links "$DIRS" "$ZFS_FILES"
# Special case links for zfs test suite utilties
DIRS="$(find "$TESTSDIR" -type d \( ! -name .deps -a \
! -name .libs \) -print | tr '\n' ' ')"
create_links "$DIRS" "$ZFSTEST_FILES"
fi
# Exceptions
ln -fs $STF_PATH/awk $STF_PATH/nawk
ln -fs /sbin/mkfs.ext2 $STF_PATH/newfs
ln -fs $STF_PATH/gzip $STF_PATH/compress
ln -fs $STF_PATH/gunzip $STF_PATH/uncompress
ln -fs $STF_PATH/exportfs $STF_PATH/share
ln -fs $STF_PATH/exportfs $STF_PATH/unshare
}
#
# Output a useful usage message.
#
@ -312,17 +388,20 @@ if [ "$(sudo whoami)" != "root" ]; then
fail "Passwordless sudo access required."
fi
#
# Constain the available binaries to a known set.
#
constrain_path
#
# Check if ksh exists
#
if [ -z "$(which ksh 2>/dev/null)" ]; then
fail "This test suite requires ksh."
fi
[ -e $STF_PATH/ksh ] || fail "This test suite requires ksh."
#
# Verify the ZFS module stack if loaded.
#
${SUDO} "${ZFS_SH}" &>/dev/null
sudo "${ZFS_SH}" &>/dev/null
#
# Attempt to cleanup all previous state for a new test run.
@ -335,7 +414,7 @@ fi
# By default preserve any existing pools
#
if [ -z "${KEEP}" ]; then
KEEP=$(${SUDO} "${ZPOOL}" list -H -o name)
KEEP=$(sudo $ZPOOL list -H -o name)
if [ -z "${KEEP}" ]; then
KEEP="rpool"
fi
@ -343,11 +422,14 @@ fi
__ZFS_POOL_EXCLUDE="$(echo $KEEP | sed ':a;N;s/\n/ /g;ba')"
. $STF_SUITE/include/default.cfg
msg
msg "--- Configuration ---"
msg "Runfile: $RUNFILE"
msg "STF_TOOLS: $STF_TOOLS"
msg "STF_SUITE: $STF_SUITE"
msg "STF_PATH: $STF_PATH"
#
# No DISKS have been provided so a basic file or loopback based devices
@ -373,8 +455,8 @@ if [ -z "${DISKS}" ]; then
check_loop_utils
for TEST_FILE in ${FILES}; do
TEST_LOOPBACK=$(${SUDO} "${LOSETUP}" -f)
${SUDO} "${LOSETUP}" "${TEST_LOOPBACK}" "${TEST_FILE}" ||
TEST_LOOPBACK=$(sudo "${LOSETUP}" -f)
sudo "${LOSETUP}" "${TEST_LOOPBACK}" "${TEST_FILE}" ||
fail "Failed: ${TEST_FILE} -> ${TEST_LOOPBACK}"
LOOPBACKS="${LOOPBACKS}${TEST_LOOPBACK} "
BASELOOPBACKS=$(basename "$TEST_LOOPBACK")
@ -389,8 +471,8 @@ NUM_DISKS=$(echo "${DISKS}" | $AWK '{print NF}')
#
# Disable SELinux until the ZFS Test Suite has been updated accordingly.
#
if [ -x ${SETENFORCE} ]; then
${SUDO} ${SETENFORCE} permissive &>/dev/null
if [ -x "$STF_PATH/setenforce" ]; then
sudo setenforce permissive &>/dev/null
fi
msg "FILEDIR: $FILEDIR"
@ -400,13 +482,16 @@ msg "DISKS: $DISKS"
msg "NUM_DISKS: $NUM_DISKS"
msg "FILESIZE: $FILESIZE"
msg "Keep pool(s): $KEEP"
msg "Missing util(s): $STF_MISSING_BIN"
msg ""
export STF_TOOLS
export STF_SUITE
export STF_PATH
export DISKS
export KEEP
export __ZFS_POOL_EXCLUDE
export PATH=$STF_PATH
msg "${TEST_RUNNER} ${QUIET} -c ${RUNFILE} -i ${STF_SUITE}"
${TEST_RUNNER} ${QUIET} -c "${RUNFILE}" -i "${STF_SUITE}"

View File

@ -94,10 +94,10 @@ function log_must_retry
while (( $retry > 0 )); do
"$@" 2>$logfile
status=$?
out="$CAT $logfile"
out="cat $logfile"
if (( $status == 0 )); then
$out | $EGREP -i "internal error|assertion failed" \
$out | egrep -i "internal error|assertion failed" \
> /dev/null 2>&1
# internal error or assertion failed
if [[ $? -eq 0 ]]; then
@ -111,11 +111,11 @@ function log_must_retry
fi
break
else
$out | $GREP -i "$expect" > /dev/null 2>&1
$out | grep -i "$expect" > /dev/null 2>&1
if (( $? == 0 )); then
print -u2 $($out)
_printerror "$@" "Retry in $delay seconds"
$SLEEP $delay
sleep $delay
(( retry=retry - 1 ))
(( delay=delay * 2 ))
@ -189,7 +189,7 @@ function log_neg_expect
"$@" 2>$logfile
typeset status=$?
out="$CAT $logfile"
out="cat $logfile"
# unexpected status
if (( $status == 0 )); then
@ -208,7 +208,7 @@ function log_neg_expect
print -u2 $($out)
_printerror "$@" "unexpectedly exited $status (SEGV)"
else
$out | $EGREP -i "internal error|assertion failed" \
$out | egrep -i "internal error|assertion failed" \
> /dev/null 2>&1
# internal error or assertion failed
if (( $? == 0 )); then
@ -216,7 +216,7 @@ function log_neg_expect
_printerror "$@" "internal error or assertion failure" \
" exited $status"
elif [[ -n $expect ]] ; then
$out | $GREP -i "$expect" > /dev/null 2>&1
$out | grep -i "$expect" > /dev/null 2>&1
if (( $? == 0 )); then
ret=0
else
@ -253,13 +253,13 @@ function log_pos
"$@" 2>$logfile
typeset status=$?
out="$CAT $logfile"
out="cat $logfile"
if (( $status != 0 )) ; then
print -u2 $($out)
_printerror "$@" "exited $status"
else
$out | $EGREP -i "internal error|assertion failed" \
$out | egrep -i "internal error|assertion failed" \
> /dev/null 2>&1
# internal error or assertion failed
if [[ $? -eq 0 ]]; then
@ -452,9 +452,9 @@ function _recursive_output #logfile
while [[ -e $logfile ]]; do
if [[ -z $2 || $logfile != $1 ]]; then
$CAT $logfile
cat $logfile
fi
$RM -f $logfile
rm -f $logfile
logfile="$logfile.$$"
done
}

View File

@ -1,2 +0,0 @@
/commands.cfg
/default.cfg

View File

@ -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'

View File

@ -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@"

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -24,6 +24,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/acl/acl.cfg
. $STF_SUITE/include/libtest.shlib
@ -39,7 +43,7 @@ function get_mode #<obj>
return 1
fi
$LS -ld $obj | $AWK '{print $1}'
ls -ld $obj | awk '{print $1}'
}
#
@ -54,7 +58,7 @@ function get_acl #<obj>
return 1
fi
$LS -vd $obj | $NAWK '(NR != 1) {print $0}'
ls -vd $obj | nawk '(NR != 1) {print $0}'
}
#
@ -69,7 +73,7 @@ function get_compact_acl #<obj>
return 1
fi
$LS -Vd $obj | $NAWK '(NR != 1) {print $0}'
ls -Vd $obj | nawk '(NR != 1) {print $0}'
}
#
@ -94,9 +98,9 @@ function compare_acls #<src> <tgt>
get_acl $src > $tmpsrc
get_acl $tgt > $tmptgt
typeset -i ret=0
$DIFF $tmpsrc $tmptgt > /dev/null 2>&1
diff $tmpsrc $tmptgt > /dev/null 2>&1
ret=$?
$RM -f $tmpsrc $tmptgt
rm -f $tmpsrc $tmptgt
if (( ret != 0 )); then
return $ret
@ -104,9 +108,9 @@ function compare_acls #<src> <tgt>
get_compact_acl $src > $tmpsrc
get_compact_acl $tgt > $tmptgt
$DIFF $tmpsrc $tmptgt > /dev/null 2>&1
diff $tmpsrc $tmptgt > /dev/null 2>&1
ret=$?
$RM -f $tmpsrc $tmptgt
rm -f $tmpsrc $tmptgt
return $ret
}
@ -162,9 +166,9 @@ function compare_xattrs #<src> <tgt>
get_xattr $src > $tmpsrc
get_xattr $tgt > $tmptgt
typeset -i ret=0
$DIFF $tmpsrc $tmptgt > /dev/null 2>&1
diff $tmpsrc $tmptgt > /dev/null 2>&1
ret=$?
$RM -f $tmpsrc $tmptgt
rm -f $tmpsrc $tmptgt
return $ret
}
@ -181,7 +185,7 @@ function plus_sign_check_l #<obj>
return 1
fi
$LS -ld $obj | $AWK '{print $1}' | $GREP "+\>" > /dev/null
ls -ld $obj | awk '{print $1}' | grep "+\>" > /dev/null
return $?
}
@ -198,7 +202,7 @@ function plus_sign_check_v #<obj>
return 1
fi
$LS -vd $obj | $NAWK '(NR == 1) {print $1}' | $GREP "+\>" > /dev/null
ls -vd $obj | nawk '(NR == 1) {print $1}' | grep "+\>" > /dev/null
return $?
}
@ -211,7 +215,7 @@ function plus_sign_check_v #<obj>
#
function chgusr_exec #<login_name> <commands> [...]
{
$CHG_USR_EXEC $@
chg_usr_exec $@
return $?
}
@ -232,7 +236,7 @@ function set_cur_usr #<login_name>
#
function usr_exec #<commands> [...]
{
$CHG_USR_EXEC "$ZFS_ACL_CUR_USER" $@
chg_usr_exec "$ZFS_ACL_CUR_USER" $@
return $?
}
@ -248,7 +252,7 @@ function count_ACE #<file or dir name>
return 1
fi
$LS -vd $1 | $NAWK 'BEGIN {count=0}
ls -vd $1 | nawk 'BEGIN {count=0}
(NR != 1)&&(/[0-9]:/) {count++}
END {print count}'
@ -286,8 +290,8 @@ function get_ACE #<file or dir name> <specified number> <verbose|compact>
;;
esac
$LS $args $file > $tmpfile
(( $? != 0 )) && log_fail "FAIL: $LS $args $file > $tmpfile"
ls $args $file > $tmpfile
(( $? != 0 )) && log_fail "FAIL: ls $args $file > $tmpfile"
while read line; do
[[ -z $line ]] && continue
if [[ $args == -vd ]]; then
@ -308,8 +312,8 @@ function get_ACE #<file or dir name> <specified number> <verbose|compact>
fi
done < $tmpfile
$RM -f $tmpfile
(( $? != 0 )) && log_fail "FAIL: $RM -f $tmpfile"
rm -f $tmpfile
(( $? != 0 )) && log_fail "FAIL: rm -f $tmpfile"
}
#
@ -337,7 +341,7 @@ function cleanup
{
if [[ -d $TESTDIR ]]; then
cd $TESTDIR
$RM -rf $TESTDIR/*
rm -rf $TESTDIR/*
fi
}
@ -363,26 +367,26 @@ function rwx_node #user node acl_spec|access
if [[ -d $node ]]; then
case $acl_spec in
*:read_data:*|read_data)
chgusr_exec $user $LS -l $node > /dev/null 2>&1
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
log_must rm -f ${node}/tmpfile
fi
chgusr_exec $user $TOUCH ${node}/tmpfile > \
chgusr_exec $user touch ${node}/tmpfile > \
/dev/null 2>&1
return $? ;;
*"execute:"*|execute)
chgusr_exec $user $FIND $node > /dev/null 2>&1
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
chgusr_exec $user cat $node > /dev/null 2>&1
return $? ;;
*:write_data:*|write_data)
chgusr_exec $user $DD if=/usr/bin/ls of=$node > \
chgusr_exec $user dd if=/usr/bin/ls of=$node > \
/dev/null 2>&1
return $? ;;
*"execute:"*|execute)
@ -405,9 +409,9 @@ function get_xattr #<obj>
return 1
fi
for xattr in `$RUNAT $obj $LS | \
for xattr in `runat $obj ls | \
/usr/xpg4/bin/egrep -v -e SUNWattr_ro -e SUNWattr_rw` ; do
$RUNAT $obj $SUM $xattr
runat $obj sum $xattr
done
}
@ -424,12 +428,12 @@ function get_owner #node
fi
if [[ -d $node ]]; then
value=$($LS -dl $node | $AWK '{print $3}')
value=$(ls -dl $node | awk '{print $3}')
elif [[ -e $node ]]; then
value=$($LS -l $node | $AWK '{print $3}')
value=$(ls -l $node | awk '{print $3}')
fi
$ECHO $value
echo $value
}
#
@ -445,12 +449,12 @@ function get_group #node
fi
if [[ -d $node ]]; then
value=$($LS -dl $node | $AWK '{print $4}')
value=$(ls -dl $node | awk '{print $4}')
elif [[ -e $node ]]; then
value=$($LS -l $node | $AWK '{print $4}')
value=$(ls -l $node | awk '{print $4}')
fi
$ECHO $value
echo $value
}
@ -471,7 +475,7 @@ function get_user_group #uid
if [[ $? -eq 0 ]]; then
value=${value##*\(}
value=${value%%\)*}
$ECHO $value
echo $value
else
log_fail "Invalid UID (uid)."
fi
@ -509,17 +513,17 @@ function cksum_files #<dir> <file_array_name> <attribute_array_name>
[[ ! -d $dir ]] && return
typeset oldpwd=$PWD
cd $dir
typeset files=$($LS file*)
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\)
eval $farr_name[$i]=\$\(\cksum $f\)
typeset -i j=0
while (( j < NUM_ATTR )); do
eval $aarr_name[$n]=\$\(\$RUNAT \$f \$CKSUM \
eval $aarr_name[$n]=\$\(\runat \$f \cksum \
attribute.$j\)
(( j += 1 ))
@ -571,12 +575,12 @@ function record_cksum #<outfile>
typeset dir=$1
typeset outfile=$2
[[ ! -d ${outfile%/*} ]] && usr_exec $MKDIR -p ${outfile%/*}
[[ ! -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
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
}
#
@ -589,20 +593,20 @@ function create_files #<directory>
{
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
[[ ! -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 \
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
usr_exec cp $RES_DIR/file $RES_DIR/attribute
typeset oldpwd=$PWD
cd $INI_DIR
@ -610,12 +614,12 @@ function create_files #<directory>
typeset -i i=0
while (( i < NUM_FILE )); do
typeset dstfile=$INI_DIR/file.$$.$i
usr_exec $CP $RES_DIR/file $dstfile
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
usr_exec runat $dstfile \
cp $RES_DIR/attribute ./attribute.$j
(( j += 1 ))
done

View File

@ -47,20 +47,20 @@ log_assert "Verify acltype=posixacl works on file"
# Test access to FILE
log_note "Testing access to FILE"
log_must $TOUCH $TESTDIR/file.0
log_must $SETFACL -m g:zfsgrp:rw $TESTDIR/file.0
$GETFACL $TESTDIR/file.0 2> /dev/null | $EGREP -q "^group:zfsgrp:rw-$"
log_must touch $TESTDIR/file.0
log_must setfacl -m g:zfsgrp:rw $TESTDIR/file.0
getfacl $TESTDIR/file.0 2> /dev/null | egrep -q "^group:zfsgrp:rw-$"
if [ "$?" -eq "0" ]; then
# Should be able to write to file
log_must $SU staff1 -c "$ECHO \"$ECHO test > /dev/null\" > $TESTDIR/file.0"
log_must su staff1 -c "echo \"echo test > /dev/null\" > $TESTDIR/file.0"
# Should NOT be able to create new file
log_mustnot $SU staff1 -c "$TOUCH $TESTDIR/file.1"
log_mustnot su staff1 -c "touch $TESTDIR/file.1"
# Root should be able to run file, but not user
chmod +x $TESTDIR/file.0
log_must $TESTDIR/file.0
log_mustnot $SU staff1 -c $TESTDIR/file.0
log_mustnot su staff1 -c $TESTDIR/file.0
log_pass "POSIX ACL mode works on files"
else

View File

@ -46,15 +46,15 @@ log_assert "Verify acltype=posixacl works on directory"
# Test access to DIRECTORY
log_note "Testing access to DIRECTORY"
log_must $MKDIR $TESTDIR/dir.0
log_must $SETFACL -m g:zfsgrp:wx $TESTDIR/dir.0
$GETFACL $TESTDIR/dir.0 2> /dev/null | $EGREP -q "^group:zfsgrp:-wx$"
log_must mkdir $TESTDIR/dir.0
log_must setfacl -m g:zfsgrp:wx $TESTDIR/dir.0
getfacl $TESTDIR/dir.0 2> /dev/null | egrep -q "^group:zfsgrp:-wx$"
if [ "$?" -eq "0" ]; then
# Should be able to create file in directory
log_must $SU staff1 -c "$TOUCH $TESTDIR/dir.0/file.0"
log_must su staff1 -c "touch $TESTDIR/dir.0/file.0"
# Should NOT be able to list files in directory
log_mustnot $SU staff1 -c "$LS -l $TESTDIR/dir.0"
log_mustnot su staff1 -c "ls -l $TESTDIR/dir.0"
log_pass "POSIX ACL mode works on directories"
else

View File

@ -42,19 +42,19 @@ typeset acl_str2="^default:group:${ZFS_ACL_STAFF_GROUP}:-wx$"
typeset ACLDIR="${TESTDIR}/dir.1"
log_note "Testing access to DIRECTORY"
log_must $MKDIR $ACLDIR
log_must $SETFACL -m g:${ZFS_ACL_STAFF_GROUP}:wx $ACLDIR
log_must $SETFACL -d -m g:${ZFS_ACL_STAFF_GROUP}:wx $ACLDIR
$GETFACL $ACLDIR 2> /dev/null | $EGREP -q "${acl_str1}"
log_must mkdir $ACLDIR
log_must setfacl -m g:${ZFS_ACL_STAFF_GROUP}:wx $ACLDIR
log_must setfacl -d -m g:${ZFS_ACL_STAFF_GROUP}:wx $ACLDIR
getfacl $ACLDIR 2> /dev/null | egrep -q "${acl_str1}"
if [ "$?" -eq "0" ]; then
$GETFACL $ACLDIR 2> /dev/null | $EGREP -q "${acl_str2}"
getfacl $ACLDIR 2> /dev/null | egrep -q "${acl_str2}"
fi
if [ "$?" -eq "0" ]; then
log_must $ZFS unmount $TESTPOOL/$TESTFS
log_must $ZFS mount $TESTPOOL/$TESTFS
log_must eval '$GETFACL $ACLDIR 2> /dev/null | $EGREP -q "${acl_str1}"'
log_must eval '$GETFACL $ACLDIR 2> /dev/null | $EGREP -q "${acl_str2}"'
log_must zfs unmount $TESTPOOL/$TESTFS
log_must zfs mount $TESTPOOL/$TESTFS
log_must eval 'getfacl $ACLDIR 2> /dev/null | egrep -q "${acl_str1}"'
log_must eval 'getfacl $ACLDIR 2> /dev/null | egrep -q "${acl_str2}"'
log_pass "POSIX ACLs survive remount"
else
log_fail "Group '${ZFS_ACL_STAFF_GROUP}' does not have 'rwx'"

View File

@ -25,11 +25,15 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/acl/acl_common.kshlib
log_must $GETFACL --version
log_must $SETFACL --version
log_must getfacl --version
log_must setfacl --version
cleanup_user_group
@ -39,10 +43,10 @@ log_must add_user $ZFS_ACL_STAFF_GROUP $ZFS_ACL_STAFF1
DISK=${DISKS%% *}
default_setup_noexit $DISK
log_must $CHMOD 777 $TESTDIR
log_must chmod 777 $TESTDIR
# Use POSIX ACLs on filesystem
log_must $ZFS set acltype=posixacl $TESTPOOL/$TESTFS
log_must $ZFS set xattr=sa $TESTPOOL/$TESTFS
log_must zfs set acltype=posixacl $TESTPOOL/$TESTFS
log_must zfs set xattr=sa $TESTPOOL/$TESTFS
log_pass

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/atime/atime_common.kshlib
#
@ -58,8 +62,11 @@ do
mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE
else
log_must $ZFS set atime=on $dst
log_must $ZFS set relatime=off $dst
if is_linux; then
log_must zfs set relatime=off $dst
fi
log_must zfs set atime=on $dst
log_must check_atime_updated $mtpt/$TESTFILE
log_must check_atime_updated $mtpt/$TESTFILE
fi

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/atime/atime_common.kshlib
#
@ -58,7 +62,7 @@ do
if [[ $dst == $TESTPOOL/$TESTFS@$TESTSNAP ]]; then
mtpt=$(snapshot_mountpoint $dst)
else
log_must $ZFS set atime=off $dst
log_must zfs set atime=off $dst
fi
log_mustnot check_atime_updated $mtpt/$TESTFILE

View File

@ -60,8 +60,8 @@ do
mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE
else
log_must $ZFS set atime=on $dst
log_must $ZFS set relatime=on $dst
log_must zfs set atime=on $dst
log_must zfs set relatime=on $dst
log_must check_atime_updated $mtpt/$TESTFILE
log_mustnot check_atime_updated $mtpt/$TESTFILE
fi

View File

@ -24,6 +24,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/atime/atime.cfg
. $STF_SUITE/include/libtest.shlib
@ -44,15 +48,15 @@ function check_atime_updated
typeset before=$(stat -c %X $filename)
sleep 2
else
typeset before=$($LS -Eu $filename | $AWK '{print $7}')
typeset before=$(ls -Eu $filename | awk '{print $7}')
fi
log_must $CAT $filename
log_must cat $filename
if is_linux; then
typeset after=$(stat -c %X $filename)
else
typeset after=$($LS -Eu $filename | $AWK '{print $7}')
typeset after=$(ls -Eu $filename | awk '{print $7}')
fi
if [[ $before != $after ]]; then
@ -65,7 +69,7 @@ function check_atime_updated
function setup_snap_clone
{
# Create two file to verify snapshot.
log_must $TOUCH $TESTDIR/$TESTFILE
log_must touch $TESTDIR/$TESTFILE
create_snapshot $TESTPOOL/$TESTFS $TESTSNAP
create_clone $TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTCLONE

View File

@ -28,7 +28,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -47,15 +47,15 @@ verify_runnable "global"
function cleanup {
if poolexists $TESTPOOL ; then
log_must $ZPOOL destroy $TESTPOOL
log_must zpool destroy $TESTPOOL
fi
if [[ -f $VDEV ]]; then
log_must $RM -f $VDEV
log_must rm -f $VDEV
fi
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
zpool set 2>&1 | grep bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
@ -66,17 +66,17 @@ log_onexit cleanup
typeset VDEV=$TESTDIR/bootfs_001_pos_a.$$.dat
log_must $MKFILE $MINVDEVSIZE $VDEV
log_must mkfile $MINVDEVSIZE $VDEV
create_pool "$TESTPOOL" "$VDEV"
log_must $ZFS create $TESTPOOL/$TESTFS
log_must zfs create $TESTPOOL/$TESTFS
log_must $ZFS snapshot $TESTPOOL/$TESTFS@snap
log_must $ZFS clone $TESTPOOL/$TESTFS@snap $TESTPOOL/clone
log_must zfs snapshot $TESTPOOL/$TESTFS@snap
log_must zfs clone $TESTPOOL/$TESTFS@snap $TESTPOOL/clone
log_must $ZPOOL set bootfs=$TESTPOOL/$TESTFS $TESTPOOL
log_must $ZPOOL set bootfs=$TESTPOOL/$TESTFS@snap $TESTPOOL
log_must $ZPOOL set bootfs=$TESTPOOL/clone $TESTPOOL
log_must zpool set bootfs=$TESTPOOL/$TESTFS $TESTPOOL
log_must zpool set bootfs=$TESTPOOL/$TESTFS@snap $TESTPOOL
log_must zpool set bootfs=$TESTPOOL/clone $TESTPOOL
log_must $ZFS promote $TESTPOOL/clone
log_must $ZPOOL set bootfs=$TESTPOOL/clone $TESTPOOL
log_must zfs promote $TESTPOOL/clone
log_must zpool set bootfs=$TESTPOOL/clone $TESTPOOL
log_pass "Valid datasets are accepted as bootfs property values"

View File

@ -28,7 +28,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,19 +49,19 @@ verify_runnable "global"
function cleanup {
if datasetexists $TESTPOOL/vol
then
log_must $ZFS destroy $TESTPOOL/vol
log_must zfs destroy $TESTPOOL/vol
fi
if poolexists $TESTPOOL
then
log_must $ZPOOL destroy $TESTPOOL
log_must zpool destroy $TESTPOOL
fi
if [[ -f $VDEV ]]; then
log_must $RM -f $VDEV
log_must rm -f $VDEV
fi
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
zpool set 2>&1 | grep bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
@ -72,11 +72,11 @@ log_onexit cleanup
typeset VDEV=$TESTDIR/bootfs_002_neg_a.$$.dat
log_must $MKFILE 400m $VDEV
log_must mkfile 400m $VDEV
create_pool "$TESTPOOL" "$VDEV"
log_must $ZFS create -V 10m $TESTPOOL/vol
log_must zfs create -V 10m $TESTPOOL/vol
block_device_wait
log_mustnot $ZPOOL set bootfs=$TESTPOOL/vol $TESTPOOL
log_mustnot zpool set bootfs=$TESTPOOL/vol $TESTPOOL
log_pass "Invalid datasets are rejected as boot property values"

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -48,13 +48,13 @@ set -A pools "pool.$$" "pool123" "mypool"
function cleanup {
if poolexists $POOL ; then
log_must $ZPOOL destroy $POOL
log_must zpool destroy $POOL
fi
$RM /bootfs_003.$$.dat
rm /bootfs_003.$$.dat
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
zpool set 2>&1 | grep bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
@ -63,23 +63,23 @@ fi
log_onexit cleanup
log_assert "Valid pool names are accepted by zpool set bootfs"
$MKFILE $MINVDEVSIZE $TESTDIR/bootfs_003.$$.dat
mkfile $MINVDEVSIZE $TESTDIR/bootfs_003.$$.dat
typeset -i i=0;
while [ $i -lt "${#pools[@]}" ]
do
POOL=${pools[$i]}
log_must $ZPOOL create $POOL $TESTDIR/bootfs_003.$$.dat
log_must $ZFS create $POOL/$TESTFS
log_must zpool create $POOL $TESTDIR/bootfs_003.$$.dat
log_must zfs create $POOL/$TESTFS
log_must $ZPOOL set bootfs=$POOL/$TESTFS $POOL
RES=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' )
log_must zpool set bootfs=$POOL/$TESTFS $POOL
RES=$(zpool get bootfs $POOL | tail -1 | awk '{print $3}' )
if [ $RES != "$POOL/$TESTFS" ]
then
log_fail "Expected $RES == $POOL/$TESTFS"
fi
log_must $ZPOOL destroy $POOL
log_must zpool destroy $POOL
i=$(( $i + 1 ))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,13 +49,13 @@ set -A pools "pool//$$" "pool%d123" "mirror" "c0t0d0s0" "pool*23*" "*po!l" \
function cleanup {
if poolexists $POOL; then
log_must $ZPOOL destroy $POOL
log_must zpool destroy $POOL
fi
$RM /bootfs_004.$$.dat
rm /bootfs_004.$$.dat
}
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
zpool set 2>&1 | grep bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
@ -78,16 +78,16 @@ pools[${#pools[@]}]="$bigname"
$MKFILE $MINVDEVSIZE $TESTDIR/bootfs_004.$$.dat
mkfile $MINVDEVSIZE $TESTDIR/bootfs_004.$$.dat
typeset -i i=0;
while [ $i -lt "${#pools[@]}" ]
do
POOL=${pools[$i]}/$TESTFS
log_mustnot $ZPOOL create $POOL $TESTDIR/bootfs_004.$$.dat
log_mustnot $ZFS create $POOL/$TESTFS
log_mustnot $ZPOOL set bootfs=$POOL/$TESTFS $POOL
log_mustnot zpool create $POOL $TESTDIR/bootfs_004.$$.dat
log_mustnot zfs create $POOL/$TESTFS
log_mustnot zpool set bootfs=$POOL/$TESTFS $POOL
i=$(( $i + 1 ))
done

View File

@ -52,7 +52,7 @@ function cleanup {
#
typeset pool_name
for config in $CONFIGS; do
pool_name=$(eval $ECHO \$ZPOOL_VERSION_${config}_NAME)
pool_name=$(eval echo \$ZPOOL_VERSION_${config}_NAME)
destroy_pool $pool_name
done
@ -65,14 +65,14 @@ log_assert "Boot properties cannot be set on pools with older versions"
CONFIGS="1 2 3"
log_onexit cleanup
log_must $ZPOOL create -f $TESTPOOL $DISKS
log_must zpool create -f $TESTPOOL $DISKS
for config in $CONFIGS
do
create_old_pool $config
POOL_NAME=$(eval $ECHO \$ZPOOL_VERSION_${config}_NAME)
log_must $ZFS create $POOL_NAME/$TESTFS
log_mustnot $ZPOOL set bootfs=$POOL_NAME/$TESTFS $POOL_NAME
POOL_NAME=$(eval echo \$ZPOOL_VERSION_${config}_NAME)
log_must zfs create $POOL_NAME/$TESTFS
log_mustnot zpool set bootfs=$POOL_NAME/$TESTFS $POOL_NAME
log_must destroy_upgraded_pool $config
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -44,7 +44,7 @@
verify_runnable "global"
$ZPOOL set 2>&1 | $GREP bootfs > /dev/null
zpool set 2>&1 | grep bootfs > /dev/null
if [ $? -ne 0 ]
then
log_unsupported "bootfs pool property not supported on this release."
@ -57,38 +57,38 @@ VDEV4=$TESTDIR/bootfs_006_pos_d.$$.dat
function verify_bootfs { # $POOL
POOL=$1
log_must $ZFS create $POOL/$TESTFS
log_must zfs create $POOL/$TESTFS
log_must $ZPOOL set bootfs=$POOL/$TESTFS $POOL
VAL=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' )
log_must zpool set bootfs=$POOL/$TESTFS $POOL
VAL=$(zpool get bootfs $POOL | tail -1 | awk '{print $3}' )
if [ $VAL != "$POOL/$TESTFS" ]
then
log_must $ZPOOL status -v $POOL
log_must zpool status -v $POOL
log_fail \
"set/get failed on $POOL - expected $VAL == $POOL/$TESTFS"
fi
log_must $ZPOOL destroy $POOL
log_must zpool destroy $POOL
}
function verify_no_bootfs { # $POOL
POOL=$1
log_must $ZFS create $POOL/$TESTFS
log_mustnot $ZPOOL set bootfs=$POOL/$TESTFS $POOL
VAL=$($ZPOOL get bootfs $POOL | $TAIL -1 | $AWK '{print $3}' )
log_must zfs create $POOL/$TESTFS
log_mustnot zpool set bootfs=$POOL/$TESTFS $POOL
VAL=$(zpool get bootfs $POOL | tail -1 | awk '{print $3}' )
if [ $VAL == "$POOL/$TESTFS" ]
then
log_must $ZPOOL status -v $POOL
log_must zpool status -v $POOL
log_fail "set/get unexpectedly failed $VAL != $POOL/$TESTFS"
fi
log_must $ZPOOL destroy $POOL
log_must zpool destroy $POOL
}
function cleanup {
if poolexists $TESTPOOL
then
log_must $ZPOOL destroy $TESTPOOL
log_must zpool destroy $TESTPOOL
fi
log_must $RM $VDEV1 $VDEV2 $VDEV3 $VDEV4
log_must rm $VDEV1 $VDEV2 $VDEV3 $VDEV4
}
log_assert "Pools of correct vdev types accept boot property"
@ -96,51 +96,51 @@ log_assert "Pools of correct vdev types accept boot property"
log_onexit cleanup
log_must $MKFILE $MINVDEVSIZE $VDEV1 $VDEV2 $VDEV3 $VDEV4
log_must mkfile $MINVDEVSIZE $VDEV1 $VDEV2 $VDEV3 $VDEV4
## the following configurations are supported bootable pools
# normal
log_must $ZPOOL create $TESTPOOL $VDEV1
log_must zpool create $TESTPOOL $VDEV1
verify_bootfs $TESTPOOL
# normal + hotspare
log_must $ZPOOL create $TESTPOOL $VDEV1 spare $VDEV2
log_must zpool create $TESTPOOL $VDEV1 spare $VDEV2
verify_bootfs $TESTPOOL
# mirror
log_must $ZPOOL create $TESTPOOL mirror $VDEV1 $VDEV2
log_must zpool create $TESTPOOL mirror $VDEV1 $VDEV2
verify_bootfs $TESTPOOL
# mirror + hotspare
log_must $ZPOOL create $TESTPOOL mirror $VDEV1 $VDEV2 spare $VDEV3
log_must zpool create $TESTPOOL mirror $VDEV1 $VDEV2 spare $VDEV3
verify_bootfs $TESTPOOL
## the following configurations are not supported as bootable pools
# stripe
log_must $ZPOOL create $TESTPOOL $VDEV1 $VDEV2
log_must zpool create $TESTPOOL $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
# stripe + hotspare
log_must $ZPOOL create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
# raidz
log_must $ZPOOL create $TESTPOOL raidz $VDEV1 $VDEV2
log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
# raidz + hotspare
log_must $ZPOOL create $TESTPOOL raidz $VDEV1 $VDEV2 spare $VDEV3
log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
# raidz2
log_must $ZPOOL create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3
log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3
verify_no_bootfs $TESTPOOL
# raidz2 + hotspare
log_must $ZPOOL create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 spare $VDEV4
log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 spare $VDEV4
verify_no_bootfs $TESTPOOL
log_pass "Pools of correct vdev types accept boot property"

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
@ -56,12 +60,12 @@ typeset assert_mesg="setting bootfs on a pool which was configured with the \
log_assert $assert_mesg
create_pool "$TESTPOOL" "$DISK"
log_must $ZFS create $EFI_BOOTFS
log_must zfs create $EFI_BOOTFS
if is_linux; then
log_must $ZPOOL set bootfs=$EFI_BOOTFS $TESTPOOL
log_must zpool set bootfs=$EFI_BOOTFS $TESTPOOL
else
log_mustnot $ZPOOL set bootfs=$EFI_BOOTFS $TESTPOOL
log_mustnot zpool set bootfs=$EFI_BOOTFS $TESTPOOL
fi
log_pass $assert_mesg

View File

@ -27,6 +27,10 @@
# Copyright 2015 Nexenta Systems, Inc.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
@ -58,8 +62,8 @@ typeset assert_mesg="setting bootfs on a pool which was configured with the \
log_assert $assert_mesg
create_pool "$TESTPOOL" "$DISK"
log_must $ZFS create $EFI_BOOTFS
log_must zfs create $EFI_BOOTFS
log_must $ZPOOL set bootfs=$EFI_BOOTFS $TESTPOOL
log_must zpool set bootfs=$EFI_BOOTFS $TESTPOOL
log_pass $assert_mesg

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -51,7 +51,7 @@ function cleanup {
fi
if [[ -f $VDEV ]]; then
log_must $RM -f $VDEV
log_must rm -f $VDEV
fi
}
@ -64,18 +64,18 @@ typeset COMP_FS=$TESTPOOL/COMP_FS
log_onexit cleanup
log_assert $assert_msg
log_must $MKFILE $MINVDEVSIZE $VDEV
log_must $ZPOOL create $TESTPOOL $VDEV
log_must $ZFS create $COMP_FS
log_must mkfile $MINVDEVSIZE $VDEV
log_must zpool create $TESTPOOL $VDEV
log_must zfs create $COMP_FS
typeset -i i=0
set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \
"gzip-6" "gzip-7" "gzip-8" "gzip-9"
while (( i < ${#gtype[@]} )); do
log_must $ZFS set compression=${gtype[i]} $COMP_FS
log_mustnot $ZPOOL set bootfs=$COMP_FS $TESTPOOL
log_must $ZFS set compression=off $COMP_FS
log_must zfs set compression=${gtype[i]} $COMP_FS
log_mustnot zpool set bootfs=$COMP_FS $TESTPOOL
log_must zfs set compression=off $COMP_FS
(( i += 1 ))
done

View File

@ -29,6 +29,6 @@
verify_runnable "global"
[[ -e $TESTDIR ]] && $RM -rf $TESTDIR
[[ -e $TESTDIR ]] && rm -rf $TESTDIR
log_pass

View File

@ -29,6 +29,6 @@
verify_runnable "global"
log_must $MKDIR $TESTDIR
log_must mkdir $TESTDIR
log_pass

View File

@ -25,7 +25,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -33,10 +33,10 @@
function cleanup
{
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
fi
if datasetexists $TESTPOOL2 ; then
log_must $ZPOOL destroy -f $TESTPOOL2
log_must zpool destroy -f $TESTPOOL2
fi
}
@ -50,17 +50,17 @@ function display_status
typeset pool=$1
typeset -i ret=0
$ZPOOL status -xv $pool > /dev/null 2>&1
zpool status -xv $pool > /dev/null 2>&1
ret=$?
$ZPOOL iostat > /dev/null 2>&1
zpool iostat > /dev/null 2>&1
((ret |= $?))
typeset mntpnt=$(get_prop mountpoint $pool)
$DD if=/dev/random of=$mntpnt/testfile.$$ &
dd if=/dev/random of=$mntpnt/testfile.$$ &
typeset pid=$!
$ZPOOL iostat -v 1 3 > /dev/null
zpool iostat -v 1 3 > /dev/null
((ret |= $?))
kill -9 $pid
@ -93,7 +93,7 @@ function verify_cache_device
#
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
#
set -A dev_stat_tab $($ZPOOL status -v $pool | $NAWK 'BEGIN {start=0} \
set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
/\tcache/ {start=1}
/\tmirror/ || /\tspares/ || /^$/ {start=0}
(start==1) && /\t (\/|[a-zA-Z])/ \
@ -148,6 +148,6 @@ function verify_cache_device
function verify_cache_support
{
$ZPOOL upgrade -v | $GREP "Cache devices" > /dev/null 2>&1
zpool upgrade -v | grep "Cache devices" > /dev/null 2>&1
return $?
}

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -49,17 +49,17 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must zpool remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Creating a pool with a cache device succeeds."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -50,16 +50,16 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV
log_must $ZPOOL add $TESTPOOL cache $LDEV
log_must zpool create $TESTPOOL $type $VDEV
log_must zpool add $TESTPOOL cache $LDEV
log_must display_status $TESTPOOL
typeset ldev=$(random_get $LDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must zpool remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Adding a cache device to normal pool works."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -51,19 +51,19 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV
log_must $ZPOOL add $TESTPOOL \
log_must zpool add $TESTPOOL \
cache $LDEV2
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV2)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must zpool remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Adding an extra cache device works."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -50,15 +50,15 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV
ldev=$(random_get $LDEV)
typeset ldev2=$(random_get $LDEV2)
log_mustnot $ZPOOL attach $TESTPOOL $ldev $ldev2
log_mustnot zpool attach $TESTPOOL $ldev $ldev2
log_must check_vdev_state $TESTPOOL $ldev2 ""
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Attaching a cache device fails for an existing cache device."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -51,15 +51,15 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV
sdev=$(random_get $LDEV)
tdev=$(random_get $LDEV2)
log_mustnot $ZPOOL replace $TESTPOOL $sdev $tdev
log_mustnot zpool replace $TESTPOOL $sdev $tdev
log_must verify_cache_device $TESTPOOL $sdev 'ONLINE'
log_must check_vdev_state $TESTPOOL $tdev ""
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Replacing a cache device fails."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -53,7 +53,7 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
@ -62,8 +62,8 @@ do
#
# Nomal export/import operating
#
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -d $VDIR $TESTPOOL
log_must zpool export $TESTPOOL
log_must zpool import -d $VDIR $TESTPOOL
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
@ -72,14 +72,14 @@ do
#
# Destroy the pool and import again
#
log_must $ZPOOL destroy $TESTPOOL
log_must $ZPOOL import -Df -d $VDIR $TESTPOOL
log_must zpool destroy $TESTPOOL
log_must zpool import -Df -d $VDIR $TESTPOOL
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Exporting and importing pool with cache devices passes."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -51,7 +51,7 @@ for type in "" "mirror" "raidz" "raidz2"
do
for cachetype in "mirror" "raidz" "raidz1" "raidz2"
do
log_mustnot $ZPOOL create $TESTPOOL $type $VDEV \
log_mustnot zpool create $TESTPOOL $type $VDEV \
cache $cachetype $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_mustnot verify_cache_device \

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -52,15 +52,15 @@ for type in "" "mirror" "raidz" "raidz2"
do
for cachetype in "mirror" "raidz" "raidz1" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV
log_mustnot $ZPOOL add $TESTPOOL cache $cachetype $LDEV2
log_mustnot zpool add $TESTPOOL cache $cachetype $LDEV2
ldev=$(random_get $LDEV2)
log_mustnot verify_cache_device \
$TESTPOOL $ldev 'ONLINE' $cachetype
log_must $ZPOOL destroy $TESTPOOL
log_must zpool destroy $TESTPOOL
done
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -51,19 +51,19 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must $ZPOOL offline $TESTPOOL $ldev
log_must zpool offline $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_must verify_cache_device $TESTPOOL $ldev 'OFFLINE' ''
log_must $ZPOOL online $TESTPOOL $ldev
log_must zpool online $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE' ''
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Offline and online a cache device succeed."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -48,7 +48,7 @@ function cleanup_testenv
{
cleanup
if [[ -n $lofidev ]]; then
log_must $LOFIADM -d $lofidev
log_must lofiadm -d $lofidev
fi
}
@ -57,7 +57,7 @@ log_onexit cleanup_testenv
TESTVOL=testvol1$$
dsk1=${DISKS%% *}
log_must $ZPOOL create $TESTPOOL ${DISKS#$dsk1}
log_must zpool create $TESTPOOL ${DISKS#$dsk1}
if is_linux; then
SLICE="p1"
@ -66,25 +66,25 @@ else
fi
# Add nomal ${DEV_RDSKDIR} device
log_mustnot $ZPOOL add $TESTPOOL cache ${DEV_RDSKDIR}/${dsk1}${SLICE}
log_mustnot zpool add $TESTPOOL cache ${DEV_RDSKDIR}/${dsk1}${SLICE}
#log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
# Add nomal file
log_mustnot $ZPOOL add $TESTPOOL cache $VDEV2
log_mustnot zpool add $TESTPOOL cache $VDEV2
# Add /dev/rlofi device
lofidev=${VDEV2%% *}
log_must $LOFIADM -a $lofidev
lofidev=$($LOFIADM $lofidev)
log_mustnot $ZPOOL add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
log_must lofiadm -a $lofidev
lofidev=$(lofiadm $lofidev)
log_mustnot zpool add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
if [[ -n $lofidev ]]; then
log_must $LOFIADM -d $lofidev
log_must lofiadm -d $lofidev
lofidev=""
fi
# Add ${ZVOL_RDEVDIR} device
log_must $ZPOOL create $TESTPOOL2 $VDEV2
log_must $ZFS create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot $ZPOOL add $TESTPOOL cache ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
log_must zpool create $TESTPOOL2 $VDEV2
log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot zpool add $TESTPOOL cache ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
log_pass "Cache device can only be block devices."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -47,7 +47,7 @@ verify_disk_count "$LDEV2"
function cleanup {
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
fi
}
@ -56,13 +56,13 @@ log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must zpool create $TESTPOOL $type $VDEV \
cache $LDEV spare $LDEV2
log_must $ZPOOL remove $TESTPOOL $LDEV
log_must zpool remove $TESTPOOL $LDEV
log_must display_status $TESTPOOL
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
done
log_pass "Remove cache device from pool with spare device should succeed"

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -35,12 +35,12 @@
verify_runnable "global"
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
log_must zpool destroy -f $TESTPOOL
fi
if datasetexists $TESTPOOL2 ; then
log_must $ZPOOL destroy -f $TESTPOOL2
log_must zpool destroy -f $TESTPOOL2
fi
log_must $RM -rf $VDIR $VDIR2
log_must rm -rf $VDIR $VDIR2
log_pass

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@ -38,8 +38,8 @@ if ! is_physical_device $LDEV; then
log_unsupported "Only physical disk could be cache device"
fi
log_must $RM -rf $VDIR $VDIR2
log_must $MKDIR -p $VDIR $VDIR2
log_must $MKFILE $SIZE $VDEV $VDEV2
log_must rm -rf $VDIR $VDIR2
log_must mkdir -p $VDIR $VDIR2
log_must mkfile $SIZE $VDEV $VDEV2
log_pass

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -13,12 +13,16 @@
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
NAME_C_ORIG=$($ECHO 'F\0303\0257L\0303\0253N\0303\0204m\0303\0253')
NAME_C_UPPER=$($ECHO 'F\0303\0217L\0303\0213N\0303\0204M\0303\0213')
NAME_C_LOWER=$($ECHO 'f\0303\0257l\0303\0253n\0303\0244m\0303\0253')
NAME_D_ORIG=$($ECHO 'Fi\0314\0210Le\0314\0210NA\0314\0210me\0314\0210')
NAME_D_UPPER=$($ECHO 'FI\0314\0210LE\0314\0210NA\0314\0210ME\0314\0210')
NAME_D_LOWER=$($ECHO 'fi\0314\0210le\0314\0210na\0314\0210me\0314\0210')
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
NAME_C_ORIG=$(echo 'F\0303\0257L\0303\0253N\0303\0204m\0303\0253')
NAME_C_UPPER=$(echo 'F\0303\0217L\0303\0213N\0303\0204M\0303\0213')
NAME_C_LOWER=$(echo 'f\0303\0257l\0303\0253n\0303\0244m\0303\0253')
NAME_D_ORIG=$(echo 'Fi\0314\0210Le\0314\0210NA\0314\0210me\0314\0210')
NAME_D_UPPER=$(echo 'FI\0314\0210LE\0314\0210NA\0314\0210ME\0314\0210')
NAME_D_LOWER=$(echo 'fi\0314\0210le\0314\0210na\0314\0210me\0314\0210')
NAMES_ORIG="$NAME_C_ORIG $NAME_D_ORIG"
NAMES_UPPER="$NAME_C_UPPER $NAME_D_UPPER"
NAMES_LOWER="$NAME_C_LOWER $NAME_D_LOWER"

View File

@ -13,6 +13,10 @@
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/casenorm/casenorm.cfg
@ -20,18 +24,18 @@ function create_testfs
{
typeset opts=$1
$RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
$MKDIR -p $TESTDIR || log_unresolved Could not create $TESTDIR
rm -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
mkdir -p $TESTDIR || log_unresolved Could not create $TESTDIR
log_must $ZFS create $opts $TESTPOOL/$TESTFS
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
log_must zfs create $opts $TESTPOOL/$TESTFS
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}
function destroy_testfs
{
if datasetexists $TESTPOOL/$TESTFS ; then
log_must $ZFS destroy -f $TESTPOOL/$TESTFS
$RM -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
log_must zfs destroy -f $TESTPOOL/$TESTFS
rm -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
fi
}
@ -39,14 +43,14 @@ function create_file
{
typeset name=$TESTDIR/$1
$ECHO $name > $name
echo $name > $name
}
function delete_file
{
typeset name=$TESTDIR/$1
$RM $name >/dev/null 2>&1
rm $name >/dev/null 2>&1
if [[ $? -ne 0 ]] ; then
return 1
@ -61,14 +65,14 @@ function lookup_file
{
typeset name=$1
$ZLOOK -l $TESTDIR $name >/dev/null 2>&1
zlook -l $TESTDIR $name >/dev/null 2>&1
}
function lookup_file_ci
{
typeset name=$1
$ZLOOK -il $TESTDIR $name >/dev/null 2>&1
zlook -il $TESTDIR $name >/dev/null 2>&1
}
function lookup_any

View File

@ -15,6 +15,10 @@
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
# DESCRIPTION:
@ -39,7 +43,7 @@ log_assert "Can create FS with all supported normalization forms"
for form in none formC formD formKC formKD; do
create_testfs "-o normalization=$form"
if [[ $form != "none" ]] ; then
utf8only=$($ZFS get -H -o value utf8only $TESTPOOL/$TESTFS)
utf8only=$(zfs get -H -o value utf8only $TESTPOOL/$TESTFS)
if [[ $utf8only != "on" ]]; then
log_fail "Turning on normalization didn't set " \
"utf8only to on"
@ -49,7 +53,7 @@ for form in none formC formD formKC formKD; do
done
for form in formC formD formKC formKD; do
log_mustnot $ZFS create -o utf8only=off -o normalization=$form \
log_mustnot zfs create -o utf8only=off -o normalization=$form \
$TESTPOOL/$TESTFS
destroy_testfs
done

View File

@ -15,9 +15,13 @@
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
DISK=${DISKS%% *}
log_must $ZPOOL create $TESTPOOL $DISK
log_must zpool create $TESTPOOL $DISK
log_pass

View File

@ -51,14 +51,14 @@ function cleanup
log_must chattr -ia $TESTDIR/$i
log_must rm -f $TESTDIR/$i
done
log_must $CHMOD 0755 $TESTDIR
log_must chmod 0755 $TESTDIR
}
log_onexit cleanup
log_assert "Check whether unprivileged user can chattr"
log_must $CHMOD 0777 $TESTDIR
log_must chmod 0777 $TESTDIR
log_must user_run $QUSER1 touch $TESTDIR/writable
log_must user_run $QUSER1 touch $TESTDIR/immutable

View File

@ -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
@ -35,8 +35,8 @@
verify_runnable "global"
$DF -F zfs -h | $GREP "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
df -F zfs -h | grep "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must zfs umount -f $TESTDIR
destroy_pool $TESTPOOL
# recreate and destroy a zpool over the disks to restore the partitions to

View File

@ -51,16 +51,16 @@ verify_runnable "both"
function cleanup
{
$ECHO cleanup
echo cleanup
[[ -e $TESTDIR ]] && \
log_must $RM -rf $TESTDIR/* > /dev/null 2>&1
log_must rm -rf $TESTDIR/* > /dev/null 2>&1
}
log_assert "Create and read back files with using different checksum algorithms"
log_onexit cleanup
FSSIZE=$($ZPOOL list -Hp -o size $TESTPOOL)
FSSIZE=$(zpool list -Hp -o size $TESTPOOL)
WRITESZ=1048576
WRITECNT=$((($FSSIZE) / $WRITESZ ))
# Skip the first and last 4MB
@ -79,16 +79,16 @@ firstvdev=${array[0]}
# errors.
for ((count = 0; count < ${#checksum_props[*]} ; count++)); do
i=${checksum_props[$count]}
$ZFS set checksum=$i $TESTPOOL
$FILE_WRITE -o overwrite -f $TESTDIR/test_$i -b $WRITESZ -c 5 -d R
zfs set checksum=$i $TESTPOOL
file_write -o overwrite -f $TESTDIR/test_$i -b $WRITESZ -c 5 -d R
done
$ZPOOL export $TESTPOOL
$ZPOOL import $TESTPOOL
$ZPOOL scrub $TESTPOOL
zpool export $TESTPOOL
zpool import $TESTPOOL
zpool scrub $TESTPOOL
while is_pool_scrubbing $TESTPOOL; do
$SLEEP 1
sleep 1
done
$ZPOOL status -P -v $TESTPOOL | grep $firstvdev | read -r name state rd wr cksum
zpool status -P -v $TESTPOOL | grep $firstvdev | read -r name state rd wr cksum
log_assert "Normal file write test saw $cksum checksum errors"
log_must [ $cksum -eq 0 ]
@ -97,29 +97,29 @@ rm -fr $TESTDIR/*
log_assert "Test scrambling the disk and seeing checksum errors"
for ((count = 0; count < ${#checksum_props[*]} ; count++)); do
i=${checksum_props[$count]}
$ZFS set checksum=$i $TESTPOOL
$FILE_WRITE -o overwrite -f $TESTDIR/test_$i -b $WRITESZ -c 5 -d R
zfs set checksum=$i $TESTPOOL
file_write -o overwrite -f $TESTDIR/test_$i -b $WRITESZ -c 5 -d R
$ZPOOL export $TESTPOOL
zpool export $TESTPOOL
# Scramble the data on the first vdev in our pool.
# Skip the first and last 16MB of data, then scramble the rest after that
#
$FILE_WRITE -o overwrite -f $firstvdev -s $SKIP -c $WRITECNT -b $WRITESZ -d R
file_write -o overwrite -f $firstvdev -s $SKIP -c $WRITECNT -b $WRITESZ -d R
$ZPOOL import $TESTPOOL
zpool import $TESTPOOL
i=${checksum_props[$count]}
$ZPOOL scrub $TESTPOOL
zpool scrub $TESTPOOL
while is_pool_scrubbing $TESTPOOL; do
$SLEEP 1
sleep 1
done
$ZPOOL status -P -v $TESTPOOL | grep $firstvdev | read -r name state rd wr cksum
zpool status -P -v $TESTPOOL | grep $firstvdev | read -r name state rd wr cksum
log_assert "Checksum '$i' caught $cksum checksum errors"
log_must [ $cksum -ne 0 ]
rm -f $TESTDIR/test_$i
$ZPOOL clear $TESTPOOL
zpool clear $TESTPOOL
done

View File

@ -12,7 +12,7 @@
#
#
# Copyright (c) 2015 by Delphix. All rights reserved.
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib

View File

@ -12,7 +12,7 @@
#
#
# Copyright (c) 2015 by Delphix. All rights reserved.
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib

View File

@ -12,7 +12,7 @@
#
#
# Copyright (c) 2015 by Delphix. All rights reserved.
# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib

View File

@ -25,7 +25,7 @@
#
#
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/clean_mirror/default.cfg
@ -45,20 +45,20 @@ function sync_pool #pool
{
typeset pool=$1
log_must $SYNC
log_must $SLEEP 2
log_must sync
log_must sleep 2
# Flush all the pool data.
typeset -i ret
$ZPOOL scrub $pool >/dev/null 2>&1
zpool scrub $pool >/dev/null 2>&1
ret=$?
(( $ret != 0 )) && \
log_fail "$ZPOOL scrub $pool failed."
log_fail "zpool scrub $pool failed."
while ! is_pool_scrubbed $pool; do
if is_pool_resilvered $pool ; then
log_fail "$pool should not be resilver completed."
fi
log_must $SLEEP 2
log_must sleep 2
done
}
@ -74,14 +74,14 @@ function overwrite_verify_mirror
while (( atfile < FILE_COUNT )); do
files[$atfile]=$TESTDIR/file.$atfile
log_must $FILE_WRITE -o create -f $TESTDIR/file.$atfile \
log_must file_write -o create -f $TESTDIR/file.$atfile \
-b $FILE_SIZE -c 1
cksums[$atfile]=$($CKSUM ${files[$atfile]})
cksums[$atfile]=$(cksum ${files[$atfile]})
(( atfile = atfile + 1 ))
done
# dd the primary side of the mirror
log_must $DD if=$OVERWRITING_DEVICE of=$AFFECTED_DEVICE \
log_must dd if=$OVERWRITING_DEVICE of=$AFFECTED_DEVICE \
seek=8 bs=$DD_BLOCK count=$(( DD_COUNT - 128 )) conv=notrunc
atfile=0
@ -89,17 +89,17 @@ function overwrite_verify_mirror
#
# Flush out the cache so that we ensure we're reading from disk.
#
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import $TESTPOOL
log_must zpool export $TESTPOOL
log_must zpool import $TESTPOOL
typeset -i failedcount=0
while (( atfile < FILE_COUNT )); do
files[$atfile]=$TESTDIR/file.$atfile
newcksum=$($CKSUM ${files[$atfile]})
newcksum=$(cksum ${files[$atfile]})
if [[ $newcksum != ${cksums[$atfile]} ]]; then
(( failedcount = failedcount + 1 ))
fi
$RM -f ${files[$atfile]}
rm -f ${files[$atfile]}
(( atfile = atfile + 1 ))
done

View File

@ -34,15 +34,15 @@
verify_runnable "global"
$DF -F zfs -h | $GREP "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
df -F zfs -h | grep "$TESTFS " >/dev/null
[[ $? == 0 ]] && log_must zfs umount -f $TESTDIR
destroy_pool $TESTPOOL
if is_mpath_device $MIRROR_PRIMARY; then
$FORMAT $DEV_DSKDIR/$MIRROR_PRIMARY -s rm 1
parted $DEV_DSKDIR/$MIRROR_PRIMARY -s rm 1
fi
if is_mpath_device $MIRROR_SECONDARY; then
$FORMAT $DEV_DSKDIR/$MIRROR_SECONDARY -s rm 1
parted $DEV_DSKDIR/$MIRROR_SECONDARY -s rm 1
fi
# recreate and destroy a zpool over the disks to restore the partitions to
# normal

View File

@ -49,7 +49,7 @@ if [[ -z $MIRROR_SECONDARY ]]; then
else
export DEV_DSKDIR=$DEV_RDSKDIR
fi
if ( is_mpath_device $SINGLE_DISK ) && [[ -z $($ECHO $SINGLE_DISK | awk 'substr($1,18,1)\
if ( is_mpath_device $SINGLE_DISK ) && [[ -z $(echo $SINGLE_DISK | awk 'substr($1,18,1)\
~ /^[[:digit:]]+$/') ]] || ( is_real_device $SINGLE_DISK ); then
SIDE_PRIMARY=${SINGLE_DISK}1
SIDE_SECONDARY=${SINGLE_DISK}2
@ -73,7 +73,7 @@ else
else
export DEV_DSKDIR=$DEV_RDSKDIR
fi
if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $($ECHO $MIRROR_PRIMARY | awk 'substr($1,18,1)\
if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $(echo $MIRROR_PRIMARY | awk 'substr($1,18,1)\
~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_PRIMARY ); then
SIDE_PRIMARY=${MIRROR_PRIMARY}1
elif ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_PRIMARY ); then
@ -81,7 +81,7 @@ else
else
log_fail "$MIRROR_PRIMARY not supported for partitioning."
fi
if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $($ECHO $MIRROR_SECONDARY | awk 'substr($1,18,1)\
if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $(echo $MIRROR_SECONDARY | awk 'substr($1,18,1)\
~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_SECONDARY ); then
SIDE_SECONDARY=${MIRROR_SECONDARY}1
elif ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY ); then

View File

@ -24,6 +24,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
@ -31,7 +35,7 @@
#
function get_cksum # <file path>
{
return $($CKSUM $1 | $AWK '{print $1 $2}')
return $(cksum $1 | awk '{print $1 $2}')
}
#

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -65,7 +65,7 @@ log_assert "Execute zdb using invalid parameters."
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZDB ${args[i]}
log_mustnot zdb ${args[i]}
((i = i + 1))
done

View File

@ -42,7 +42,7 @@ function cleanup
for opt in '' -d; do
log_must zpool create -f $opt $TESTPOOL ${DISKS%% *}
log_must eval "$ZDB $TESTPOOL >$tmpfile"
log_must eval "zdb $TESTPOOL >$tmpfile"
grep -q "$errstr" $tmpfile && \
log_fail "Found feature refcount mismatches in zdb output."
destroy_pool $TESTPOOL

View File

@ -43,10 +43,10 @@ config_count=(1 2)
set -A DISK $DISKS
default_mirror_setup_noexit $DISKS
log_must $DD if=/dev/${DISK[0]} of=/dev/${DISK[1]} bs=1K count=256 conv=notrunc
log_must dd if=/dev/${DISK[0]} of=/dev/${DISK[1]} bs=1K count=256 conv=notrunc
for x in 0 1 ; do
config_count=$($ZDB -l $DEV_RDSKDIR/${DISK[$x]} | $GREP -c features_for_read)
config_count=$(zdb -l $DEV_RDSKDIR/${DISK[$x]} | grep -c features_for_read)
(( $? != 0)) && log_fail "failed to get config_count from DISK[$x]"
log_note "vdev $x: message_count $config_count"
[ $config_count -ne ${config_count[$x]} ] && \

View File

@ -38,7 +38,7 @@ function cleanup
{
datasetexists $TESTPOOL && destroy_pool $TESTPOOL
for DISK in $DISKS; do
$ZPOOL labelclear -f $DEV_RDSKDIR/$DISK
zpool labelclear -f $DEV_RDSKDIR/$DISK
done
}
@ -47,16 +47,16 @@ verify_disk_count "$DISKS" 2
set -A DISK $DISKS
default_mirror_setup_noexit $DISKS
log_must $ZPOOL offline $TESTPOOL ${DISK[0]}
log_must $DD if=/dev/urandom of=$TESTDIR/testfile bs=1K count=2
log_must $ZPOOL export $TESTPOOL
log_must $DD if=$DEV_RDSKDIR/${DISK[0]} of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc
log_must zpool offline $TESTPOOL ${DISK[0]}
log_must dd if=/dev/urandom of=$TESTDIR/testfile bs=1K count=2
log_must zpool export $TESTPOOL
log_must dd if=$DEV_RDSKDIR/${DISK[0]} of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc
ubs=$($ZDB -lu $DEV_RDSKDIR/${DISK[1]} | $GREP -e LABEL -e Uberblock -e 'labels = ')
ubs=$(zdb -lu $DEV_RDSKDIR/${DISK[1]} | grep -e LABEL -e Uberblock -e 'labels = ')
log_note "vdev 1: ubs $ubs"
ub_dump_counts=$($ZDB -lu $DEV_RDSKDIR/${DISK[1]} | \
$AWK ' /LABEL/ {label=$NF; blocks[label]=0};
ub_dump_counts=$(zdb -lu $DEV_RDSKDIR/${DISK[1]} | \
awk ' /LABEL/ {label=$NF; blocks[label]=0};
/Uberblock/ {blocks[label]++};
END {print blocks[0],blocks[1],blocks[2],blocks[3]}')
(( $? != 0)) && log_fail "failed to get ub_dump_counts from DISK[1]"

View File

@ -44,18 +44,18 @@ verify_disk_count "$DISKS" 2
set -A DISK $DISKS
default_mirror_setup_noexit $DISKS
log_must $DD if=/dev/zero of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc
log_must $TRUNCATE -s 0 $TEMPFILE
log_must dd if=/dev/zero of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc
log_must truncate -s 0 $TEMPFILE
$ZDB -l $DEV_RDSKDIR/${DISK[0]}
zdb -l $DEV_RDSKDIR/${DISK[0]}
[[ $? -ne 0 ]] &&
log_fail "zdb -l exit codes are incorrect."
$ZDB -l $DEV_RDSKDIR/${DISK[1]}
zdb -l $DEV_RDSKDIR/${DISK[1]}
[[ $? -ne 1 ]] &&
log_fail "zdb -l exit codes are incorrect."
$ZDB -l $TEMPFILE
zdb -l $TEMPFILE
[[ $? -ne 2 ]] &&
log_fail "zdb -l exit codes are incorrect."

View File

@ -24,6 +24,11 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
@ -65,7 +70,7 @@ log_assert "Badly-formed zfs sub-command should return an error."
typeset -i i=0
while (( $i < ${#args[*]} )); do
log_mustnot $ZFS ${args[i]}
log_mustnot zfs ${args[i]}
((i = i + 1))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,11 +49,11 @@ function cleanup
unset ZFS_ABORT
if [[ -d $corepath ]]; then
$RM -rf $corepath
rm -rf $corepath
fi
for ds in $fs1 $fs $ctr; do
if datasetexists $ds; then
log_must $ZFS destroy -rRf $ds
log_must zfs destroy -rRf $ds
fi
done
}
@ -65,12 +65,12 @@ log_onexit cleanup
#preparation work for testing
corepath=$TESTDIR/core
if [[ -d $corepath ]]; then
$RM -rf $corepath
rm -rf $corepath
fi
log_must $MKDIR $corepath
log_must mkdir $corepath
ctr=$TESTPOOL/$TESTCTR
log_must $ZFS create $ctr
log_must zfs create $ctr
fs=$ctr/$TESTFS
fs1=$ctr/$TESTFS1
@ -94,19 +94,19 @@ if is_linux; then
echo "$corepath/core.zfs" >/proc/sys/kernel/core_pattern
echo 0 >/proc/sys/kernel/core_uses_pid
else
log_must $COREADM -p ${corepath}/core.%f
log_must coreadm -p ${corepath}/core.%f
fi
log_must export ZFS_ABORT=yes
for subcmd in "${cmds[@]}" "${badparams[@]}"; do
$ZFS $subcmd >/dev/null 2>&1 && log_fail "$subcmd passed incorrectly."
zfs $subcmd >/dev/null 2>&1 && log_fail "$subcmd passed incorrectly."
corefile=${corepath}/core.zfs
if [[ ! -e $corefile ]]; then
log_fail "$ZFS $subcmd cannot generate core file with " \
log_fail "zfs $subcmd cannot generate core file with " \
"ZFS_ABORT set."
fi
log_must $RM -f $corefile
log_must rm -f $corefile
done
log_pass "With ZFS_ABORT set, zfs command can abort and generate core file " \

View File

@ -24,6 +24,11 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
@ -52,12 +57,12 @@ fi
for file in $ZFS_DEV $MNTTAB; do
if [[ -e $file ]]; then
$MV $file ${file}.bak
mv $file ${file}.bak
fi
for cmd in "" "list" "get all" "mount"; do
log_mustnot eval "$ZFS $cmd >/dev/null 2>&1"
log_mustnot eval "zfs $cmd >/dev/null 2>&1"
done
$MV ${file}.bak $file
mv ${file}.bak $file
done
log_pass "zfs fails with unexpected scenario as expected."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -90,7 +90,7 @@ function setup_all
for snap in $SNAPFS $SNAPFS1 ; do
if ! snapexists $snap ; then
log_must $ZFS snapshot $snap
log_must zfs snapshot $snap
fi
done
@ -100,11 +100,11 @@ function setup_all
function cleanup_all
{
for fs in $targets; do
datasetexists $fs && log_must $ZFS destroy -f $fs
datasetexists $fs && log_must zfs destroy -f $fs
done
for snap in $SNAPFS $SNAPFS1 ; do
snapexists $snap && log_must $ZFS destroy -Rf $snap
snapexists $snap && log_must zfs destroy -Rf $snap
done
return 0
@ -118,7 +118,7 @@ setup_all
typeset -i i=0
while (( i < ${#args[*]} )); do
log_mustnot $ZFS clone ${args[i]}
log_mustnot zfs clone ${args[i]}
((i = i + 1))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -50,7 +50,7 @@ function setup_all
for snap in $SNAPFS $SNAPFS1 ; do
if ! snapexists $snap ; then
log_must $ZFS snapshot $snap
log_must zfs snapshot $snap
fi
done
@ -61,12 +61,12 @@ function cleanup_all
{
if datasetexists $TESTPOOL/notexist ; then
log_must $ZFS destroy -rRf $TESTPOOL/notexist
log_must zfs destroy -rRf $TESTPOOL/notexist
fi
for snap in $SNAPFS $SNAPFS1 ; do
if snapexists $snap ; then
log_must $ZFS destroy -Rf $snap
log_must zfs destroy -Rf $snap
fi
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,7 +49,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must $ZFS destroy -Rf $SNAPFS
log_must zfs destroy -Rf $SNAPFS
fi
}
@ -59,16 +59,16 @@ log_onexit cleanup
log_assert "'zfs clone -o property=value filesystem' can successfully create" \
"a ZFS clone filesystem with correct property set."
log_must $ZFS snapshot $SNAPFS
log_must zfs snapshot $SNAPFS
typeset -i i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
log_must $ZFS clone -o ${RW_FS_PROP[$i]} $SNAPFS $TESTPOOL/$TESTCLONE
log_must zfs clone -o ${RW_FS_PROP[$i]} $SNAPFS $TESTPOOL/$TESTCLONE
datasetexists $TESTPOOL/$TESTCLONE || \
log_fail "zfs clone $TESTPOOL/$TESTCLONE fail."
propertycheck $TESTPOOL/$TESTCLONE ${RW_FS_PROP[i]} || \
log_fail "${RW_FS_PROP[i]} is failed to set."
log_must $ZFS destroy -f $TESTPOOL/$TESTCLONE
log_must zfs destroy -f $TESTPOOL/$TESTCLONE
(( i = i + 1 ))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,7 +49,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must $ZFS destroy -Rf $SNAPFS
log_must zfs destroy -Rf $SNAPFS
fi
}
@ -61,7 +61,7 @@ log_assert "'zfs clone -o property=value filesystem' can successfully create" \
typeset -i i=0
typeset opts=""
log_must $ZFS snapshot $SNAPFS
log_must zfs snapshot $SNAPFS
while (( $i < ${#RW_FS_PROP[*]} )); do
if [[ ${RW_FS_PROP[$i]} != *"checksum"* ]]; then
@ -70,7 +70,7 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
(( i = i + 1 ))
done
log_must $ZFS clone $opts $SNAPFS $TESTPOOL/$TESTCLONE
log_must zfs clone $opts $SNAPFS $TESTPOOL/$TESTCLONE
datasetexists $TESTPOOL/$TESTCLONE || \
log_fail "zfs create $TESTPOOL/$TESTCLONE fail."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,7 +49,7 @@ verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must $ZFS destroy -Rf $SNAPFS1
log_must zfs destroy -Rf $SNAPFS1
fi
}
@ -58,15 +58,15 @@ log_onexit cleanup
log_assert "'zfs clone -o property=value -V size volume' can successfully" \
"create a ZFS clone volume with correct property set."
log_must $ZFS snapshot $SNAPFS1
log_must zfs snapshot $SNAPFS1
typeset -i i=0
while (( $i < ${#RW_VOL_CLONE_PROP[*]} )); do
log_must $ZFS clone -o ${RW_VOL_CLONE_PROP[$i]} $SNAPFS1 $TESTPOOL/$TESTCLONE
log_must zfs clone -o ${RW_VOL_CLONE_PROP[$i]} $SNAPFS1 $TESTPOOL/$TESTCLONE
datasetexists $TESTPOOL/$TESTCLONE || \
log_fail "zfs clone $TESTPOOL/$TESTCLONE fail."
propertycheck $TESTPOOL/$TESTCLONE ${RW_VOL_CLONE_PROP[i]} || \
log_fail "${RW_VOL_CLONE_PROP[i]} is failed to set."
log_must $ZFS destroy -f $TESTPOOL/$TESTCLONE
log_must zfs destroy -f $TESTPOOL/$TESTCLONE
(( i = i + 1 ))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
@ -50,7 +50,7 @@ verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must $ZFS destroy -Rf $SNAPFS1
log_must zfs destroy -Rf $SNAPFS1
fi
}
@ -62,7 +62,7 @@ log_assert "'zfs clone -o property=value volume' can successfully" \
typeset -i i=0
typeset opts=""
log_must $ZFS snapshot $SNAPFS1
log_must zfs snapshot $SNAPFS1
while (( $i < ${#RW_VOL_CLONE_PROP[*]} )); do
if [[ ${RW_VOL_CLONE_PROP[$i]} != *"checksum"* ]]; then
@ -71,7 +71,7 @@ while (( $i < ${#RW_VOL_CLONE_PROP[*]} )); do
(( i = i + 1 ))
done
log_must $ZFS clone $opts $SNAPFS1 $TESTPOOL/$TESTCLONE
log_must zfs clone $opts $SNAPFS1 $TESTPOOL/$TESTCLONE
i=0
while (( $i < ${#RW_VOL_CLONE_PROP[*]} )); do

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -40,15 +40,15 @@
# 2. Verify it succeed while upgrade, but fails while the version downgraded.
#
ZFS_VERSION=$($ZFS upgrade | $HEAD -1 | $AWK '{print $NF}' \
| $SED -e 's/\.//g')
ZFS_VERSION=$(zfs upgrade | head -1 | awk '{print $NF}' \
| sed -e 's/\.//g')
verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must $ZFS destroy -Rf $SNAPFS
log_must zfs destroy -Rf $SNAPFS
fi
}
@ -57,7 +57,7 @@ log_onexit cleanup
log_assert "'zfs clone -o version=' could upgrade version," \
"but downgrade is denied."
log_must $ZFS snapshot $SNAPFS
log_must zfs snapshot $SNAPFS
typeset -i ver
@ -67,14 +67,14 @@ fi
(( ver = ZFS_TEST_VERSION ))
while (( ver <= ZFS_VERSION )); do
log_must $ZFS clone -o version=$ver $SNAPFS $TESTPOOL/$TESTCLONE
log_must zfs clone -o version=$ver $SNAPFS $TESTPOOL/$TESTCLONE
cleanup
(( ver = ver + 1 ))
done
(( ver = 0 ))
while (( ver < ZFS_TEST_VERSION )); do
log_mustnot $ZFS clone -o version=$ver \
log_mustnot zfs clone -o version=$ver \
$SNAPFS $TESTPOOL/$TESTCLONE
log_mustnot datasetexists $TESTPOOL/$TESTCLONE
cleanup

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,7 +49,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must $ZFS destroy -Rf $SNAPFS
log_must zfs destroy -Rf $SNAPFS
fi
}
@ -57,22 +57,22 @@ log_onexit cleanup
log_assert "Verify 'zfs clone -o <filesystem>' fails with bad <filesystem> argument."
log_must $ZFS snapshot $SNAPFS
log_must zfs snapshot $SNAPFS
typeset -i i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
log_mustnot $ZFS clone -o ${RW_FS_PROP[i]} -o ${RW_FS_PROP[i]} \
log_mustnot zfs clone -o ${RW_FS_PROP[i]} -o ${RW_FS_PROP[i]} \
$SNAPFS $TESTPOOL/$TESTCLONE
log_mustnot $ZFS clone -p -o ${RW_FS_PROP[i]} -o ${RW_FS_PROP[i]} \
log_mustnot zfs clone -p -o ${RW_FS_PROP[i]} -o ${RW_FS_PROP[i]} \
$SNAPFS $TESTPOOL/$TESTCLONE
((i = i + 1))
done
i=0
while (( $i < ${#VOL_ONLY_PROP[*]} )); do
log_mustnot $ZFS clone -o ${VOL_ONLY_PROP[i]} \
log_mustnot zfs clone -o ${VOL_ONLY_PROP[i]} \
$SNAPFS $TESTPOOL/$TESTCLONE
log_mustnot $ZFS clone -p -o ${VOL_ONLY_PROP[i]} \
log_mustnot zfs clone -p -o ${VOL_ONLY_PROP[i]} \
$SNAPFS $TESTPOOL/$TESTCLONE
((i = i + 1))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -49,7 +49,7 @@ verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must $ZFS destroy -Rf $SNAPFS1
log_must zfs destroy -Rf $SNAPFS1
fi
}
@ -57,22 +57,22 @@ log_onexit cleanup
log_assert "Verify 'zfs clone -o <volume>' fails with bad <volume> argument."
log_must $ZFS snapshot $SNAPFS1
log_must zfs snapshot $SNAPFS1
typeset -i i=0
while (( $i < ${#RW_VOL_PROP[*]} )); do
log_mustnot $ZFS clone -o ${RW_VOL_PROP[i]} -o ${RW_VOL_PROP[i]} \
log_mustnot zfs clone -o ${RW_VOL_PROP[i]} -o ${RW_VOL_PROP[i]} \
$SNAPFS1 $TESTPOOL/$TESTCLONE
log_mustnot $ZFS clone -p -o ${RW_VOL_PROP[i]} -o ${RW_VOL_PROP[i]} \
log_mustnot zfs clone -p -o ${RW_VOL_PROP[i]} -o ${RW_VOL_PROP[i]} \
$SNAPFS1 $TESTPOOL/$TESTCLONE
((i = i + 1))
done
i=0
while (( $i < ${#FS_ONLY_PROP[*]} )); do
log_mustnot $ZFS clone -o ${FS_ONLY_PROP[i]} \
log_mustnot zfs clone -o ${FS_ONLY_PROP[i]} \
$SNAPFS1 $TESTPOOL/$TESTCLONE
log_mustnot $ZFS clone -p -o ${FS_ONLY_PROP[i]} \
log_mustnot zfs clone -p -o ${FS_ONLY_PROP[i]} \
$SNAPFS1 $TESTPOOL/$TESTCLONE
((i = i + 1))
done

View File

@ -15,7 +15,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -39,8 +39,8 @@ function local_cleanup
typeset -i i=1
for ds in $datasets; do
datasetexists $ds/$TESTCLONE.$i && \
log_must $ZFS destroy -rf $ds/$TESTCLONE.$i
datasetexists $ds && log_must $ZFS destroy -Rf $ds
log_must zfs destroy -rf $ds/$TESTCLONE.$i
datasetexists $ds && log_must zfs destroy -Rf $ds
((i=i+1))
done
}
@ -50,7 +50,7 @@ function setup_ds
{
typeset -i i=1
# create nested datasets
log_must $ZFS create -p $TESTPOOL/$TESTFS1/$TESTFS2/$TESTFS3
log_must zfs create -p $TESTPOOL/$TESTFS1/$TESTFS2/$TESTFS3
# verify dataset creation
for ds in $datasets; do
@ -58,14 +58,14 @@ function setup_ds
done
# create recursive nested snapshot
log_must $ZFS snapshot -r $TESTPOOL/$TESTFS1@snap
log_must zfs snapshot -r $TESTPOOL/$TESTFS1@snap
for ds in $datasets; do
datasetexists $ds@snap || \
log_fail "Create $ds@snap snapshot fail."
done
for ds in $datasets; do
for fs in $datasets; do
log_must $ZFS clone $ds@snap $fs/$TESTCLONE.$i
log_must zfs clone $ds@snap $fs/$TESTCLONE.$i
done
((i=i+1))
done
@ -82,8 +82,8 @@ function verify_clones
if [[ -n $clone_snap ]]; then
clone_snap=/$TESTCLONE.$i
fi
snapshot=$($ECHO "$names" | $GREP $ds$clone_snap@snap)
actual_clone=$($ZFS list -t all -o clones $snapshot | $TAIL -1)
snapshot=$(echo "$names" | grep $ds$clone_snap@snap)
actual_clone=$(zfs list -t all -o clones $snapshot | tail -1)
save=$IFS
IFS=','
typeset -a clones=()
@ -147,16 +147,16 @@ i=1
log_must setup_ds
log_note "Verify zfs clone property for multiple clones"
names=$($ZFS list -rt all -o name $TESTPOOL)
names=$(zfs list -rt all -o name $TESTPOOL)
log_must verify_clones 3 0
log_note "verfify clone property for clone deletion"
i=1
for ds in $datasets; do
log_must $ZFS destroy $ds/$TESTCLONE.$i
log_must zfs destroy $ds/$TESTCLONE.$i
((i=i+1))
done
names=$($ZFS list -rt all -o name $TESTPOOL)
names=$(zfs list -rt all -o name $TESTPOOL)
i=1
log_must verify_clones 2 1
@ -165,9 +165,9 @@ log_must setup_ds
log_note "verify zfs deferred destroy on clones property"
i=1
names=$($ZFS list -rt all -o name $TESTPOOL)
names=$(zfs list -rt all -o name $TESTPOOL)
for ds in $datasets; do
log_must $ZFS destroy -d $ds@snap
log_must zfs destroy -d $ds@snap
deferred_snaps=( "${deferred_snaps[@]}" "$ds@snap" )
((i=i+1))
done
@ -178,20 +178,20 @@ d_clones=()
i=1
for ds in $datasets; do
for fs in $datasets; do
log_must $ZFS destroy $fs/$TESTCLONE.$i
log_must zfs destroy $fs/$TESTCLONE.$i
d_clones=( "${d_clones[@]}" "$fs/$TESTCLONE.$i" )
done
((i=i+1))
done
names=$($ZFS list -rtall -o name $TESTPOOL)
names=$(zfs list -rtall -o name $TESTPOOL)
for snap in ${deferred_snaps[@]}; do
status=$($ECHO "$names" | $GREP $snap)
status=$(echo "$names" | grep $snap)
[[ -z $status ]] || \
log_fail "$snap exist after deferred destroy"
done
for dclone in ${d_clones[@]}; do
log_note "D CLONE = $dclone"
status=$($ECHO "$names" | $GREP $dclone)
status=$(echo "$names" | grep $dclone)
[[ -z $status ]] || \
log_fail "$dclone exist after deferred destroy"
done
@ -201,14 +201,14 @@ log_must setup_ds
log_note "verify clone property for zfs promote"
i=1
for ds in $datasets; do
log_must $ZFS promote $ds/$TESTCLONE.$i
log_must zfs promote $ds/$TESTCLONE.$i
((i=i+1))
done
names=$($ZFS list -rt all -o name,clones $TESTPOOL)
names=$(zfs list -rt all -o name,clones $TESTPOOL)
log_must verify_clones 3 1 $TESTCLONE
i=1
for ds in $datasets; do
log_must $ZFS promote $ds
log_must zfs promote $ds
((i=i+1))
done
log_must local_cleanup
@ -222,16 +222,16 @@ if is_linux; then
else
ZFS_MAXPROPLEN=1024
fi
log_must $ZFS create $fs
log_must $ZFS snapshot $fs@snap
while((i <= $(( $ZFS_MAXPROPLEN/200+1 )))); do
log_must $ZFS clone $fs@snap $fs/$TESTCLONE$(python -c 'print "x" * 200').$i
log_must zfs create $fs
log_must zfs snapshot $fs@snap
while((i <= $(( ZFS_MAXPROPLEN/200+1 )))); do
log_must zfs clone $fs@snap $fs/$TESTCLONE$(python -c 'print "x" * 200').$i
((i=i+1))
((j=j+200))
done
clone_list=$($ZFS list -o clones $fs@snap)
char_count=$($ECHO "$clone_list" | $TAIL -1 | wc | $AWK '{print $3}')
[[ $char_count -eq $ZFS_MAXPROPLEN ]] || \
clone_list=$(zfs list -o clones $fs@snap)
char_count=$(echo "$clone_list" | tail -1 | wc | awk '{print $3}')
[[ $char_count -eq ZFS_MAXPROPLEN ]] || \
log_fail "Clone list not truncated correctly. Unexpected character count" \
"$char_count"

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
@ -37,8 +37,8 @@
#
if ismounted $FS_MNTPOINT $NEWFS_DEFAULT_FS ; then
log_must $UMOUNT -f $FS_MNTPOINT
$RM -fr $FS_MNTPOINT
log_must umount -f $FS_MNTPOINT
rm -fr $FS_MNTPOINT
fi
default_cleanup

View File

@ -25,7 +25,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -58,12 +58,12 @@ function get_used_prop
typeset ds=$1
typeset used
used=`$ZFS list -H -o used $ds`
used=`zfs list -H -o used $ds`
used=${used%[m|M]}
if [[ $used == *K ]]; then
used=0
fi
$ECHO $used
echo $used
}
#
@ -102,19 +102,19 @@ function do_vol_test
vol_b_path=$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL1
vol_r_path=$ZVOL_RDEVDIR/$TESTPOOL/$TESTVOL1
log_must $ZFS create -V $VOLSIZE -o copies=$copy $vol
log_must $ZFS set refreservation=none $vol
log_must zfs create -V $VOLSIZE -o copies=$copy $vol
log_must zfs set refreservation=none $vol
block_device_wait
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
log_must echo y | newfs $vol_r_path >/dev/null 2>&1
log_must mount -F ufs -o rw $vol_b_path $mntp
elif [[ $type == "ext2" ]]; then
log_must $ECHO y | $NEWFS $vol_r_path >/dev/null 2>&1
log_must $MOUNT -o rw $vol_b_path $mntp
log_must echo y | newfs $vol_r_path >/dev/null 2>&1
log_must mount -o rw $vol_b_path $mntp
else
log_must $ZPOOL create $TESTPOOL1 $vol_b_path
log_must $ZFS create $TESTPOOL1/$TESTFS1
log_must zpool create $TESTPOOL1 $vol_b_path
log_must zfs create $TESTPOOL1/$TESTFS1
fi
((nfilesize = copy * ${FILESIZE%m}))
@ -122,11 +122,11 @@ function do_vol_test
((target_size = pre_used + nfilesize))
if [[ $type == "ufs" ]]; then
log_must $MKFILE $FILESIZE $mntp/$FILE
log_must mkfile $FILESIZE $mntp/$FILE
elif [[ $type == "ext2" ]]; then
log_must $MKFILE $FILESIZE $mntp/$FILE
log_must mkfile $FILESIZE $mntp/$FILE
else
log_must $MKFILE $FILESIZE /$TESTPOOL1/$TESTFS1/$FILE
log_must mkfile $FILESIZE /$TESTPOOL1/$TESTFS1/$FILE
fi
post_used=$(get_used_prop $vol)
@ -142,12 +142,12 @@ function do_vol_test
fi
if [[ $type == "ufs" ]]; then
$UMOUNT $mntp
umount $mntp
elif [[ $type == "ext2" ]]; then
$UMOUNT $mntp
umount $mntp
else
log_must $ZPOOL destroy $TESTPOOL1
log_must zpool destroy $TESTPOOL1
fi
log_must $ZFS destroy $vol
log_must zfs destroy $vol
}

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
@ -46,7 +50,7 @@ function cleanup
for ds in $fs1 $fs2 $vol1 $vol2; do
if datasetexists $ds; then
log_must $ZFS destroy $ds
log_must zfs destroy $ds
fi
done
}
@ -69,34 +73,34 @@ for ds in $fs $vol; do
done
for val in 1 2 3; do
log_must $ZFS create -o copies=$val $fs1
log_must zfs create -o copies=$val $fs1
if is_global_zone; then
log_must $ZFS create -V $VOLSIZE -o copies=$val $vol1
log_must zfs create -V $VOLSIZE -o copies=$val $vol1
block_device_wait
else
log_must $ZFS create -o copies=$val $vol1
log_must zfs create -o copies=$val $vol1
fi
for ds in $fs1 $vol1; do
cmp_prop $ds $val
done
for val2 in 3 2 1; do
log_must $ZFS create -o copies=$val2 $fs2
log_must zfs create -o copies=$val2 $fs2
if is_global_zone; then
log_must $ZFS create -V $VOLSIZE -o copies=$val2 $vol2
log_must zfs create -V $VOLSIZE -o copies=$val2 $vol2
block_device_wait
else
log_must $ZFS create -o copies=$val2 $vol2
log_must zfs create -o copies=$val2 $vol2
fi
for ds in $fs2 $vol2; do
cmp_prop $ds $val2
log_must $ZFS destroy $ds
log_must zfs destroy $ds
block_device_wait
done
done
for ds in $fs1 $vol1; do
log_must $ZFS destroy $ds
log_must zfs destroy $ds
block_device_wait
done
@ -104,7 +108,7 @@ done
for val in 3 2 1; do
for ds in $fs $vol; do
log_must $ZFS set copies=$val $ds
log_must zfs set copies=$val $ds
cmp_prop $ds $val
done
done

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
@ -47,7 +51,7 @@ function cleanup
for val in 1 2 3; do
if datasetexists $TESTPOOL/fs_$val; then
log_must $ZFS destroy $TESTPOOL/fs_$val
log_must zfs destroy $TESTPOOL/fs_$val
fi
done
}
@ -56,15 +60,15 @@ log_assert "Verify that the space used by multiple copies is charged correctly."
log_onexit cleanup
for val in 1 2 3; do
log_must $ZFS create -o copies=$val $TESTPOOL/fs_$val
log_must zfs create -o copies=$val $TESTPOOL/fs_$val
log_must $MKFILE $FILESIZE /$TESTPOOL/fs_$val/$FILE
log_must mkfile $FILESIZE /$TESTPOOL/fs_$val/$FILE
done
#
# Sync up the filesystem
#
$SYNC
sync
#
# Verify 'zfs list' can correctly list the space charged
@ -83,21 +87,21 @@ else
blksize=512
fi
for val in 1 2 3; do
blks=`$LS -ls /$TESTPOOL/fs_$val/$FILE | $AWK '{print $1}'`
blks=`ls -ls /$TESTPOOL/fs_$val/$FILE | awk '{print $1}'`
(( used = blks * $blksize / (1024 * 1024) ))
check_used $used $val
done
log_note "Verify df(1M) can corectly display the space charged."
for val in 1 2 3; do
used=`$DF -F zfs -h /$TESTPOOL/fs_$val/$FILE | $GREP $TESTPOOL/fs_$val \
| $AWK '{print $3}'`
used=`df -F zfs -h /$TESTPOOL/fs_$val/$FILE | grep $TESTPOOL/fs_$val \
| awk '{print $3}'`
check_used $used $val
done
log_note "Verify du(1) can correctly display the space charged."
for val in 1 2 3; do
used=`$DU -h /$TESTPOOL/fs_$val/$FILE | $AWK '{print $1}'`
used=`du -h /$TESTPOOL/fs_$val/$FILE | awk '{print $1}'`
check_used $used $val
done

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
#
@ -48,7 +52,7 @@ function cleanup
fi
if datasetexists $vol; then
log_must $ZFS destroy $vol
log_must zfs destroy $vol
fi
}

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
@ -44,10 +48,10 @@ log_assert "Verify that copies property cannot be set to any value other than 1,
set -A badval 0 01 02 03 0 -1 -2 -3 10 20 30 4 5 6 blah
for val in ${badval[@]}; do
log_mustnot $ZFS create -o copies=$val $TESTPOOL/$TESTFS1
log_mustnot $ZFS create -V $VOLSIZE -o copies=$val $TESTPOOL/$TESTVOL1
log_mustnot $ZFS set copies=$val $TESTPOOL/$TESTFS
log_mustnot $ZFS set copies=$val $TESTPOOL/$TESTVOL
log_mustnot zfs create -o copies=$val $TESTPOOL/$TESTFS1
log_mustnot zfs create -V $VOLSIZE -o copies=$val $TESTPOOL/$TESTVOL1
log_mustnot zfs set copies=$val $TESTPOOL/$TESTFS
log_mustnot zfs set copies=$val $TESTPOOL/$TESTVOL
block_device_wait
done

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
@ -53,18 +57,18 @@ function cleanup
log_assert "Verify that copies cannot be set with pool version 1"
log_onexit cleanup
$CP $STF_SUITE/tests/functional/cli_root/zpool_upgrade/blockfiles/$ZPOOL_VERSION_1_FILES $TESTDIR
$BUNZIP2 $TESTDIR/$ZPOOL_VERSION_1_FILES
log_must $ZPOOL import -d $TESTDIR $ZPOOL_VERSION_1_NAME
log_must $ZFS create $ZPOOL_VERSION_1_NAME/$TESTFS
log_must $ZFS create -V 1m $ZPOOL_VERSION_1_NAME/$TESTVOL
cp $STF_SUITE/tests/functional/cli_root/zpool_upgrade/blockfiles/$ZPOOL_VERSION_1_FILES $TESTDIR
bunzip2 $TESTDIR/$ZPOOL_VERSION_1_FILES
log_must zpool import -d $TESTDIR $ZPOOL_VERSION_1_NAME
log_must zfs create $ZPOOL_VERSION_1_NAME/$TESTFS
log_must zfs create -V 1m $ZPOOL_VERSION_1_NAME/$TESTVOL
for val in 3 2 1; do
for ds in $ZPOOL_VERSION_1_NAME/$TESTFS $ZPOOL_VERSION_1_NAME/$TESTVOL; do
log_mustnot $ZFS set copies=$val $ds
log_mustnot zfs set copies=$val $ds
done
for ds in $ZPOOL_VERSION_1_NAME/$TESTFS1 $ZPOOL_VERSION_1_NAME/$TESTVOL1; do
log_mustnot $ZFS create -o copies=$val $ds
log_mustnot zfs create -o copies=$val $ds
done
done

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
#
@ -44,15 +48,15 @@ verify_runnable "global"
function cleanup
{
if ismounted $mntp $NEWFS_DEFAULT_FS ; then
log_must $UMOUNT $mntp
log_must umount $mntp
fi
if datasetexists $vol; then
log_must $ZFS destroy $vol
log_must zfs destroy $vol
fi
if [[ -d $mntp ]]; then
$RM -rf $mntp
rm -rf $mntp
fi
}
@ -63,7 +67,7 @@ mntp=$FS_MNTPOINT
vol=$TESTPOOL/$TESTVOL1
if [[ ! -d $mntp ]]; then
$MKDIR -p $mntp
mkdir -p $mntp
fi
for val in 1 2 3; do

View File

@ -24,6 +24,11 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
@ -43,7 +48,7 @@ function cleanup
typeset -i i=0
while (( $i < ${#datasets[*]} )); do
datasetexists ${datasets[$i]} && \
log_must $ZFS destroy -f ${datasets[$i]}
log_must zfs destroy -f ${datasets[$i]}
((i = i + 1))
done
}
@ -57,7 +62,7 @@ log_assert "'zfs create <filesystem>' can create a ZFS filesystem in the namespa
typeset -i i=0
while (( $i < ${#datasets[*]} )); do
log_must $ZFS create ${datasets[$i]}
log_must zfs create ${datasets[$i]}
datasetexists ${datasets[$i]} || \
log_fail "zfs create ${datasets[$i]} fail."
((i = i + 1))

View File

@ -24,6 +24,11 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create.cfg
@ -43,7 +48,7 @@ function cleanup
typeset -i j=0
while [[ $j -lt ${#size[*]} ]]; do
if datasetexists $TESTPOOL/${TESTVOL}${size[j]}; then
log_must $ZFS destroy $TESTPOOL/${TESTVOL}${size[j]}
log_must zfs destroy $TESTPOOL/${TESTVOL}${size[j]}
fi
((j = j + 1))
done
@ -56,7 +61,7 @@ log_assert "'zfs create -s -V <size> <volume>' succeeds"
typeset -i j=0
while (( $j < ${#size[*]} )); do
typeset cmdline="$ZFS create -s -V ${size[j]} \
typeset cmdline="zfs create -s -V ${size[j]} \
$TESTPOOL/${TESTVOL}${size[j]}"
str=$(eval $cmdline 2>&1)

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -47,7 +47,7 @@ verify_runnable "global"
function cleanup
{
datasetexists $vol && \
log_must $ZFS destroy -f $vol
log_must zfs destroy -f $vol
}
log_assert "Verify creating volume with specified blocksize works."
@ -58,11 +58,11 @@ vol=$TESTPOOL/$TESTVOL
typeset -i i=0
while (( i < ${#options[*]} )); do
log_must $ZFS create ${options[i]} -V $VOLSIZE $vol
log_must zfs create ${options[i]} -V $VOLSIZE $vol
datasetexists $vol || \
log_fail "zfs create ${options[i]} -V $VOLSIZE $vol fail."
log_must_busy $ZFS destroy -f $vol
log_must_busy zfs destroy -f $vol
((i = i + 1))
done

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/properties.kshlib
@ -45,7 +49,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must $ZFS destroy -f $TESTPOOL/$TESTFS1
log_must zfs destroy -f $TESTPOOL/$TESTFS1
}
log_onexit cleanup
@ -56,12 +60,12 @@ log_assert "'zfs create -o property=value filesystem' can successfully create \
typeset -i i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
log_must $ZFS create -o ${RW_FS_PROP[$i]} $TESTPOOL/$TESTFS1
log_must zfs create -o ${RW_FS_PROP[$i]} $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/$TESTFS1 || \
log_fail "zfs create $TESTPOOL/$TESTFS1 fail."
propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]} || \
log_fail "${RW_FS_PROP[i]} is failed to set."
log_must $ZFS destroy -f $TESTPOOL/$TESTFS1
log_must zfs destroy -f $TESTPOOL/$TESTFS1
(( i = i + 1 ))
done

View File

@ -25,6 +25,10 @@
# Use is subject to license terms.
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/properties.kshlib
@ -45,7 +49,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must $ZFS destroy -f $TESTPOOL/$TESTFS1
log_must zfs destroy -f $TESTPOOL/$TESTFS1
}
log_onexit cleanup
@ -64,7 +68,7 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
(( i = i + 1 ))
done
log_must $ZFS create $opts $TESTPOOL/$TESTFS1
log_must zfs create $opts $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/$TESTFS1 || \
log_fail "zfs create $TESTPOOL/$TESTFS1 fail."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -50,7 +50,7 @@ verify_runnable "global"
function cleanup
{
datasetexists $TESTPOOL/$TESTVOL1 && \
log_must $ZFS destroy -f $TESTPOOL/$TESTVOL1
log_must zfs destroy -f $TESTPOOL/$TESTVOL1
}
log_onexit cleanup
@ -61,21 +61,21 @@ log_assert "'zfs create -o property=value -V size volume' can successfully \
typeset -i i=0
while (( $i < ${#RW_VOL_PROP[*]} )); do
log_must $ZFS create -o ${RW_VOL_PROP[$i]} -V $VOLSIZE \
log_must zfs create -o ${RW_VOL_PROP[$i]} -V $VOLSIZE \
$TESTPOOL/$TESTVOL1
datasetexists $TESTPOOL/$TESTVOL1 || \
log_fail "zfs create -V size $TESTPOOL/$TESTVOL1 fail."
propertycheck $TESTPOOL/$TESTVOL1 ${RW_VOL_PROP[i]} || \
log_fail "${RW_VOL_PROP[i]} is failed to set."
log_must_busy $ZFS destroy -f $TESTPOOL/$TESTVOL1
log_must_busy zfs destroy -f $TESTPOOL/$TESTVOL1
log_must $ZFS create -s -o ${RW_VOL_PROP[$i]} -V $VOLSIZE \
log_must zfs create -s -o ${RW_VOL_PROP[$i]} -V $VOLSIZE \
$TESTPOOL/$TESTVOL1
datasetexists $TESTPOOL/$TESTVOL1 || \
log_fail "zfs create -s -V $TESTPOOL/$TESTVOL1 fail."
propertycheck $TESTPOOL/$TESTVOL1 ${RW_VOL_PROP[i]} || \
log_fail "${RW_VOL_PROP[i]} is failed to set."
log_must_busy $ZFS destroy -f $TESTPOOL/$TESTVOL1
log_must_busy zfs destroy -f $TESTPOOL/$TESTVOL1
(( i = i + 1 ))
done

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -50,9 +50,9 @@ verify_runnable "global"
function cleanup
{
datasetexists $TESTPOOL/$TESTVOL && \
log_must $ZFS destroy -f $TESTPOOL/$TESTVOL
log_must zfs destroy -f $TESTPOOL/$TESTVOL
datasetexists $TESTPOOL/$TESTVOL1 && \
log_must $ZFS destroy -f $TESTPOOL/$TESTVOL1
log_must zfs destroy -f $TESTPOOL/$TESTVOL1
}
log_onexit cleanup
@ -71,10 +71,10 @@ while (( $i < ${#RW_VOL_PROP[*]} )); do
(( i = i + 1 ))
done
log_must $ZFS create $opts -V $VOLSIZE $TESTPOOL/$TESTVOL
log_must zfs create $opts -V $VOLSIZE $TESTPOOL/$TESTVOL
datasetexists $TESTPOOL/$TESTVOL || \
log_fail "zfs create $TESTPOOL/$TESTVOL fail."
log_must $ZFS create -s $opts -V $VOLSIZE $TESTPOOL/$TESTVOL1
log_must zfs create -s $opts -V $VOLSIZE $TESTPOOL/$TESTVOL1
datasetexists $TESTPOOL/$TESTVOL1 || \
log_fail "zfs create $TESTPOOL/$TESTVOL1 fail."

View File

@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
@ -47,7 +47,7 @@ verify_runnable "both"
function cleanup
{
if datasetexists $TESTPOOL/$TESTFS1 ; then
log_must $ZFS destroy -f $TESTPOOL/$TESTFS1
log_must zfs destroy -f $TESTPOOL/$TESTFS1
fi
}
@ -93,8 +93,8 @@ log_assert "'zfs create' should return an error with badly-formed parameters."
typeset -i i=0
while [[ $i -lt ${#args[*]} ]]; do
log_mustnot $ZFS create ${args[i]} $TESTPOOL/$TESTFS1
log_mustnot $ZFS create -p ${args[i]} $TESTPOOL/$TESTFS1
log_mustnot zfs create ${args[i]} $TESTPOOL/$TESTFS1
log_mustnot zfs create -p ${args[i]} $TESTPOOL/$TESTFS1
((i = i + 1))
done

Some files were not shown because too many files have changed in this diff Show More