Skip to content

Commit

Permalink
block/033: fix the output when ublk prog not avaiable
Browse files Browse the repository at this point in the history
UBLK_PROG was not defined when calling _have_ublk, move the defination
to common/ublk.
Replace ublk_prog with UBLK_PROG in block/033.
common/fio already included in common/rc, so remove the dup inclusion.

$ ./check block/033
block/033 (add & delete ublk device and test if gendisk is leaked) [not run]
    driver ublk_drv is not available
     is not available

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
  • Loading branch information
yizhanglinux committed Apr 19, 2024
1 parent 89bdb5d commit 3618665
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 6 additions & 0 deletions common/ublk
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ _exit_ublk() {
udevadm settle
modprobe -r -q ublk_drv
}

if which rublk > /dev/null 2>&1; then
export UBLK_PROG="src/rublk_wrapper.sh"
else
export UBLK_PROG="src/miniublk"
fi
8 changes: 4 additions & 4 deletions tests/block/033
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ requires() {
}

test() {
local ublk_prog="src/miniublk"
local UBLK_PROG="src/miniublk"

echo "Running ${TEST_NAME}"

if ! _init_ublk; then
return 1
fi

${ublk_prog} add -t null -n 0 > "$FULL"
${UBLK_PROG} add -t null -n 0 > "$FULL"
udevadm settle
if ! ${ublk_prog} list -n 0 >> "$FULL"; then
if ! ${UBLK_PROG} list -n 0 >> "$FULL"; then
echo "fail to list dev"
fi
if ! dd if=/dev/ublkb0 iflag=direct of=/dev/null bs=1M count=512 >> "$FULL" 2>&1; then
echo "fail io"
fi
${ublk_prog} del -n 0 >> "$FULL"
${UBLK_PROG} del -n 0 >> "$FULL"

_exit_ublk

Expand Down
7 changes: 0 additions & 7 deletions tests/ublk/rc
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@

. common/rc
. common/ublk
. common/fio

group_requires() {
_have_root
_have_ublk
_have_fio
}

if which rublk > /dev/null 2>&1; then
export UBLK_PROG="src/rublk_wrapper.sh"
else
export UBLK_PROG="src/miniublk"
fi

0 comments on commit 3618665

Please sign in to comment.