added a function to util to get data model from task
@@ -762,3 +762,21 @@ def check_msr():
if all(os.access("/dev/cpu/{}/msr".format(cpu), os.W_OK) for cpu in cpu_dirs):
res["write"] = True
return res
+
+
+def get_data_model_from_task(task, data_models):
+ # Importing it here, otherwise it will result in cyclic dependency.
+ import benchexec.tools.template
+ if isinstance(task.options, dict) and task.options.get("language") == "C":
+ data_model = task.options.get("data_model")
+ if data_model:
+ data_model_option = data_models.get(data_model)
+ if data_model_option:
+ return data_model_option
+ else:
+ raise benchexec.tools.template.UnsupportedFeatureException(
+ "Unsupported data_model '{}' defined for task '{}'".format(
+ data_model, task
+ )
+ )
+ return None
