mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
tests: check sysfs more generically
Allow to access more files in device sysfs subtree.
This commit is contained in:
parent
d9176782fe
commit
a939857a63
@ -365,11 +365,11 @@ dev_md5sum() {
|
||||
die "LV $1/$2 has different MD5 check sum!")
|
||||
}
|
||||
|
||||
sysfs_queue() {
|
||||
sysfs() {
|
||||
# read maj min and also convert hex to decimal
|
||||
local maj=$(($(stat -L --printf=0x%t "$1")))
|
||||
local min=$(($(stat -L --printf=0x%T "$1")))
|
||||
local P="/sys/dev/block/$maj:$min/queue/$2"
|
||||
local P="/sys/dev/block/$maj:$min/$2"
|
||||
local val=$(< "$P") || return 0 # no sysfs ?
|
||||
test "$val" -eq "$3" || \
|
||||
die "$1: $P = $val differs from expected value $3!"
|
||||
|
@ -25,12 +25,12 @@ aux prepare_profiles "thin-performance"
|
||||
# Create scsi debug dev with sector size of 4096B and 1MiB optimal_io_size
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256 || skip
|
||||
EXPECT=1048576
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" optimal_io_size "$EXPECT"
|
||||
check sysfs "$(< SCSI_DEBUG_DEV)" queue/optimal_io_size "$EXPECT"
|
||||
aux prepare_pvs 1 $DEV_SIZE
|
||||
|
||||
# Check we are not running on buggy kernel (broken lcm())
|
||||
# If so, turn chunk_size test into 'should'
|
||||
check sysfs_queue "$dev1" optimal_io_size "$EXPECT" || SHOULD=should
|
||||
check sysfs "$dev1" queue/optimal_io_size "$EXPECT" || SHOULD=should
|
||||
|
||||
vgcreate $vg "$dev1"
|
||||
|
||||
|
@ -56,7 +56,7 @@ aux cleanup_scsi_debug_dev
|
||||
LOGICAL_BLOCK_SIZE=512
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
get_devs
|
||||
|
||||
@ -72,7 +72,7 @@ aux cleanup_scsi_debug_dev
|
||||
LOGICAL_BLOCK_SIZE=512
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate $vg "${DEVICES[@]}"
|
||||
@ -87,7 +87,7 @@ aux cleanup_scsi_debug_dev
|
||||
LOGICAL_BLOCK_SIZE=4096
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate $vg "${DEVICES[@]}"
|
||||
@ -107,14 +107,14 @@ LOGICAL_BLOCK_SIZE=512
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE opt_blks=1536
|
||||
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" optimal_io_size 786432
|
||||
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs "$(< SCSI_DEBUG_DEV)" queue/optimal_io_size 786432
|
||||
|
||||
aux prepare_pvs 1 $PER_DEV_SIZE
|
||||
|
||||
# Kernel (3.19) could provide wrong results - in this case skip
|
||||
# test with incorrect result - lvm2 can't figure out good values.
|
||||
check sysfs_queue "$dev1" optimal_io_size 786432 || SHOULD=should
|
||||
check sysfs "$dev1" queue/optimal_io_size 786432 || SHOULD=should
|
||||
$SHOULD check pv_field "${DEVICES[@]}" pe_start 768.00k
|
||||
|
||||
aux cleanup_scsi_debug_dev
|
||||
|
Loading…
Reference in New Issue
Block a user