Skip to content

Commit fb253b2

Browse files
committed
t/verify: add tests to exercise verify_pattern_interval
Add some more tests with oddball intervals and patterns to validate the verify_pattern_interval option. Link: https://lore.kernel.org/r/20250508185832.3702-12-vincent.fu@samsung.com Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
1 parent 2c8ba65 commit fb253b2

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

t/verify.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,41 @@ def check_result(self):
209209
logging.debug("stderr: %s", contents)
210210

211211

212+
#
213+
# These tests exercise fio's verify_pattern_interval option.
214+
#
215+
TEST_LIST_VPI = [
216+
{
217+
# Basic test verify=pattern
218+
"test_id": 3000,
219+
"fio_opts": {
220+
"ioengine": "psync",
221+
"rw": "write",
222+
"verify": "pattern",
223+
"filesize": "1M",
224+
"bs": 4096,
225+
"output-format": "json",
226+
},
227+
"test_class": VerifyTest,
228+
"success": SUCCESS_DEFAULT,
229+
},
230+
{
231+
# Basic test verify=pattern_hdr
232+
"test_id": 3001,
233+
"fio_opts": {
234+
"ioengine": "psync",
235+
"rw": "write",
236+
"verify": "pattern_hdr",
237+
"filesize": "1M",
238+
"bs": 4096,
239+
"output-format": "json",
240+
},
241+
"test_class": VerifyTest,
242+
"success": SUCCESS_DEFAULT,
243+
},
244+
]
245+
246+
212247
#
213248
# These tests exercise fio's decisions about verifying the sequence number and
214249
# random seed in the verify header.
@@ -625,6 +660,25 @@ def verify_test_csum(test_env, args, mbs, csum):
625660
return run_fio_tests(TEST_LIST_CSUM, test_env, args)
626661

627662

663+
def verify_test_vpi(test_env, args, pattern, vpi, vi):
664+
"""
665+
Adjust test arguments based on values of ddir and csum. Then run
666+
the tests.
667+
"""
668+
for test in TEST_LIST_VPI:
669+
test['force_skip'] = False
670+
671+
test['fio_opts']['verify_pattern'] = pattern
672+
test['fio_opts']['verify_interval'] = vi
673+
test['fio_opts']['verify_pattern_interval'] = vpi
674+
675+
for key in ['verify_interval', 'verify_pattern_interval']:
676+
if not test['fio_opts'][key]:
677+
test['fio_opts'].pop(key, None)
678+
679+
return run_fio_tests(TEST_LIST_VPI, test_env, args)
680+
681+
628682
def verify_test(test_env, args, ddir, csum):
629683
"""
630684
Adjust test arguments based on values of ddir and csum. Then run
@@ -769,6 +823,11 @@ def main():
769823
test['fio_opts']['ioengine'] = aio
770824
if 'sync' in test['fio_opts']['ioengine']:
771825
test['fio_opts']['ioengine'] = sync
826+
for test in TEST_LIST_VPI:
827+
if 'aio' in test['fio_opts']['ioengine']:
828+
test['fio_opts']['ioengine'] = aio
829+
if 'sync' in test['fio_opts']['ioengine']:
830+
test['fio_opts']['ioengine'] = sync
772831

773832
total = { 'passed': 0, 'failed': 0, 'skipped': 0 }
774833

@@ -830,6 +889,23 @@ def main():
830889
total['failed'] += failed
831890
total['skipped'] += skipped
832891

892+
# The loop below is for verify_pattern_interval tests
893+
pattern_list = ['%o', '"abcde"', '1%o',]
894+
vpi_list = [10, 129, 512, 4089, None]
895+
verify_interval_list = [512, 1024, 2222, 3791, None]
896+
for pattern, vpi, vi in itertools.product(pattern_list, vpi_list, verify_interval_list):
897+
print(f"\npattern: {pattern}, verify_pattern_interval: {vpi}, verify_interval: {vi}")
898+
899+
test_env['artifact_root'] = os.path.join(artifact_root,
900+
f"pattern_{pattern}_vpi_{vpi}_vi_{vi}").replace('"', '').replace("%", 'pct')
901+
os.mkdir(test_env['artifact_root'])
902+
903+
passed, failed, skipped = verify_test_vpi(test_env, args, pattern, vpi, vi)
904+
905+
total['passed'] += passed
906+
total['failed'] += failed
907+
total['skipped'] += skipped
908+
833909
except KeyboardInterrupt:
834910
pass
835911

0 commit comments

Comments
 (0)