Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame^] | 1 | #! /usr/bin/env python3 |
| 2 | |
| 3 | from pathlib import Path |
| 4 | import sys |
| 5 | from listmachines import list_machines |
| 6 | |
| 7 | metaarm = Path.cwd() |
| 8 | |
| 9 | if metaarm.name != "meta-arm": |
| 10 | print("Not running inside meta-arm") |
| 11 | sys.exit(1) |
| 12 | |
| 13 | # Find all layers |
| 14 | layers = (p.name for p in metaarm.glob("meta-*") if p.is_dir()) |
| 15 | # All machine configurations |
| 16 | machines = list_machines(layers) |
| 17 | |
| 18 | # All kas files |
| 19 | kas = metaarm.glob("ci/*.yml") |
| 20 | kas = set(p.stem for p in kas) |
| 21 | |
| 22 | missing = machines - kas |
| 23 | print(f"The following machines are missing: {', '.join(sorted(missing))}.") |
| 24 | |
| 25 | covered = len(machines) - len(missing) |
| 26 | total = len(machines) |
| 27 | percent = int(covered / total * 100) |
| 28 | print(f"Coverage: {percent}%") |