summaryrefslogtreecommitdiff
path: root/usr/src/test/zfs-tests/include
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/test/zfs-tests/include')
-rw-r--r--usr/src/test/zfs-tests/include/commands.cfg3
-rw-r--r--usr/src/test/zfs-tests/include/default.cfg4
-rw-r--r--usr/src/test/zfs-tests/include/libtest.shlib37
3 files changed, 40 insertions, 4 deletions
diff --git a/usr/src/test/zfs-tests/include/commands.cfg b/usr/src/test/zfs-tests/include/commands.cfg
index 1d19d9d473..36f9457197 100644
--- a/usr/src/test/zfs-tests/include/commands.cfg
+++ b/usr/src/test/zfs-tests/include/commands.cfg
@@ -10,7 +10,7 @@
#
#
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
#
export ARP="/usr/sbin/arp"
@@ -88,6 +88,7 @@ export METAINIT="/usr/sbin/metainit"
export METASTAT="/usr/sbin/metastat"
export MKDIR="/usr/bin/mkdir"
export MKFILE="/usr/sbin/mkfile"
+export MKTEMP="/usr/bin/mktemp"
export MKNOD="/usr/sbin/mknod"
export MODINFO="/usr/sbin/modinfo"
export MODUNLOAD="/usr/sbin/modunload"
diff --git a/usr/src/test/zfs-tests/include/default.cfg b/usr/src/test/zfs-tests/include/default.cfg
index 72079889cc..9580001eb1 100644
--- a/usr/src/test/zfs-tests/include/default.cfg
+++ b/usr/src/test/zfs-tests/include/default.cfg
@@ -25,7 +25,7 @@
#
#
-# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
#
. $STF_SUITE/include/commands.cfg
@@ -47,8 +47,10 @@ export DIR_RD_UPDATE="/opt/zfs-tests/bin/dir_rd_update"
export FILE_CHECK="/opt/zfs-tests/bin/file_check"
export FILE_TRUNC="/opt/zfs-tests/bin/file_trunc"
export FILE_WRITE="/opt/zfs-tests/bin/file_write"
+export GETHOLES="/opt/zfs-tests/bin/getholes"
export LARGEST_FILE="/opt/zfs-tests/bin/largest_file"
export MKBUSY="/opt/zfs-tests/bin/mkbusy"
+export MKHOLES="/opt/zfs-tests/bin/mkholes"
export MKTREE="/opt/zfs-tests/bin/mktree"
export MMAPWRITE="/opt/zfs-tests/bin/mmapwrite"
export RANDFREE_FILE="/opt/zfs-tests/bin/randfree_file"
diff --git a/usr/src/test/zfs-tests/include/libtest.shlib b/usr/src/test/zfs-tests/include/libtest.shlib
index f077e8dc31..7c25516d51 100644
--- a/usr/src/test/zfs-tests/include/libtest.shlib
+++ b/usr/src/test/zfs-tests/include/libtest.shlib
@@ -25,7 +25,7 @@
#
#
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
#
. ${STF_TOOLS}/contrib/include/logapi.shlib
@@ -2573,7 +2573,7 @@ function is_te_enabled
# Utility function to determine if a system has multiple cpus.
function is_mp
{
- (($(psrinfo -p) > 1))
+ (($($PSRINFO | $WC -l) > 1))
}
# Run the given command as the user provided.
@@ -2585,3 +2585,36 @@ function user_run
eval \$SU \$user -c \"$@\" > /tmp/out 2>/tmp/err
return $?
}
+
+#
+# Check if the pool contains the specified vdevs
+#
+# $1 pool
+# $2..n <vdev> ...
+#
+# Return 0 if the vdevs are contained in the pool, 1 if any of the specified
+# vdevs is not in the pool, and 2 if pool name is missing.
+#
+function vdevs_in_pool
+{
+ typeset pool=$1
+ typeset vdev
+
+ if [[ -z $pool ]]; then
+ log_note "Missing pool name."
+ return 2
+ fi
+
+ shift
+
+ typeset tmpfile=$($MKTEMP)
+ $ZPOOL list -Hv "$pool" >$tmpfile
+ for vdev in $@; do
+ $GREP -w ${vdev##*/} $tmpfile >/dev/null 2>&1
+ [[ $? -ne 0 ]] && return 1
+ done
+
+ $RM -f $tmpfile
+
+ return 0;
+}