diff options
author | 2025-03-03 20:43:18 +0800 | |
---|---|---|
committer | 2025-03-10 16:24:42 -0600 | |
commit | 87a9265213c390d9d6fa02f0a1ee0110c2bba866 (patch) | |
tree | 2c6b5dba664aeee01296df11037c4ca206255e6e | |
parent | selftests: ublk: move zero copy feature check into _add_ublk_dev() (diff) | |
download | wireguard-linux-87a9265213c390d9d6fa02f0a1ee0110c2bba866.tar.xz wireguard-linux-87a9265213c390d9d6fa02f0a1ee0110c2bba866.zip |
selftests: ublk: load/unload ublk_drv when preparing & cleaning up tests
Load ublk_drv module in _prep_test(), and unload it in _cleanup_test(),
so that test can always be done in consistent state.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250303124324.3563605-9-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rwxr-xr-x | tools/testing/selftests/ublk/test_common.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh index 40bf42f1bed2..bcb0c7aa3956 100755 --- a/tools/testing/selftests/ublk/test_common.sh +++ b/tools/testing/selftests/ublk/test_common.sh @@ -64,6 +64,7 @@ _check_root() { _remove_ublk_devices() { ${UBLK_PROG} del -a + modprobe -r ublk_drv } _get_ublk_dev_state() { @@ -78,6 +79,7 @@ _prep_test() { _check_root local type=$1 shift 1 + modprobe ublk_drv echo "ublk $type: $*" } @@ -131,6 +133,9 @@ _add_ublk_dev() { local kublk_temp; local dev_id; + if [ ! -c /dev/ublk-control ]; then + return ${UBLK_SKIP_CODE} + fi if echo "$@" | grep -q "\-z"; then if ! _have_feature "ZERO_COPY"; then return ${UBLK_SKIP_CODE} |