svn commit: r292296 - in projects/zfsd/head/tests/sys/cddl/zfs: include tests/cache tests/cli_root/zpool_add tests/cli_root/zpool_create tests/grow_pool tests/hotspare tests/zinject
Alan Somers
asomers at FreeBSD.org
Tue Dec 15 23:56:59 UTC 2015
Author: asomers
Date: Tue Dec 15 23:56:57 2015
New Revision: 292296
URL: https://svnweb.freebsd.org/changeset/base/292296
Log:
Collect 6 different copies of set_disks() into libtest.kshlib. Make a few
minor updates to users of former copies that need particular results.
This function will be used for the upcoming zpool_destroy_004_pos, which
will test forced destroys with outstanding send|receive activity, and needs
to frequently create two pools.
Submitted by: will
Sponsored by: Spectra Logic Corp
Modified:
projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib
projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg
Modified: projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib Tue Dec 15 23:56:57 2015 (r292296)
@@ -1762,6 +1762,33 @@ function find_disks
done
}
+# A function to set convenience variables for disks.
+function set_disks
+{
+ set -A disk_array $(find_disks $DISKS)
+ [[ -z "$DISK_ARRAY_LIMIT" ]] && typeset -i DISK_ARRAY_LIMIT=5
+
+ if (( ${#disk_array[*]} <= 1 )); then
+ export DISK=${DISKS%% *}
+ else
+ export DISK=""
+ typeset -i i=0
+ while (( i < ${#disk_array[*]} && i <= $DISK_ARRAY_LIMIT )); do
+ export DISK${i}="${disk_array[$i]}"
+ DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
+ (( i = i + 1 ))
+ done
+ export DISK_ARRAY_NUM=$i
+ export DISKSARRAY
+ fi
+
+ if (( $DISK_ARRAY_NUM == 0 )); then
+ export disk=$DISK
+ else
+ export disk=$DISK0
+ fi
+}
+
#
# Add specified user to specified group
#
@@ -2828,5 +2855,3 @@ function restart_zfsd
fi
$RM -f $TMPDIR/.zfsd_enabled_during_stf_zfs_tests
}
-
-
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cache/cache.cfg Tue Dec 15 23:56:57 2015 (r292296)
@@ -29,33 +29,6 @@
. $STF_SUITE/tests/cli_root/cli.cfg
. $STF_SUITE/include/libtest.kshlib
-function set_disks
-{
- set -A disk_array $(find_disks $DISKS)
-
- typeset -i DISK_ARRAY_NUM=0
-
- if (( ${#disk_array[*]} <= 1 )); then
- export DISK=${DISKS%% *}
- else
- export DISK=""
- typeset -i i=0
- while (( i < ${#disk_array[*]} )); do
- export DISK${i}="${disk_array[$i]}"
- DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
- (( i = i + 1 ))
- done
- export DISK_ARRAY_NUM=$i
- export DISKSARRAY
- fi
-
- if (( $DISK_ARRAY_NUM == 0 )); then
- export disk=$DISK
- else
- export disk=$DISK0
- fi
-}
-
set_disks
export SIZE=64M
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg Tue Dec 15 23:56:57 2015 (r292296)
@@ -40,33 +40,6 @@ export STF_TIMEOUT=2400
export VDEVS_NUM=300
export FILE_SIZE=100 #100mb
-function set_disks
-{
- set -A disk_array $(find_disks $DISKS)
-
- if (( ${#disk_array[*]} <= 1 )); then
- export DISK=${DISKS%% *}
- else
- export DISK=""
- typeset -i i=0
- while (( i < ${#disk_array[*]} )); do
- export DISK${i}="${disk_array[$i]}"
- DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
- (( i = i + 1 ))
- (( i>$DISK_ARRAY_LIMIT )) && break
- done
- export DISK_ARRAY_NUM=$i
- export DISKSARRAY
- fi
-
- if (( $DISK_ARRAY_NUM == 0 )); then
- export disk=$DISK
- else
- export disk=$DISK0
- fi
-
-}
-
set_disks
export FILESIZE="100m"
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg Tue Dec 15 23:56:57 2015 (r292296)
@@ -42,26 +42,6 @@ export FILE_SIZE=100 #100mb
export MD_OVERHEAD=10 # 10%
export POOL_MINSIZE=64 # the minimum size(64m) to create a storage pool
-function set_disks
-{
- set -A disk_array $(find_disks $DISKS)
-
- if (( ${#disk_array[*]} <= 1 )); then
- export DISK=${DISKS%% *}
- else
- export DISK=""
- typeset -i i=0
- while (( i < ${#disk_array[*]} )); do
- export DISK${i}="${disk_array[$i]}"
- DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
- (( i = i + 1 ))
- (( i>$DISK_ARRAY_LIMIT )) && break
- done
- export DISK_ARRAY_NUM=$i
- export DISKSARRAY
- fi
-}
-
set_disks
export FILESIZE="100m"
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg Tue Dec 15 23:56:57 2015 (r292296)
@@ -28,23 +28,7 @@
. $STF_SUITE/include/libtest.kshlib
-function set_disks
-{
- set -A disk_array $(find_disks $DISKS)
- typeset -i i=0
- typeset -i limit=2
- while (( i < limit )); do
- if [[ -n ${disk_array[$i]} ]]; then
- export DISK${i}="${disk_array[$i]}"
- else
- export DISK=${DISKS%% *}
- return
- fi
- ((i = i + 1))
- done
- export DISK=""
-}
-
+export DISK_ARRAY_LIMIT=2
export BLOCK_SIZE=8192
set_disks
#
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg Tue Dec 15 23:56:57 2015 (r292296)
@@ -30,7 +30,6 @@
. $STF_SUITE/include/libtest.kshlib
export DISK_ARRAY_NUM=0
-export DISK_ARRAY_LIMIT=5
export DISKSARRAY=""
#
@@ -38,32 +37,6 @@ export DISKSARRAY=""
#
export STF_TIMEOUT=3600
-function set_disks
-{
- set -A disk_array $(find_disks $DISKS)
-
- if (( ${#disk_array[*]} <= 1 )); then
- export DISK=${DISKS%% *}
- else
- export DISK=""
- typeset -i i=0
- while (( i < ${#disk_array[*]} && \
- i < $DISK_ARRAY_LIMIT )); do
- export DISK${i}="${disk_array[$i]}"
- DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
- (( i = i + 1 ))
- done
- export DISK_ARRAY_NUM=$i
- export DISKSARRAY
- fi
-
- if (( $DISK_ARRAY_NUM == 0 )); then
- export disk=$DISK
- else
- export disk=$DISK0
- fi
-}
-
set_disks
export FILESIZE="100m"
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg Tue Dec 15 23:54:06 2015 (r292295)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg Tue Dec 15 23:56:57 2015 (r292296)
@@ -40,28 +40,6 @@ export STF_TIMEOUT=1800
export DISK_ARRAY_LIMIT=4
export DISKSARRAY=""
-function set_disks
-{
- set -A disk_array $(find_disks $DISKS)
-
- if (( ${#disk_array[*]} <= 1 )); then
- export DISK=${DISKS%% *}
- else
- export DISK=""
- typeset -i i=0
- while (( i < ${#disk_array[*]} && \
- i < $DISK_ARRAY_LIMIT )); do
- export DISK${i}="${disk_array[$i]}"
- DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
- (( i = i + 1 ))
- done
-
-
- export DISKSARRAY
- fi
-
-}
-
set_disks
export SIZE="200m"
More information about the svn-src-projects
mailing list