Make slog test setup more robust

The slog tests fail when attempting to create pools using file vdevs
that already exist from previous test runs. Remove these files in the
setup for the test.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9194
This commit is contained in:
Ryan Moeller 2019-08-22 20:26:51 -04:00 committed by Brian Behlendorf
parent 19d61d63fa
commit 97c54ea818
19 changed files with 27 additions and 10 deletions

View File

@ -38,13 +38,4 @@ if ! verify_slog_support ; then
log_unsupported "This system doesn't support separate intent logs"
fi
if [[ -d $VDEV ]]; then
log_must rm -rf $VDIR
fi
if [[ -d $VDEV2 ]]; then
log_must rm -rf $VDIR2
fi
log_must mkdir -p $VDIR $VDIR2
log_must truncate -s $MINVDEVSIZE $VDEV $SDEV $LDEV $VDEV2 $SDEV2 $LDEV2
log_pass

View File

@ -31,11 +31,20 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/slog/slog.cfg
function setup
{
log_must rm -rf $VDIR $VDIR2
log_must mkdir -p $VDIR $VDIR2
log_must truncate -s $MINVDEVSIZE $VDEV $SDEV $LDEV $VDEV2 $SDEV2 $LDEV2
return 0
}
function cleanup
{
poolexists $TESTPOOL && destroy_pool $TESTPOOL
poolexists $TESTPOOL2 && destroy_pool $TESTPOOL2
rm -rf $TESTDIR
rm -rf $TESTDIR $VDIR $VDIR2
}
#

View File

@ -45,6 +45,7 @@ verify_runnable "global"
log_assert "Creating a pool with a log device succeeds."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Adding a log device to normal pool works."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Adding an extra log device works."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Attaching a log device passes."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Detaching a log device passes."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Replacing a log device passes."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -48,6 +48,7 @@ verify_runnable "global"
log_assert "Exporting and importing pool with log devices passes."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -44,6 +44,7 @@ verify_runnable "global"
log_assert "A raidz/raidz2 log is not supported."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -45,6 +45,7 @@ verify_runnable "global"
log_assert "A raidz/raidz2 log can not be added to existed pool."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Slog device can not be replaced with spare device."
log_onexit cleanup
log_must setup
log_must zpool create $TESTPOOL $VDEV spare $SDEV log $LDEV
sdev=$(random_get $SDEV)

View File

@ -46,6 +46,7 @@ verify_runnable "global"
log_assert "Offline and online a log device passes."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -45,6 +45,7 @@ verify_runnable "global"
log_assert "Pool can survive when one of mirror log device get corrupted."
log_onexit cleanup
log_must setup
for type in "" "mirror" "raidz" "raidz2"
do

View File

@ -60,6 +60,7 @@ log_assert "Verify slog device can be disk, file, lofi device or any device " \
"that presents a block interface."
verify_disk_count "$DISKS" 2
log_onexit cleanup_testenv
log_must setup
dsk1=${DISKS%% *}
log_must zpool create $TESTPOOL ${DISKS#$dsk1}

View File

@ -44,6 +44,7 @@
verify_runnable "global"
log_assert "log device can survive when one of the pool device get corrupted."
log_must setup
for type in "mirror" "raidz" "raidz2"; do
for spare in "" "spare"; do

View File

@ -47,6 +47,7 @@ function cleanup
ORIG_TIMEOUT=$(get_tunable zfs_commit_timeout_pct | tail -1 | awk '{print $NF}')
log_onexit cleanup
log_must setup
for PCT in 0 1 2 4 8 16 32 64 128 256 512 1024; do
log_must set_tunable64 zfs_commit_timeout_pct $PCT

View File

@ -66,6 +66,7 @@ function cleanup_fs
log_assert "Replay of intent log succeeds."
log_onexit cleanup_fs
log_must setup
#
# 1. Create an empty file system (TESTFS)

View File

@ -76,6 +76,7 @@ function cleanup_volume
log_assert "Replay of intent log succeeds."
log_onexit cleanup_volume
log_must setup
#
# 1. Create an empty volume (TESTVOL), set sync=always, and format