Skip to content

Commit

Permalink
zts: Fix and change testcase cache_010_neg
Browse files Browse the repository at this point in the history
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 files
and character devices too. The testcase is renamed to cache_010_pos and
the exceptions for known failure removed from the test runner.

Reported-by: Richard Elling <[email protected]>
Signed-off-by: Alex John <[email protected]>
  • Loading branch information
spaghetti- committed Apr 2, 2020
1 parent 5a42ef0 commit 62abe68
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion tests/test-runner/bin/zts-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion tests/zfs-tests/tests/functional/cache/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -56,29 +56,29 @@ function cleanup_testenv
fi
}

log_assert "Cache device can only be block devices."
log_assert "Cache device can be files, character devices or block devices."
log_onexit cleanup_testenv

TESTVOL=testvol1$$
dsk1=${DISKS%% *}
log_must zpool create $TESTPOOL ${DISKS#$dsk1}

# Add nomal ${DEV_RDSKDIR} device
log_must zpool add $TESTPOOL cache \
${DEV_RDSKDIR}/${dsk1}${SLICE_PREFIX}${SLICE0}
log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'

# Add normal file
log_mustnot zpool add $TESTPOOL cache $VDEV2
log_must zpool add $TESTPOOL cache $VDEV2

# Add /dev/rlofi device (allowed under Linux)
if is_linux; then
lofidev=$(losetup -f)
lofidev=${lofidev##*/}
log_must zpool remove $TESTPOOL ${VDEV2%% *}
log_must losetup $lofidev ${VDEV2%% *}
log_must zpool add $TESTPOOL cache $lofidev
log_must zpool remove $TESTPOOL $lofidev
log_must losetup -d $lofidev
log_must losetup -d "/dev/$lofidev"
lofidev=""
else
lofidev=${VDEV2%% *}
Expand All @@ -93,7 +93,7 @@ fi
if ! is_linux; then
log_must zpool create $TESTPOOL2 $VDEV2
log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot zpool add $TESTPOOL cache \
log_must zpool add $TESTPOOL cache \
${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
fi

Expand Down

0 comments on commit 62abe68

Please sign in to comment.