-
Notifications
You must be signed in to change notification settings - Fork 8
/
manifest_tests
executable file
·41 lines (33 loc) · 1.17 KB
/
manifest_tests
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
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python3
"""
Starts the osbuild-image-test executable asking it to filter its tests based on
current machine architecture and distribution.
"""
import subprocess
import configparser
import platform
import sys
from subprocess import CalledProcessError
OS_RELEASE_PATH = "/etc/os-release"
config = configparser.ConfigParser()
with open(OS_RELEASE_PATH, 'r', encoding='utf-8') as f:
config_string = '[DEFAULT]\n' + f.read()
config.read_string(config_string)
distro = f"{config.get('DEFAULT', 'ID')}-{config.get('DEFAULT', 'VERSION_ID')}"
distro = distro.replace('"', '')
print(f"Running the osbuild-image-test executable for arch {platform.machine()} and "
f"distribution {distro}")
command = ["tools/osbuild-image-test",
f"--arch={platform.machine()}",
f"--distro={distro}"]
pa_exec = sys.argv[1] if len(sys.argv) > 1 else None
if pa_exec:
total = int(pa_exec.split("/")[1])
part = int(pa_exec.split("/")[0])
command.append(f"--instance-number={part}")
command.append(f"--total-number-of-instances={total}")
print(" ".join(command), flush=True)
try:
subprocess.run(command, check=True)
except CalledProcessError:
sys.exit(1)