test: add basic test for io_uring ioengine
authorVincent Fu <vincent.fu@samsung.com>
Thu, 25 Aug 2022 19:08:33 +0000 (12:08 -0700)
committerVincent Fu <vincent.fu@samsung.com>
Fri, 26 Aug 2022 19:14:46 +0000 (15:14 -0400)
We should have a quick smoke test for the io_uring ioengine to
automatically detect breakage.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
t/jobs/t0018.fio [new file with mode: 0644]
t/run-fio-tests.py

diff --git a/t/jobs/t0018.fio b/t/jobs/t0018.fio
new file mode 100644 (file)
index 0000000..e2298b1
--- /dev/null
@@ -0,0 +1,9 @@
+# Expected result: job completes without error
+# Buggy result: job fails
+
+[test]
+ioengine=io_uring
+filesize=256K
+time_based
+runtime=3s
+rw=randrw
index 504b7cdb38cc8e2af8599af194e73326dc58b443..1e5e9f249f10cd0a9a3e5ed1a95bebc020d26862 100755 (executable)
@@ -582,6 +582,7 @@ class Requirements(object):
 
     _linux = False
     _libaio = False
+    _io_uring = False
     _zbd = False
     _root = False
     _zoned_nullb = False
@@ -605,6 +606,12 @@ class Requirements(object):
                 Requirements._zbd = "CONFIG_HAS_BLKZONED" in contents
                 Requirements._libaio = "CONFIG_LIBAIO" in contents
 
+            contents, success = FioJobTest.get_file("/proc/kallsyms")
+            if not success:
+                print("Unable to open '/proc/kallsyms' to probe for io_uring support")
+            else:
+                Requirements._io_uring = "io_uring_setup" in contents
+
             Requirements._root = (os.geteuid() == 0)
             if Requirements._zbd and Requirements._root:
                 try:
@@ -627,6 +634,7 @@ class Requirements(object):
 
         req_list = [Requirements.linux,
                     Requirements.libaio,
+                    Requirements.io_uring,
                     Requirements.zbd,
                     Requirements.root,
                     Requirements.zoned_nullb,
@@ -648,6 +656,11 @@ class Requirements(object):
         """Is libaio available?"""
         return Requirements._libaio, "libaio required"
 
+    @classmethod
+    def io_uring(cls):
+        """Is io_uring available?"""
+        return Requirements._io_uring, "io_uring required"
+
     @classmethod
     def zbd(cls):
         """Is ZBD support available?"""
@@ -867,6 +880,15 @@ TEST_LIST = [
         'output_format':    'json',
         'requirements':     [Requirements.not_windows],
     },
+    {
+        'test_id':          18,
+        'test_class':       FioJobTest,
+        'job':              't0018.fio',
+        'success':          SUCCESS_DEFAULT,
+        'pre_job':          None,
+        'pre_success':      None,
+        'requirements':     [Requirements.linux, Requirements.io_uring],
+    },
     {
         'test_id':          1000,
         'test_class':       FioExeTest,