summaryrefslogtreecommitdiff
path: root/meta-arm/ci/check-machine-coverage
blob: f329fcebac9c8bc89576ff5a4c03ea968b6935fb (plain)
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
#! /usr/bin/env python3

from pathlib import Path
import sys
from listmachines import list_machines

metaarm = Path.cwd()

if metaarm.name != "meta-arm":
    print("Not running inside meta-arm")
    sys.exit(1)

# Find all layers
layers = (p.name for p in metaarm.glob("meta-*") if p.is_dir())
# All machine configurations
machines = list_machines(layers)

# All kas files
kas = metaarm.glob("ci/*.yml")
kas = set(p.stem for p in kas)

missing = machines - kas
print(f"The following machines are missing: {', '.join(sorted(missing))}.")

covered = len(machines) - len(missing)
total = len(machines)
percent = int(covered / total * 100)
print(f"Coverage: {percent}%")