Skip to content

Commit a3835a4

Browse files
ps-ushankaraxboe
authored andcommitted
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: Uday Shankar <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 755a184 commit a3835a4

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

tools/testing/selftests/ublk/test_generic_01.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then
1010
exit "$UBLK_SKIP_CODE"
1111
fi
1212

13+
if ! _have_program fio; then
14+
exit "$UBLK_SKIP_CODE"
15+
fi
16+
1317
_prep_test "null" "sequential io order"
1418

1519
dev_id=$(_add_ublk_dev -t null)

tools/testing/selftests/ublk/test_generic_02.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then
1010
exit "$UBLK_SKIP_CODE"
1111
fi
1212

13+
if ! _have_program fio; then
14+
exit "$UBLK_SKIP_CODE"
15+
fi
16+
1317
_prep_test "null" "sequential io order for MQ"
1418

1519
dev_id=$(_add_ublk_dev -t null -q 2)

tools/testing/selftests/ublk/test_generic_12.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then
1010
exit "$UBLK_SKIP_CODE"
1111
fi
1212

13+
if ! _have_program fio; then
14+
exit "$UBLK_SKIP_CODE"
15+
fi
16+
1317
_prep_test "null" "do imbalanced load, it should be balanced over I/O threads"
1418

1519
NTHREADS=6

tools/testing/selftests/ublk/test_null_01.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
TID="null_01"
77
ERR_CODE=0
88

9+
if ! _have_program fio; then
10+
exit "$UBLK_SKIP_CODE"
11+
fi
12+
913
_prep_test "null" "basic IO test"
1014

1115
dev_id=$(_add_ublk_dev -t null)

tools/testing/selftests/ublk/test_null_02.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
TID="null_02"
77
ERR_CODE=0
88

9+
if ! _have_program fio; then
10+
exit "$UBLK_SKIP_CODE"
11+
fi
12+
913
_prep_test "null" "basic IO test with zero copy"
1014

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

tools/testing/selftests/ublk/test_stress_05.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
TID="stress_05"
66
ERR_CODE=0
77

8+
if ! _have_program fio; then
9+
exit "$UBLK_SKIP_CODE"
10+
fi
11+
812
run_io_and_remove()
913
{
1014
local size=$1

0 commit comments

Comments
 (0)