Skip to content

Commit

Permalink
Implement YAML anchor/alias for streamlined testlist structure (#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweish authored Apr 28, 2024
1 parent 261e5d3 commit 3919e79
Show file tree
Hide file tree
Showing 2 changed files with 957 additions and 1,098 deletions.
38 changes: 37 additions & 1 deletion verif/sim/cva6.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,42 @@ def check_tools_version():
check_verilator_version()


def openhw_process_regression_list(testlist, test, iterations, matched_list,
riscv_dv_root):
""" Get the matched tests from the regression test list
Args:
testlist : Regression test list
test : Test to run, "all" means all tests in the list
iterations : Number of iterations for each test
riscv_dv_root : Root directory of RISCV-DV
Returns:
matched_list : A list of matched tests
"""
logging.info(
"Processing regression test list : {}, test: {}".format(testlist, test))
yaml_data = read_yaml(testlist)
mult_test = test.split(',')
if 'testlist' in yaml_data and isinstance(yaml_data['testlist'], list):
yaml_testlist = yaml_data['testlist']
else:
yaml_testlist = yaml_data
for entry in yaml_testlist:
if 'import' in entry:
sub_list = re.sub('<riscv_dv_root>', riscv_dv_root, entry['import'])
openhw_process_regression_list(sub_list, test, iterations, matched_list,
riscv_dv_root)
else:
if (entry['test'] in mult_test) or (test == "all"):
if iterations > 0 and entry['iterations'] > 0:
entry['iterations'] = iterations
if entry['iterations'] > 0:
logging.info("Found matched tests: {}, iterations:{}".format(
entry['test'], entry['iterations']))
matched_list.append(entry)


def main():
"""This is the main entry point."""
try:
Expand Down Expand Up @@ -1224,7 +1260,7 @@ def main():

if test_executed ==0:
if not args.co:
process_regression_list(args.testlist, args.test, args.iterations, matched_list, cwd)
openhw_process_regression_list(args.testlist, args.test, args.iterations, matched_list, cwd)
logging.info('CVA6 Configuration is %s'% args.hwconfig_opts)
for entry in list(matched_list):
yaml_needs = entry["needs"] if "needs" in entry else []
Expand Down
Loading

0 comments on commit 3919e79

Please sign in to comment.