Updated for expected_result reading
from benchexec.model import Run
-
+from benchexec import result
+import json
class P4SetupHandler(object):
def __init__(self, benchmark, test_dict):
@@ -8,9 +9,11 @@ class P4SetupHandler(object):
def update_runsets(self):
for runSet in self.benchmark.run_sets:
- runset_temp = runSet.runs.copy()
- expected_result = runset_temp[0].expected_results
- properties = runset_temp[0].properties
+ #Divide the defined run into multiple run if necessery
+ old_run = runSet.runs[0]
+ expected_result_filename = old_run.identifier
+ expected_dict = self._read_expected_result_json(expected_result_filename)
+ prop = old_run.properties
runSet.runs = []
for module_name in self.test_dict:
for test_name in self.test_dict[module_name]:
@@ -18,8 +21,18 @@ class P4SetupHandler(object):
"Fake",
"",
"",
- runSet,
- expected_results=expected_result)
- run.properties = properties
+ runSet)
+ run.properties = prop
+ if run.identifier in expected_dict:
+ run.expected_results[prop[0].filename] = result.ExpectedResult(
+ expected_dict[run.identifier] == "True" or expected_dict[run.identifier] == "true"
+ , None)
+ else:
+ run.expected_results[prop[0].filename] = result.ExpectedResult(True, None)
runSet.runs.append(run)
+ def _read_expected_result_json(self, json_file_path):
+ with open(json_file_path) as json_file:
+ data = json.load(json_file)
+
+ return data
\ No newline at end of file
