Commit a3835a44 authored by Uday Shankar's avatar Uday Shankar Committed by Jens Axboe
Browse files

selftests: ublk: fix behavior when fio is not installed



Some ublk selftests have strange behavior when fio is not installed.
While most tests behave correctly (run if they don't need fio, or skip
if they need fio), the following tests have different behavior:

- test_null_01, test_null_02, test_generic_01, test_generic_02, and
  test_generic_12 try to run fio without checking if it exists first,
  and fail on any failure of the fio command (including "fio command
  not found"). So these tests fail when they should skip.
- test_stress_05 runs fio without checking if it exists first, but
  doesn't fail on fio command failure. This test passes, but that pass
  is misleading as the test doesn't do anything useful without fio
  installed. So this test passes when it should skip.

Fix these issues by adding _have_program fio checks to the top of all of
these tests.

Signed-off-by: default avatarUday Shankar <ushankar@purestorage.com>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 755a1846
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then
	exit "$UBLK_SKIP_CODE"
fi

if ! _have_program fio; then
	exit "$UBLK_SKIP_CODE"
fi

_prep_test "null" "sequential io order"

dev_id=$(_add_ublk_dev -t null)
+4 −0
Original line number Diff line number Diff line
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then
	exit "$UBLK_SKIP_CODE"
fi

if ! _have_program fio; then
	exit "$UBLK_SKIP_CODE"
fi

_prep_test "null" "sequential io order for MQ"

dev_id=$(_add_ublk_dev -t null -q 2)
+4 −0
Original line number Diff line number Diff line
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then
	exit "$UBLK_SKIP_CODE"
fi

if ! _have_program fio; then
	exit "$UBLK_SKIP_CODE"
fi

_prep_test "null" "do imbalanced load, it should be balanced over I/O threads"

NTHREADS=6
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@
TID="null_01"
ERR_CODE=0

if ! _have_program fio; then
	exit "$UBLK_SKIP_CODE"
fi

_prep_test "null" "basic IO test"

dev_id=$(_add_ublk_dev -t null)
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@
TID="null_02"
ERR_CODE=0

if ! _have_program fio; then
	exit "$UBLK_SKIP_CODE"
fi

_prep_test "null" "basic IO test with zero copy"

dev_id=$(_add_ublk_dev -t null -z)
Loading