svn commit: r328577 - projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash
Alan Somers
asomers at FreeBSD.org
Tue Jan 30 00:18:37 UTC 2018
Author: asomers
Date: Tue Jan 30 00:18:36 2018
New Revision: 328577
URL: https://svnweb.freebsd.org/changeset/base/328577
Log:
Convert zvol_thrash_001_pos to use gnop(8)
tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh
tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh
tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg
tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh
tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh
Use gnop(8) to remove providers instead of SAS phy control. This
has several advantages:
* Requires no special hardware
* Works in VMs
* No 2-second delay for the provider to disappear
* Predictable device names during thrash tests
* Simplified logic, especially during cleanup
Also, speed up the test by a factor of two. This is possible
because there's no longer the 2 second delay for a provider to
disappear.
Sponsored by: Spectra Logic Corp
Modified:
projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh
projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh
projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg
projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh
projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh Tue Jan 30 00:11:35 2018 (r328576)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh Tue Jan 30 00:18:36 2018 (r328577)
@@ -29,10 +29,11 @@
# $FreeBSD$
. ${STF_SUITE}/include/libtest.kshlib
+. ${STF_SUITE}/include/libgnop.kshlib
-verify_runnable "global"
-
# Rotate logs now, because this test can generate a great volume of log entries
newsyslog
-default_cleanup
+default_cleanup_noexit
+destroy_gnops ${DISKS}
+log_pass
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh Tue Jan 30 00:11:35 2018 (r328576)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh Tue Jan 30 00:18:36 2018 (r328577)
@@ -29,18 +29,9 @@
# $FreeBSD$
. ${STF_SUITE}/include/libtest.kshlib
-. ${STF_SUITE}/include/libsas.kshlib
+. $STF_SUITE/include/libgnop.kshlib
-verify_runnable "global"
-echo "list of disks: $DISKS"
-
-# Make sure that all of the disks that we've been given are attached to a
-# SAS expander, and that we can find the phy they're attached to. This
-# function will cause the script to exit if it fails.
-for disk in $DISKS
-do
- find_verify_sas_disk $disk
-done
+log_must create_gnops ${DISKS}
# Rotate logs now, because this test can generate a great volume of log entries
newsyslog
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg Tue Jan 30 00:11:35 2018 (r328576)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg Tue Jan 30 00:18:36 2018 (r328577)
@@ -29,5 +29,4 @@
#
# $FreeBSD$
#
-export SAS_DEFAULT_TIME=360
-export STF_TIMEOUT=900
+export RUNTIME=180
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh Tue Jan 30 00:11:35 2018 (r328576)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh Tue Jan 30 00:18:36 2018 (r328577)
@@ -32,14 +32,9 @@
#
. $STF_SUITE/include/libtest.kshlib
-. $STF_SUITE/include/libsas.kshlib
+. $STF_SUITE/include/libgnop.kshlib
-
-typeset -i NUM_FAILURES=0
-export NUM_FAILURES
-
-# Cleanup function. Kill each of the children, they will re-enable the PHY
-# they're working on.
+# Cleanup function. Kill each of the children.
function docleanup
{
for CPID in $CHILDREN
@@ -53,18 +48,15 @@ function docleanup
done
}
-# If we get killed, try to re-enable the PHY we were toggling.
-function diskcleanup
+function childcleanup
{
- log_note "Got a signal, sending linkreset to $EXPANDER phy $PHY"
- camcontrol smppc $EXPANDER -o linkreset -p $PHY
exit 0
}
# Wait for the timeout, and then kill the child processes.
-function disktimeout
+function childrentimeout
{
- log_note "disktimeout process waiting $1 seconds"
+ log_note "childrentimeout process waiting $1 seconds"
sleep $1
docleanup
}
@@ -74,12 +66,15 @@ function mk_vols
ADISKS=($DISKS) #Create an array for convenience
N_DISKS=${#ADISKS[@]}
N_MIRRORS=$(($N_DISKS / 2 ))
- setup_mirrors $N_MIRRORS $DISKS
+ # Use a special ksh93 expansion to generate the list of gnop devices
+ GNOPS=${DISKS//~(E)([[:space:]]+|$)/.nop\1}
+ setup_mirrors $N_MIRRORS $GNOPS
for pool in `all_pools`; do
# Create 4 ZVols per pool. Write a geom label to each, just so
# that we have another geom class between zvol and the vdev
# taster. That thwarts detection of zvols based on a geom
- # producer's class name, as was attempted by change 538882
+ # producer's class name, as was attempted by Perforce change
+ # 538882
for ((j=0; $j<4; j=$j+1)); do
$ZFS create -V 10G $pool/testvol.$j
glabel label testlabel$j /dev/zvol/$pool/testvol.$j
@@ -88,81 +83,30 @@ function mk_vols
}
export CHILDREN=""
-export FAILFILES=""
-export POOLS=""
log_onexit docleanup
-typeset i=0
-typeset -i num_disks_used=0
-
-log_assert "Cause frequent device removal and arrival in the prescence of zvols. ZFS should not misbehave while tasting them for VDev GUIDs."
+log_assert "Cause frequent device removal and arrival in the prescence of zvols. ZFS should not crash or hang while tasting them for VDev GUIDs."
mk_vols
for p in `all_pools`
do
- disk=`get_disklist $p | cut -d " " -f 1` #Take the first disk in the pool
- # See if this disk is attached to a parent that supports SMP
- # XXX this only works with the current scheme where SMP commands get
- # sent to a device or its parent, if the device doesn't support SMP
- camcontrol smprg $disk > /dev/null 2>&1
- if [ $? != 0 ]; then
- continue
- fi
+ #Take the first gnop in the pool
+ typeset gnop
+ typeset disk
+ gnop=`get_disklist $p | cut -d " " -f 1`
+ disk=${gnop%.nop}
- # Find the expander and PHY that this disk is attached to, if any.
- # We will exit from here if there is a failure.
- find_verify_sas_disk $disk
-
- typeset -i x=0
- log_note "thrashing phy on $disk on $EXPANDER phy $PHY"
- export FAILFILE=$TMPDIR/${EXPANDER}.${PHY}.failed
- trap diskcleanup INT TERM && rm -f $FAILFILE && while `true`; do
- ((x=x+1))
- camcontrol smppc $EXPANDER -v -o disable -p $PHY
- if [ $? != 0 ]; then
- log_note "Failed to disable $EXPANDER phy $PHY"
- echo "Expander $EXPANDER phy $PHY failed" >> $FAILFILE
- break
- fi
- $SLEEP 10
- camcontrol smppc $EXPANDER -v -o linkreset -p $PHY
- if [ $? != 0 ]; then
- log_note "Failed to reset $EXPANDER phy $PHY"
- echo "Expander $EXPANDER phy $PHY failed" >> $FAILFILE
- break
- fi
- $SLEEP 10
+ log_note "thrashing $gnop"
+ trap childcleanup INT TERM && while `true`; do
+ log_must destroy_gnop $disk
+ $SLEEP 5
+ log_must create_gnop $disk
+ $SLEEP 5
done &
CHILDREN="$CHILDREN $!"
- FAILFILES="$FAILFILES $FAILFILE"
- ((num_disks_used++))
done
-typeset -i sleep_time=$SAS_DEFAULT_TIME
+log_note "Waiting $RUNTIME seconds for potential ZFS failure"
+childrentimeout $RUNTIME
-if [ $num_disks_used -gt 0 ]; then
- log_note "Tests queued on $num_disks_used disks"
- log_note "Waiting $sleep_time seconds for potential driver failure"
- disktimeout $sleep_time &
- wait
-
- for i in $FAILFILES; do
- typeset FILEBASE=${i%%.failed}
- FILEBASE=${FILEBASE##$TMPDIR/}
- if [ -f $i ]; then
- log_note "Test of $FILEBASE failed"
- ((NUM_FAILURES=NUM_FAILURES+1))
- rm -f $i
- else
- log_note "Test of $FILEBASE passed"
- fi
- done
- if [ $NUM_FAILURES -gt 0 ]; then
- log_fail "Saw $NUM_FAILURES failures"
- else
- log_note "Number of failures: $NUM_FAILURES"
- log_pass
- fi
-else
- log_unsupported "No tests queued, no SMP-capable devices found"
-fi
+log_pass
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh Tue Jan 30 00:11:35 2018 (r328576)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh Tue Jan 30 00:18:36 2018 (r328577)
@@ -28,7 +28,7 @@ atf_test_case zvol_thrash_001_pos cleanup
zvol_thrash_001_pos_head()
{
atf_set "descr" "Cause frequent device removal and arrival in the prescence of zvols. ZFS should not misbehave while tasting them for VDev GUIDs."
- atf_set "require.progs" zfs zpool camcontrol
+ atf_set "require.progs" zfs zpool gnop
atf_set "timeout" 900
}
zvol_thrash_001_pos_body()
More information about the svn-src-projects
mailing list