Skip to content

Commit

Permalink
t/nvmept_fdp: add tests(302,303,400,401) for fdp scheme
Browse files Browse the repository at this point in the history
- 302/303: invalid options tests
- 400/401: check whether fdp scheme works properly

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
  • Loading branch information
parkvibes committed May 9, 2024
1 parent 8954ad2 commit d70c81c
Showing 1 changed file with 120 additions and 3 deletions.
123 changes: 120 additions & 3 deletions t/nvmept_fdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ def setup(self, parameters):
f"--output={self.filenames['output']}",
f"--output-format={self.fio_opts['output-format']}",
]

for opt in ['fixedbufs', 'nonvectored', 'force_async', 'registerfiles',
'sqthread_poll', 'sqthread_poll_cpu', 'hipri', 'nowait',
'time_based', 'runtime', 'verify', 'io_size', 'num_range',
'iodepth', 'iodepth_batch', 'iodepth_batch_complete',
'size', 'rate', 'bs', 'bssplit', 'bsrange', 'randrepeat',
'buffer_pattern', 'verify_pattern', 'offset', 'fdp',
'fdp_pli', 'fdp_pli_select', 'dataplacement', 'plid_select',
'plids', 'number_ios']:
'plids', 'dp_scheme', 'number_ios']:
if opt in self.fio_opts:
option = f"--{opt}={self.fio_opts[opt]}"
fio_args.append(option)
Expand Down Expand Up @@ -133,7 +134,14 @@ def setup(self, parameters):
self.fio_opts['number_ios'] = eval(self.fio_opts['number_ios'].format(**mapping))

super().setup(parameters)


if 'dp_scheme' in self.fio_opts:
scheme_path = os.path.join(self.paths['test_dir'], self.fio_opts['dp_scheme'])
with open(scheme_path, mode='w') as f:
f.write('0, 131072, 0\n')
f.write('131072, 524288, 2\n')
f.write('524288, 1048576, 1\n')

def _check_result(self):
if 'fdp_pli' in self.fio_opts:
plid_list = self.fio_opts['fdp_pli'].split(',')
Expand All @@ -157,10 +165,12 @@ def _check_result(self):
self._check_robin(plid_list, fdp_status)
elif select == "random":
self._check_random(plid_list, fdp_status)
elif select == "scheme":
self._check_scheme(plid_list, fdp_status)
else:
logging.error("Unknown plid selection strategy %s", select)
self.passed = False

super()._check_result()

def _check_robin(self, plid_list, fdp_status):
Expand Down Expand Up @@ -220,6 +230,47 @@ def _check_random(self, plid_list, fdp_status):
logging.debug("Observed expected ruamw %d for idx %d, pid %d", ruhs['ruamw'], idx,
ruhs['pid'])

def _check_scheme(self, plid_list, fdp_status):
"""
With scheme selection, a set of PLIDs touched by the scheme
random
"""

PLID_IDX_POS = 2
plid_index_set_in_scheme = set()
plid_list_referenced_by_scheme = []

scheme_path = os.path.join(self.paths['test_dir'], self.fio_opts['dp_scheme'])

with open(scheme_path) as f:
lines = f.readlines()
for line in lines:
line_elem = line.strip().replace(' ', '').split(',')
plid_index_set_in_scheme.add(int(line_elem[PLID_IDX_POS]))

plid_list_referenced_by_scheme = [plid_list[index_elem] for index_elem in plid_index_set_in_scheme]

logging.debug(f'plid_index_set_in_scheme: {plid_index_set_in_scheme}')
logging.debug(f'plid_list_referenced_by_scheme: {plid_list_referenced_by_scheme}')

for idx, ruhs in enumerate(fdp_status['ruhss']):
if ruhs['pid'] in plid_list_referenced_by_scheme:
if ruhs['ruamw'] == FIO_FDP_MAX_RUAMW:
logging.error("pid %d should not be touched by the scheme. ruamw of it(%d) should equals to %d",
ruhs['pid'], ruhs['ruamw'], FIO_FDP_MAX_RUAMW)
self.passed = False
else:
logging.debug("pid %d should be touched by the scheme. ruamw of it(%d) is under %d",
ruhs['pid'], ruhs['ruamw'], FIO_FDP_MAX_RUAMW)
else:
if ruhs['ruamw'] != FIO_FDP_MAX_RUAMW:
logging.error("pid %d should be touched by the scheme. ruamw of it(%d) should equals to %d",
ruhs['pid'], ruhs['ruamw'], FIO_FDP_MAX_RUAMW)
self.passed = False
else:
logging.debug("pid %d should not be touched by the scheme. ruamw of it %d equals to %d",
ruhs['pid'], ruhs['ruamw'], FIO_FDP_MAX_RUAMW)


class FDPSinglePLIDTest(FDPTest):
"""
Expand Down Expand Up @@ -674,6 +725,72 @@ def check_all_ruhs(dut):
"test_class": FDPTest,
"success": SUCCESS_NONZERO,
},
# Specify invalid options related to dataplacement scheme
## using old and new sets of options
{
"test_id": 302,
"fio_opts": {
"rw": 'write',
"bs": 4096,
"io_size": 4096,
"verify": "crc32c",
"fdp": 1,
"fdp_pli": 3,
"fdp_pli_select": "scheme",
"output-format": "normal",
},
"test_class": FDPTest,
"success": SUCCESS_NONZERO,
},
{
"test_id": 303,
"fio_opts": {
"rw": 'write',
"bs": 4096,
"io_size": 4096,
"verify": "crc32c",
"fdp": 1,
"fdp_pli": 3,
"plid_select": "scheme",
"output-format": "normal",
},
"test_class": FDPTest,
"success": SUCCESS_NONZERO,
},
# write to multiple PLIDs using scheme selection of PLIDs
## using old and new sets of options
{
"test_id": 400,
"fio_opts": {
"rw": 'randwrite',
"bs": 4096,
"size": 1048576,
"io_size": 1073741824,
"verify": "crc32c",
"fdp": 1,
"fdp_pli": "1,2,3",
"fdp_pli_select": "scheme",
"dp_scheme": "lba.scheme",
"output-format": "json",
},
"test_class": FDPMultiplePLIDTest,
},
{
"test_id": 401,
"fio_opts": {
"rw": 'randwrite',
"bs": 4096,
"size": 1048576,
"io_size": 1073741824,
"verify": "crc32c",
"dataplacement": "fdp",
"plids": "1,2,3",
"plid_select": "scheme",
"dp_scheme": "lba.scheme",
"output-format": "json",
},
"test_class": FDPMultiplePLIDTest,
},
]

def parse_args():
Expand Down

0 comments on commit d70c81c

Please sign in to comment.