| 231 | |
| 232 | |
| 233 | def cmd_ratchet(args) -> int: |
| 234 | current_path = os.path.join(os.path.abspath(args.out), "never-executed.txt") |
| 235 | current = set(open(current_path).read().splitlines()) |
| 236 | if not os.path.exists(BASELINE): |
| 237 | print(f"no baseline yet: copy {current_path} to {BASELINE} to arm the ratchet") |
| 238 | return 0 |
| 239 | base = set(l for l in open(BASELINE).read().splitlines() if l and not l.startswith("#")) |
| 240 | new = sorted(current - base) |
| 241 | gone = sorted(base - current) |
| 242 | for line in new: |
| 243 | print(f"NEW never-executed: {line}") |
| 244 | if gone: |
| 245 | print(f"{len(gone)} function(s) now executed: lower the baseline (remove them from {BASELINE})") |
| 246 | return 1 if new else 0 |
| 247 | |
| 248 | |
| 249 | def cmd_map(args) -> int: |