tests: Skip block devices marked as hidden

These devices don't come with their major:minor dev, hence they won't
pop up under /dev, i.e. are not really usable.

Change-Id: I49b39ccbedcdd1bfe37964819e15b769af22cab6
Signed-off-by: Michal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17774
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
Michal Berger 2023-04-25 16:23:50 +02:00 committed by David Ko
parent 5741feb45f
commit df90fdb9c2
2 changed files with 13 additions and 6 deletions

View File

@ -195,13 +195,19 @@ function linux_hugetlbfs_mounts() {
function get_block_dev_from_bdf() {
local bdf=$1
local block
local block blocks=() ctrl
for block in /sys/block/*; do
if [[ $(readlink -f "$block/device") == *"/$bdf/"* ]]; then
echo "${block##*/}"
if [[ $block == *nvme* ]]; then
ctrl=${block##*/} ctrl=${ctrl%n*}
if [[ -e /sys/class/nvme/$ctrl && $(< "/sys/class/nvme/$ctrl/address") == "$bdf" ]]; then
blocks+=("${block##*/}")
fi
elif [[ $(readlink -f "$block/device") == *"/$bdf/"* ]]; then
blocks+=("${block##*/}")
fi
done
printf '%s\n' "${blocks[@]}"
}
function get_used_bdf_block_devs() {

View File

@ -8,6 +8,7 @@ rootdir=$(readlink -f "$testdir/../../")
source "$testdir/common.sh"
shopt -s nullglob
shopt -s extglob
cleanup() {
cleanup_nvme
@ -195,9 +196,9 @@ declare -a blocks=()
declare -A blocks_to_pci=()
min_disk_size=$((1024 ** 3 * 3)) # 3GB
for block in "/sys/block/nvme"*; do
pci=$(readlink -f "$block/device/device")
pci=${pci##*/}
for block in "/sys/block/nvme"!(*c*); do
ctrl=${block##*/} ctrl=${ctrl%n*}
pci=$(< "/sys/class/nvme/$ctrl/address")
[[ ${zoned_devs[*]} == *"$pci"* ]] && continue
if ! block_in_use "${block##*/}" && (($(sec_size_to_bytes "${block##*/}") >= min_disk_size)); then
blocks+=("${block##*/}")