aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/libtest.shlib
diff options
context:
space:
mode:
authorLOLi <[email protected]>2017-09-25 19:32:34 +0200
committerBrian Behlendorf <[email protected]>2017-09-25 10:32:34 -0700
commit3fd3e56cfd543d7d7a1bf502bfc0db6e24139668 (patch)
tree1ccc22b4c0eccb6e3f38fa973b89dc8d6a4bfaa4 /tests/zfs-tests/include/libtest.shlib
parentb33d668ddb005b1072c26d36e1abff53aa39ca98 (diff)
Fix some ZFS Test Suite issues
* Add 'zfs bookmark' coverage (zfs_bookmark_cliargs) * Add OpenZFS 8166 coverage (zpool_scrub_offline_device) * Fix "busy" zfs_mount_remount failures * Fix bootfs_003_pos, bootfs_004_neg, zdb_005_pos local cleanup * Update usage of $KEEP variable, add get_all_pools() function * Enable history_008_pos and rsend_019_pos (non-32bit builders) * Enable zfs_copies_005_neg, update local cleanup * Fix zfs_send_007_pos (large_dnode + OpenZFS 8199) * Fix rollback_003_pos (use dataset name, not mountpoint, to unmount) * Update default_raidz_setup() to work properly with more than 3 disks * Use $TEST_BASE_DIR instead of hardcoded (/var)/tmp for file VDEVs * Update usage of /dev/random to /dev/urandom Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Issue #6086 Closes #5658 Closes #6143 Closes #6421 Closes #6627 Closes #6632
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r--tests/zfs-tests/include/libtest.shlib26
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index 3248ceb70..d72ebc8ed 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -481,7 +481,7 @@ function default_raidz_setup
fi
[[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
- log_must zpool create -f $TESTPOOL raidz $1 $2 $3
+ log_must zpool create -f $TESTPOOL raidz $disklist
log_must zfs create $TESTPOOL/$TESTFS
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
@@ -503,9 +503,19 @@ function default_cleanup
log_pass
}
+#
+# Utility function used to list all available pool names.
+#
+# NOTE: $KEEP is a variable containing pool names, separated by a newline
+# character, that must be excluded from the returned list.
+#
+function get_all_pools
+{
+ zpool list -H -o name | grep -Fvx "$KEEP" | grep -v "$NO_POOLS"
+}
+
function default_cleanup_noexit
{
- typeset exclude=""
typeset pool=""
#
# Destroying the pool will also destroy any
@@ -513,9 +523,7 @@ function default_cleanup_noexit
#
if is_global_zone; then
zfs unmount -a > /dev/null 2>&1
- exclude=`eval echo \"'(${KEEP})'\"`
- ALL_POOLS=$(zpool list -H -o name \
- | grep -v "$NO_POOLS" | egrep -v "$exclude")
+ ALL_POOLS=$(get_all_pools)
# Here, we loop through the pools we're allowed to
# destroy, only destroying them if it's safe to do
# so.
@@ -527,9 +535,7 @@ function default_cleanup_noexit
then
destroy_pool $pool
fi
- ALL_POOLS=$(zpool list -H -o name \
- | grep -v "$NO_POOLS" \
- | egrep -v "$exclude")
+ ALL_POOLS=$(get_all_pools)
done
done
@@ -1617,7 +1623,7 @@ function zfs_zones_setup #zone_name zone_root zone_ip
# If current system support slog, add slog device for pool
#
if verify_slog_support ; then
- typeset sdevs="/var/tmp/sdev1 /var/tmp/sdev2"
+ typeset sdevs="$TEST_BASE_DIR/sdev1 $TEST_BASE_DIR/sdev2"
log_must mkfile $MINVDEVSIZE $sdevs
log_must zpool add $pool_name log mirror $sdevs
fi
@@ -2615,7 +2621,7 @@ function random_get
#
function verify_slog_support
{
- typeset dir=/tmp/disk.$$
+ typeset dir=$TEST_BASE_DIR/disk.$$
typeset pool=foo.$$
typeset vdev=$dir/a
typeset sdev=$dir/b