Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: ublk: add user copy test cases

The ublk selftests cover every data copy mode except user copy. Add
tests for user copy based on the existing test suite:
- generic_14 ("basic recover function verification (user copy)") based
on generic_04 and generic_05
- null_03 ("basic IO test with user copy") based on null_01 and null_02
- loop_06 ("write and verify over user copy") based on loop_01 and
loop_03
- loop_07 ("mkfs & mount & umount with user copy") based on loop_02 and
loop_04
- stripe_05 ("write and verify test on user copy") based on stripe_03
- stripe_06 ("mkfs & mount & umount on user copy") based on stripe_02
and stripe_04
- stress_06 ("run IO and remove device (user copy)") based on stress_01
and stress_03
- stress_07 ("run IO and kill ublk server (user copy)") based on
stress_02 and stress_04

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
63276182 b9f0a94c

+243
+8
tools/testing/selftests/ublk/Makefile
··· 21 21 TEST_PROGS += test_generic_11.sh 22 22 TEST_PROGS += test_generic_12.sh 23 23 TEST_PROGS += test_generic_13.sh 24 + TEST_PROGS += test_generic_14.sh 24 25 25 26 TEST_PROGS += test_null_01.sh 26 27 TEST_PROGS += test_null_02.sh 28 + TEST_PROGS += test_null_03.sh 27 29 TEST_PROGS += test_loop_01.sh 28 30 TEST_PROGS += test_loop_02.sh 29 31 TEST_PROGS += test_loop_03.sh 30 32 TEST_PROGS += test_loop_04.sh 31 33 TEST_PROGS += test_loop_05.sh 34 + TEST_PROGS += test_loop_06.sh 35 + TEST_PROGS += test_loop_07.sh 32 36 TEST_PROGS += test_stripe_01.sh 33 37 TEST_PROGS += test_stripe_02.sh 34 38 TEST_PROGS += test_stripe_03.sh 35 39 TEST_PROGS += test_stripe_04.sh 40 + TEST_PROGS += test_stripe_05.sh 41 + TEST_PROGS += test_stripe_06.sh 36 42 37 43 TEST_PROGS += test_stress_01.sh 38 44 TEST_PROGS += test_stress_02.sh 39 45 TEST_PROGS += test_stress_03.sh 40 46 TEST_PROGS += test_stress_04.sh 41 47 TEST_PROGS += test_stress_05.sh 48 + TEST_PROGS += test_stress_06.sh 49 + TEST_PROGS += test_stress_07.sh 42 50 43 51 TEST_GEN_PROGS_EXTENDED = kublk 44 52
+40
tools/testing/selftests/ublk/test_generic_14.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="generic_14" 7 + ERR_CODE=0 8 + 9 + ublk_run_recover_test() 10 + { 11 + run_io_and_recover 256M "kill_daemon" "$@" 12 + ERR_CODE=$? 13 + if [ ${ERR_CODE} -ne 0 ]; then 14 + echo "$TID failure: $*" 15 + _show_result $TID $ERR_CODE 16 + fi 17 + } 18 + 19 + if ! _have_program fio; then 20 + exit "$UBLK_SKIP_CODE" 21 + fi 22 + 23 + _prep_test "recover" "basic recover function verification (user copy)" 24 + 25 + _create_backfile 0 256M 26 + _create_backfile 1 128M 27 + _create_backfile 2 128M 28 + 29 + ublk_run_recover_test -t null -q 2 -r 1 -u & 30 + ublk_run_recover_test -t loop -q 2 -r 1 -u "${UBLK_BACKFILES[0]}" & 31 + ublk_run_recover_test -t stripe -q 2 -r 1 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 32 + wait 33 + 34 + ublk_run_recover_test -t null -q 2 -r 1 -u -i 1 & 35 + ublk_run_recover_test -t loop -q 2 -r 1 -u -i 1 "${UBLK_BACKFILES[0]}" & 36 + ublk_run_recover_test -t stripe -q 2 -r 1 -u -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 37 + wait 38 + 39 + _cleanup_test "recover" 40 + _show_result $TID $ERR_CODE
+25
tools/testing/selftests/ublk/test_loop_06.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="loop_06" 7 + ERR_CODE=0 8 + 9 + if ! _have_program fio; then 10 + exit "$UBLK_SKIP_CODE" 11 + fi 12 + 13 + _prep_test "loop" "write and verify over user copy" 14 + 15 + _create_backfile 0 256M 16 + dev_id=$(_add_ublk_dev -t loop -u "${UBLK_BACKFILES[0]}") 17 + _check_add_dev $TID $? 18 + 19 + # run fio over the ublk disk 20 + _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=256M 21 + ERR_CODE=$? 22 + 23 + _cleanup_test "loop" 24 + 25 + _show_result $TID $ERR_CODE
+21
tools/testing/selftests/ublk/test_loop_07.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="loop_07" 7 + ERR_CODE=0 8 + 9 + _prep_test "loop" "mkfs & mount & umount with user copy" 10 + 11 + _create_backfile 0 256M 12 + 13 + dev_id=$(_add_ublk_dev -t loop -u "${UBLK_BACKFILES[0]}") 14 + _check_add_dev $TID $? 15 + 16 + _mkfs_mount_test /dev/ublkb"${dev_id}" 17 + ERR_CODE=$? 18 + 19 + _cleanup_test "loop" 20 + 21 + _show_result $TID $ERR_CODE
+24
tools/testing/selftests/ublk/test_null_03.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="null_03" 7 + ERR_CODE=0 8 + 9 + if ! _have_program fio; then 10 + exit "$UBLK_SKIP_CODE" 11 + fi 12 + 13 + _prep_test "null" "basic IO test with user copy" 14 + 15 + dev_id=$(_add_ublk_dev -t null -u) 16 + _check_add_dev $TID $? 17 + 18 + # run fio over the two disks 19 + fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio --rw=readwrite --iodepth=32 --size=256M > /dev/null 2>&1 20 + ERR_CODE=$? 21 + 22 + _cleanup_test "null" 23 + 24 + _show_result $TID $ERR_CODE
+39
tools/testing/selftests/ublk/test_stress_06.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + TID="stress_06" 6 + ERR_CODE=0 7 + 8 + ublk_io_and_remove() 9 + { 10 + run_io_and_remove "$@" 11 + ERR_CODE=$? 12 + if [ ${ERR_CODE} -ne 0 ]; then 13 + echo "$TID failure: $*" 14 + _show_result $TID $ERR_CODE 15 + fi 16 + } 17 + 18 + if ! _have_program fio; then 19 + exit "$UBLK_SKIP_CODE" 20 + fi 21 + 22 + _prep_test "stress" "run IO and remove device (user copy)" 23 + 24 + _create_backfile 0 256M 25 + _create_backfile 1 128M 26 + _create_backfile 2 128M 27 + 28 + ublk_io_and_remove 8G -t null -q 4 -u & 29 + ublk_io_and_remove 256M -t loop -q 4 -u "${UBLK_BACKFILES[0]}" & 30 + ublk_io_and_remove 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 31 + wait 32 + 33 + ublk_io_and_remove 8G -t null -q 4 -u --nthreads 8 --per_io_tasks & 34 + ublk_io_and_remove 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" & 35 + ublk_io_and_remove 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 36 + wait 37 + 38 + _cleanup_test "stress" 39 + _show_result $TID $ERR_CODE
+39
tools/testing/selftests/ublk/test_stress_07.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + TID="stress_07" 6 + ERR_CODE=0 7 + 8 + ublk_io_and_kill_daemon() 9 + { 10 + run_io_and_kill_daemon "$@" 11 + ERR_CODE=$? 12 + if [ ${ERR_CODE} -ne 0 ]; then 13 + echo "$TID failure: $*" 14 + _show_result $TID $ERR_CODE 15 + fi 16 + } 17 + 18 + if ! _have_program fio; then 19 + exit "$UBLK_SKIP_CODE" 20 + fi 21 + 22 + _prep_test "stress" "run IO and kill ublk server (user copy)" 23 + 24 + _create_backfile 0 256M 25 + _create_backfile 1 128M 26 + _create_backfile 2 128M 27 + 28 + ublk_io_and_kill_daemon 8G -t null -q 4 -u --no_ublk_fixed_fd & 29 + ublk_io_and_kill_daemon 256M -t loop -q 4 -u --no_ublk_fixed_fd "${UBLK_BACKFILES[0]}" & 30 + ublk_io_and_kill_daemon 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 31 + wait 32 + 33 + ublk_io_and_kill_daemon 8G -t null -q 4 -u --nthreads 8 --per_io_tasks & 34 + ublk_io_and_kill_daemon 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" & 35 + ublk_io_and_kill_daemon 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 36 + wait 37 + 38 + _cleanup_test "stress" 39 + _show_result $TID $ERR_CODE
+26
tools/testing/selftests/ublk/test_stripe_05.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="stripe_05" 7 + ERR_CODE=0 8 + 9 + if ! _have_program fio; then 10 + exit "$UBLK_SKIP_CODE" 11 + fi 12 + 13 + _prep_test "stripe" "write and verify test on user copy" 14 + 15 + _create_backfile 0 256M 16 + _create_backfile 1 256M 17 + 18 + dev_id=$(_add_ublk_dev -t stripe -q 2 -u "${UBLK_BACKFILES[0]}" "${UBLK_BACKFILES[1]}") 19 + _check_add_dev $TID $? 20 + 21 + # run fio over the ublk disk 22 + _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=512M 23 + ERR_CODE=$? 24 + 25 + _cleanup_test "stripe" 26 + _show_result $TID $ERR_CODE
+21
tools/testing/selftests/ublk/test_stripe_06.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="stripe_06" 7 + ERR_CODE=0 8 + 9 + _prep_test "stripe" "mkfs & mount & umount on user copy" 10 + 11 + _create_backfile 0 256M 12 + _create_backfile 1 256M 13 + 14 + dev_id=$(_add_ublk_dev -t stripe -u -q 2 "${UBLK_BACKFILES[0]}" "${UBLK_BACKFILES[1]}") 15 + _check_add_dev $TID $? 16 + 17 + _mkfs_mount_test /dev/ublkb"${dev_id}" 18 + ERR_CODE=$? 19 + 20 + _cleanup_test "stripe" 21 + _show_result $TID $ERR_CODE