ZTS: Fix and change testcase cache_010_neg

Commit 379ca9c removed the requirement on aux devices to be block
devices only but the test case cache_010_neg was not updated, making it
fail consistently.

This change changes the test to check that cache devices _can_ be
anything that presents a block interface. The testcase is renamed to
cache_010_pos and the exceptions for known failure removed from the test
runner.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported-by: Richard Elling <Richard.Elling@RichardElling.com>
Signed-off-by: Alex John <alex@stty.io>
Closes #10172
This commit is contained in:
alex 2020-04-14 01:50:41 +08:00 committed by GitHub
parent 20f287855a
commit c602b35cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 30 deletions

View File

@ -49,7 +49,7 @@ post =
[tests/functional/cache]
tests = ['cache_001_pos', 'cache_002_pos', 'cache_003_pos', 'cache_004_neg',
'cache_005_neg', 'cache_006_pos', 'cache_007_neg', 'cache_008_neg',
'cache_009_pos', 'cache_010_neg', 'cache_011_pos', 'cache_012_pos']
'cache_009_pos', 'cache_010_pos', 'cache_011_pos', 'cache_012_pos']
tags = ['functional', 'cache']
[tests/functional/cachefile]

View File

@ -191,7 +191,6 @@
maybe = {
'alloc_class/alloc_class_012_pos': ['FAIL', '9142'],
'alloc_class/alloc_class_013_pos': ['FAIL', '9142'],
'cache/cache_010_neg': ['FAIL', known_reason],
'chattr/setup': ['SKIP', exec_reason],
'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],

View File

@ -11,7 +11,7 @@ dist_pkgdata_SCRIPTS = \
cache_007_neg.ksh \
cache_008_neg.ksh \
cache_009_pos.ksh \
cache_010_neg.ksh \
cache_010_pos.ksh \
cache_011_pos.ksh \
cache_012_pos.ksh

View File

@ -34,12 +34,12 @@
#
# DESCRIPTION:
# Verify cache device must be a block device.
# Verify that cache devices can be block devices, files or character devices
#
# STRATEGY:
# 1. Create a pool
# 2. Add different object as cache
# 3. Verify character devices and files fail
# 3. Verify character devices and files pass
#
verify_runnable "global"
@ -50,51 +50,55 @@ function cleanup_testenv
if [[ -n $lofidev ]]; then
if is_linux; then
losetup -d $lofidev
elif is_freebsd; then
mdconfig -du ${lofidev#md}
else
lofiadm -d $lofidev
fi
fi
}
log_assert "Cache device can only be block devices."
log_assert "Verify cache devices can be disk, file, lofi device or any " \
"device that presents a block interface"
verify_disk_count "$DISKS" 2
log_onexit cleanup_testenv
TESTVOL=testvol1$$
dsk1=${DISKS%% *}
log_must zpool create $TESTPOOL ${DISKS#$dsk1}
# Add nomal ${DEV_RDSKDIR} device
# Add normal ${DEV_RDSKDIR} device
log_must zpool add $TESTPOOL cache \
${DEV_RDSKDIR}/${dsk1}${SLICE_PREFIX}${SLICE0}
${DEV_RDSKDIR}/${dsk1}
log_must zpool remove $TESTPOOL ${DEV_RDSKDIR}/${dsk1}
# Add provided disk
log_must zpool add $TESTPOOL cache $dsk1
log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
log_must zpool remove $TESTPOOL $dsk1
# Add normal file
log_mustnot zpool add $TESTPOOL cache $VDEV2
log_must zpool add $TESTPOOL cache $VDEV
ldev=$(random_get $VDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
# Add /dev/rlofi device (allowed under Linux)
# Add loop back device
if is_linux; then
lofidev=$(losetup -f)
lofidev=${lofidev##*/}
log_must losetup $lofidev ${VDEV2%% *}
log_must zpool add $TESTPOOL cache $lofidev
log_must zpool remove $TESTPOOL $lofidev
log_must losetup -d $lofidev
lofidev=""
lofidev=${lofidev##*/}
elif is_freebsd; then
lofidev=$(mdconfig -a ${VDEV2%% *})
else
lofidev=${VDEV2%% *}
log_must lofiadm -a $lofidev
lofidev=$(lofiadm $lofidev)
log_mustnot zpool add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
log_must lofiadm -d $lofidev
lofidev=""
fi
# Add /dev/zvol/rdsk device (allowed under Linux)
if ! is_linux; then
log_must zpool create $TESTPOOL2 $VDEV2
log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot zpool add $TESTPOOL cache \
${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
fi
log_must zpool add $TESTPOOL cache $lofidev
log_must verify_cache_device $TESTPOOL $lofidev 'ONLINE'
log_pass "Cache device can only be block devices."
log_pass "Verify cache devices can be disk, file, lofi device or any " \
"device that presents a block interface"

View File

@ -34,10 +34,6 @@
verify_runnable "global"
if ! is_physical_device $LDEV; then
log_unsupported "Only physical disk could be cache device"
fi
log_must rm -rf $VDIR $VDIR2
log_must mkdir -p $VDIR $VDIR2
log_must mkfile $SIZE $VDEV $VDEV2