From a2947c330d299e67bb532d622e2eccdcf27afc46 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Thu, 25 Aug 2022 12:08:33 -0700 Subject: [PATCH] test: add basic test for io_uring ioengine We should have a quick smoke test for the io_uring ioengine to automatically detect breakage. Signed-off-by: Vincent Fu --- t/jobs/t0018.fio | 9 +++++++++ t/run-fio-tests.py | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 t/jobs/t0018.fio diff --git a/t/jobs/t0018.fio b/t/jobs/t0018.fio new file mode 100644 index 00000000..e2298b1f --- /dev/null +++ b/t/jobs/t0018.fio @@ -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 diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py index 504b7cdb..1e5e9f24 100755 --- a/t/run-fio-tests.py +++ b/t/run-fio-tests.py @@ -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, -- 2.25.1