Skip to content

Commit

Permalink
Fix veristat comparison for completely new and removed bpf objects (#241
Browse files Browse the repository at this point in the history
)

Signed-off-by: Nikolay Yurin <[email protected]>
  • Loading branch information
yurinnick authored Oct 19, 2023
1 parent 8ac36b9 commit 31d6168
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/scripts/veristat-compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,15 @@ def get_results_summary(self, markup: bool = False) -> str:


def get_state_diff(value: str) -> float:
if value == 'N/A':
return 0.0

matches = re.match(TOTAL_STATES_DIFF_REGEX, value)
if not matches:
raise ValueError(
f"Failed to parse total states diff field value '{value}'"
)

if percentage_diff := matches.group("percentage_diff"):
return float(percentage_diff)

Expand All @@ -160,6 +168,10 @@ def parse_table(csv_file):
record[VeristatFields.VERDICT_NEW],
)

# Ignore results from completely new and removed programs
if "N/A" in [verdict_new, verdict_old]:
continue

if record[VeristatFields.VERDICT_DIFF] == "MISMATCH":
changes = True
add = True
Expand Down

0 comments on commit 31d6168

Please sign in to comment.