@@ -38,28 +38,44 @@ def setUp(self):
3838 self .disk = self .disk .split (' ' )
3939 smm = SoftwareManager ()
4040 dist = distro .detect ()
41+
42+ packages = ['gcc' , 'make' , 'util-linux' , 'fio' ]
4143 if dist .name in ['Ubuntu' , 'debian' ]:
42- packages = ['gcc' , 'make' , 'util-linux' ,
43- 'fio' , 'libdevmapper-dev' , 'g++' ]
44+ packages += ['libdevmapper-dev' , 'g++' ]
45+ elif dist .name in ['rhel' , 'CentOS' , 'fedora' ]:
46+ packages += ['device-mapper' , 'gcc-c++' , 'blktrace' ,
47+ 'ktls-utils' , 'device-mapper-multipath' ]
48+ elif dist .name in ['SuSE' ]:
49+ packages += ['device-mapper' , 'gcc-c++' , 'blktrace' ,
50+ 'ktls-utils' , 'multipath-tools' ]
51+
52+ # Enable io_uring if disabled
53+ knob = "/proc/sys/kernel/io_uring_disabled"
54+ if os .path .exists (knob ):
55+ try :
56+ current = int (process .system_output (f"cat { knob } " ).strip ())
57+ # 0 = enabled, 1/2 = disabled
58+ if current != 0 :
59+ process .run (f"echo 0 > { knob } " , sudo = True , shell = True )
60+ except Exception as ex :
61+ self .log .warn (f"Could not update io_uring_disabled: { ex } " )
4462 else :
45- packages = ['gcc' , 'make' , 'util-linux' ,
46- 'fio' , 'device-mapper' , 'gcc-c++' ]
63+ self .log .info ("io_uring_disabled knob not present older kernel" )
4764
4865 for package in packages :
4966 if not smm .check_installed (package ) and not smm .install (package ):
5067 self .cancel (package + ' is needed for the test to be run' )
5168
69+ # Download/build blktests
5270 locations = ["https://github.com/osandov/blktests/archive/"
5371 "master.zip" ]
5472 tarball = self .fetch_asset ("blktests.zip" , locations = locations ,
5573 expire = '7d' )
5674 archive .extract (tarball , self .workdir )
5775 self .sourcedir = os .path .join (self .workdir , 'blktests-master' )
58-
5976 build .make (self .sourcedir )
6077
6178 def test (self ):
62-
6379 self .clear_dmesg ()
6480 os .chdir (self .sourcedir )
6581
@@ -68,12 +84,23 @@ def test(self):
6884 os .environ ['TEST_DEVS' ] = ' ' .join (self .disk )
6985 cmd = './check %s' % self .dev_type
7086 result = process .run (cmd , ignore_status = True , verbose = True )
71- if result .exit_status != 0 :
72- self .fail ("test failed" )
87+
88+ stdout = result .stdout .decode (errors = "ignore" )
89+ fail_pattern = re .compile (r'^(\S+/\S+).*?\[failed\]' , re .MULTILINE )
90+ failed_tests = [m .group (1 ).strip () for m in fail_pattern .finditer (stdout )]
91+
92+ if result .exit_status != 0 or failed_tests :
93+ if failed_tests :
94+ failed_list = ", " .join (failed_tests )
95+ summary = f"{ len (failed_tests )} test(s) failed: { failed_list } "
96+ else :
97+ summary = f"blktests exited with code { result .exit_status } "
98+ self .fail (summary )
99+
73100 dmesg = process .system_output ('dmesg' )
74101 match = re .search (br'Call Trace:' , dmesg , re .M | re .I )
75102 if match :
76103 self .fail ("some call traces seen please check" )
77104
78105 def clear_dmesg (self ):
79- process .run ("dmesg -c " , sudo = True )
106+ process .run ("dmesg -C " , sudo = True )
0 commit comments