From fb253b221687439c92a0ee147427d70a4e36e28f Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Thu, 8 May 2025 14:58:19 -0400 Subject: [PATCH] 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 --- t/verify.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/t/verify.py b/t/verify.py index 99ed61dc..58bf327d 100755 --- a/t/verify.py +++ b/t/verify.py @@ -209,6 +209,41 @@ class VerifyCSUMTest(FioJobCmdTest): logging.debug("stderr: %s", contents) +# +# These tests exercise fio's verify_pattern_interval option. +# +TEST_LIST_VPI = [ + { + # Basic test verify=pattern + "test_id": 3000, + "fio_opts": { + "ioengine": "psync", + "rw": "write", + "verify": "pattern", + "filesize": "1M", + "bs": 4096, + "output-format": "json", + }, + "test_class": VerifyTest, + "success": SUCCESS_DEFAULT, + }, + { + # Basic test verify=pattern_hdr + "test_id": 3001, + "fio_opts": { + "ioengine": "psync", + "rw": "write", + "verify": "pattern_hdr", + "filesize": "1M", + "bs": 4096, + "output-format": "json", + }, + "test_class": VerifyTest, + "success": SUCCESS_DEFAULT, + }, +] + + # # These tests exercise fio's decisions about verifying the sequence number and # random seed in the verify header. @@ -625,6 +660,25 @@ def verify_test_csum(test_env, args, mbs, csum): return run_fio_tests(TEST_LIST_CSUM, test_env, args) +def verify_test_vpi(test_env, args, pattern, vpi, vi): + """ + Adjust test arguments based on values of ddir and csum. Then run + the tests. + """ + for test in TEST_LIST_VPI: + test['force_skip'] = False + + test['fio_opts']['verify_pattern'] = pattern + test['fio_opts']['verify_interval'] = vi + test['fio_opts']['verify_pattern_interval'] = vpi + + for key in ['verify_interval', 'verify_pattern_interval']: + if not test['fio_opts'][key]: + test['fio_opts'].pop(key, None) + + return run_fio_tests(TEST_LIST_VPI, test_env, args) + + def verify_test(test_env, args, ddir, csum): """ Adjust test arguments based on values of ddir and csum. Then run @@ -769,6 +823,11 @@ def main(): test['fio_opts']['ioengine'] = aio if 'sync' in test['fio_opts']['ioengine']: test['fio_opts']['ioengine'] = sync + for test in TEST_LIST_VPI: + if 'aio' in test['fio_opts']['ioengine']: + test['fio_opts']['ioengine'] = aio + if 'sync' in test['fio_opts']['ioengine']: + test['fio_opts']['ioengine'] = sync total = { 'passed': 0, 'failed': 0, 'skipped': 0 } @@ -830,6 +889,23 @@ def main(): total['failed'] += failed total['skipped'] += skipped + # The loop below is for verify_pattern_interval tests + pattern_list = ['%o', '"abcde"', '1%o',] + vpi_list = [10, 129, 512, 4089, None] + verify_interval_list = [512, 1024, 2222, 3791, None] + for pattern, vpi, vi in itertools.product(pattern_list, vpi_list, verify_interval_list): + print(f"\npattern: {pattern}, verify_pattern_interval: {vpi}, verify_interval: {vi}") + + test_env['artifact_root'] = os.path.join(artifact_root, + f"pattern_{pattern}_vpi_{vpi}_vi_{vi}").replace('"', '').replace("%", 'pct') + os.mkdir(test_env['artifact_root']) + + passed, failed, skipped = verify_test_vpi(test_env, args, pattern, vpi, vi) + + total['passed'] += passed + total['failed'] += failed + total['skipped'] += skipped + except KeyboardInterrupt: pass -- 2.25.1