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