The libblkio-based io_uring block driver currently has no test coverage.
Running existing qemu-iotests with io_uring is possible with just a few
tweaks.

Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
---
 tests/qemu-iotests/033       |  1 +
 tests/qemu-iotests/check     |  2 +-
 tests/qemu-iotests/common.rc | 12 +++++++++++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index da9133c44b..a32af9942f 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt generic
 _supported_proto generic
+_unsupported_proto io_uring # libblkio 1.3.0 does not support write_zeroes 
with FUA
 _unsupported_imgopts "subformat=streamOptimized"
 
 
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index f2e9d27dcf..7a3368b768 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -94,7 +94,7 @@ def make_argparser() -> argparse.ArgumentParser:
         mg.add_argument('-' + fmt, dest='imgfmt', action='store_const',
                         const=fmt, help=f'test {fmt}')
 
-    protocol_list = ['file', 'rbd', 'nbd', 'ssh', 'nfs', 'fuse']
+    protocol_list = ['file', 'rbd', 'nbd', 'ssh', 'nfs', 'fuse', 'io_uring']
     g_prt = p.add_argument_group(
         '  image protocol options',
         'The following options set the IMGPROTO environment variable. '
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index d145f08201..da4b972ebd 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -290,6 +290,9 @@ if [ "$IMGOPTSSYNTAX" = "true" ]; then
     elif [ "$IMGPROTO" = "fuse" ]; then
         TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
         TEST_IMG="$DRIVER,file.filename=$SOCK_DIR/fuse-t.$IMGFMT"
+    elif [ "$IMGPROTO" = "io_uring" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        
TEST_IMG="$DRIVER,file.driver=$IMGPROTO,file.filename=$TEST_DIR/t.$IMGFMT"
     elif [ "$IMGPROTO" = "ssh" ]; then
         TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
         
TEST_IMG="$DRIVER,file.driver=ssh,file.host=127.0.0.1,file.path=$TEST_IMG_FILE"
@@ -309,6 +312,9 @@ else
     elif [ "$IMGPROTO" = "fuse" ]; then
         TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
         TEST_IMG="$SOCK_DIR/fuse-t.$IMGFMT"
+    elif [ "$IMGPROTO" = "io_uring" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        TEST_IMG=io_uring:$TEST_DIR/t.$IMGFMT
     elif [ "$IMGPROTO" = "ssh" ]; then
         TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
         
REMOTE_TEST_DIR="ssh://\\($USER@\\)\\?127.0.0.1\\(:[0-9]\\+\\)\\?$TEST_DIR"
@@ -400,6 +406,10 @@ _test_img_to_test_img_file()
             echo "$1" | sed -e "s#$SOCK_DIR/fuse-#$TEST_DIR/#"
             ;;
 
+        io_uring)
+            echo "$1" | sed -e "s#io_uring:##"
+            ;;
+
         nfs)
             echo "$1" | sed -e "s#nfs://127.0.0.1##"
             ;;
@@ -653,7 +663,7 @@ _cleanup_test_img()
             FUSE_EXPORTS=()
             ;;
 
-        file)
+        file|io_uring)
             _rm_test_img "$TEST_DIR/t.$IMGFMT"
             _rm_test_img "$TEST_DIR/t.$IMGFMT.orig"
             _rm_test_img "$TEST_DIR/t.$IMGFMT.base"
-- 
2.41.0


Reply via email to