Revert branch identification for now

This commit is contained in:
Erki 2021-03-11 00:52:04 +02:00
parent 1c3107e8cc
commit 91fbb3bbbd
2 changed files with 15 additions and 10 deletions

View File

@ -27,13 +27,16 @@ class GCovFile:
lines: List[GCovLine] = [] lines: List[GCovLine] = []
for line in file["lines"]: for line in file["lines"]:
if len(line["branches"]): lines.append(GCovLine(line["line_number"], line["count"]))
# GCov reports branches in reverse order to our parser.
branch_number = len(line["branches"]) # Branch specific identification. TODO! later.
for branch in line["branches"]: #if len(line["branches"]):
lines.append(GCovLine(line["line_number"], branch["count"], branch_number)) # # GCov reports branches in reverse order to our parser.
branch_number -= 1 # branch_number = len(line["branches"])
else: # for branch in line["branches"]:
lines.append(GCovLine(line["line_number"], line["count"])) # lines.append(GCovLine(line["line_number"], branch["count"], branch_number))
# branch_number -= 1
#else:
# lines.append(GCovLine(line["line_number"], line["count"])))
self.files[name] = lines self.files[name] = lines

View File

@ -17,6 +17,8 @@ class OpSummarizer:
def count_operations(self, file: str) -> Dict[UniqueOperation, int]: def count_operations(self, file: str) -> Dict[UniqueOperation, int]:
if file not in self.gcov.files or file not in self.ops.files: if file not in self.gcov.files or file not in self.ops.files:
print(f"Gcov files: {self.gcov.files.keys()}")
print(f"Opfinder files: {self.ops.files.keys()}")
raise RuntimeError(f"File {file} not in both parsers.") raise RuntimeError(f"File {file} not in both parsers.")
op_counter: Dict[UniqueOperation, int] = {} op_counter: Dict[UniqueOperation, int] = {}
@ -26,8 +28,8 @@ class OpSummarizer:
for op_log in op_lines: for op_log in op_lines:
# TODO: revise this. Need a special case for for-loop clauses # TODO: revise this. Need a special case for for-loop clauses
# or branching in general. # or branching in general.
if op_log.branch_number != gcov_line.branch_number: #if op_log.branch_number != gcov_line.branch_number:
continue # continue
unique_op = op_log.entry unique_op = op_log.entry