Skip to content
Snippets Groups Projects
Commit 17b38e7e authored by Andre Gunther's avatar Andre Gunther :island:
Browse files

add testbench arg for writing encoding keys

parent 1bcb76e5
No related branches found
No related tags found
1 merge request!429Testbench throughput and profiling updates
......@@ -12,6 +12,7 @@ import os
import platform
import xml.etree.ElementTree as ET
from string import Template
from typing import Any
def node_name():
......@@ -92,3 +93,27 @@ def instance_args(tasks, replacements):
"INSTANCE": instance,
}))
return result
def overwrite_dict_value(data: Any, mapping: dict) -> Any:
"""Recursively loop through data and overwrite item's value with corresponding mapping's value.
Args:
data (Any): Iterable input datra
mapping (dict): Key value pairs to overwrite.
Returns:
Any: Overwritten data.
"""
if isinstance(data, dict):
return {
k: mapping[k] if k in mapping.keys() else overwrite_dict_value(
v, mapping)
for k, v in data.items()
}
elif isinstance(data, list):
return [overwrite_dict_value(item, mapping) for item in data]
elif isinstance(data, tuple):
return (overwrite_dict_value(item, mapping) for item in data)
else:
return data
......@@ -117,6 +117,12 @@ parser.add_argument(
type=int,
help="Number of files to download from the TestFileDB entry",
)
parser.add_argument(
"--write-encoding-keys",
action="store_true",
help=
"Enables writing of the encoding keys by setting env WRITE_ENCODING_KEYS=1.",
)
args, unknown_argv = parser.parse_known_args()
args.data_dir = args.working_dir / args.data_dir
......@@ -151,6 +157,9 @@ replacements = {
}
arch = architecture.read_xml(args.architecture)
if args.write_encoding_keys:
arch = architecture.overwrite_dict_value(arch,
{"WRITE_ENCODING_KEYS": "1"})
task_instance_args = architecture.instance_args(arch, replacements)
emulator.check_for_orphans([a["args"][0] for a in task_instance_args])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment