diff --git a/common/ublk b/common/ublk index c4d1e340..c065db21 100644 --- a/common/ublk +++ b/common/ublk @@ -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 diff --git a/tests/block/033 b/tests/block/033 index 762f606b..510e1c56 100755 --- a/tests/block/033 +++ b/tests/block/033 @@ -17,7 +17,7 @@ requires() { } test() { - local ublk_prog="src/miniublk" + local UBLK_PROG="src/miniublk" echo "Running ${TEST_NAME}" @@ -25,15 +25,15 @@ test() { 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 diff --git a/tests/ublk/rc b/tests/ublk/rc index 5fbf8613..530b0977 100644 --- a/tests/ublk/rc +++ b/tests/ublk/rc @@ -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