File: compare_bfs_result.py

package info (click to toggle)
rust-findutils 0.8.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,252 kB
  • sloc: sh: 129; python: 31; makefile: 9
file content (30 lines) | stat: -rw-r--r-- 846 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
"""
Compare the current results to the last results gathered from the main branch to highlight
if a PR is making the results better/worse
"""

import json
import sys

NEW = json.load(open("bfs-result.json"))
OLD = json.load(open("latest-bfs-result.json"))

# Extract the specific results from the dicts
[last] = OLD.values()
[current] = NEW.values()

pass_d = int(current["pass"]) - int(last["pass"])
skip_d = int(current["skip"]) - int(last.get("skip", 0))
fail_d = int(current["fail"]) - int(last["fail"])

# Get an annotation to highlight changes
print(f"::warning ::Changes from main: PASS {pass_d:+d} / SKIP {skip_d:+d} / FAIL {fail_d:+d}")

# Check if there are no changes.
if pass_d == 0:
    print("::warning ::BFS tests No changes")

# If results are worse fail the job to draw attention
if pass_d < 0:
    sys.exit(1)