Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libkirk/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async def save_file(self, results: List[SuiteResults], path: str) -> None:
"distribution": results[0].distro,
"distribution_version": results[0].distro_ver,
"kernel": results[0].kernel,
"cmdline": results[0].cmdline,
"arch": results[0].arch,
"cpu": results[0].cpu,
"swap": results[0].swap,
Expand Down
1 change: 1 addition & 0 deletions libkirk/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ async def suite_completed(self, results: SuiteResults, exec_time: float) -> None
"broken": results.broken,
"warnings": results.warnings,
"kernel_version": results.kernel,
"cmdline": results.cmdline,
"cpu": results.cpu,
"arch": results.arch,
"ram": results.ram,
Expand Down
13 changes: 13 additions & 0 deletions libkirk/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def __init__(
distro: Optional[str] = None,
distro_ver: Optional[str] = None,
kernel: Optional[str] = None,
cmdline: Optional[str] = None,
arch: Optional[str] = None,
cpu: Optional[str] = None,
swap: Optional[str] = None,
Expand All @@ -258,6 +259,8 @@ def __init__(
:type distro_ver: str
:param kernel: Kernel version.
:type kernel: str
:param cmdline: /proc/cmdline.
:type cmdline: str
:param arch: OS architecture.
:type arch: str
:param cpu: CPU type info.
Expand All @@ -275,6 +278,7 @@ def __init__(
self._distro = distro
self._distro_ver = distro_ver
self._kernel = kernel
self._cmdline = cmdline
self._arch = arch
self._cpu = cpu
self._swap = swap
Expand All @@ -287,6 +291,7 @@ def __repr__(self) -> str:
f"distro: {self._distro}, "
f"distro_ver: {self._distro_ver}, "
f"kernel: {self._kernel}, "
f"cmdline: {self._cmdline}, "
f"arch: {self._arch}, "
f"cpu: {self._cpu}, "
f"swap: {self._swap}, "
Expand Down Expand Up @@ -343,6 +348,14 @@ def kernel(self) -> Optional[str]:
"""
return self._kernel

@property
def cmdline(self) -> Optional[str]:
"""
:return: /proc/cmdline.
:rtype: str | None
"""
return self._cmdline

@property
def arch(self) -> Optional[str]:
"""
Expand Down
1 change: 1 addition & 0 deletions libkirk/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ async def _run_suite(self, suite: Suite) -> None:
distro=info["distro"],
distro_ver=info["distro_ver"],
kernel=info["kernel"],
cmdline=info["cmdline"],
arch=info["arch"],
cpu=info["cpu"],
swap=info["swap"],
Expand Down
13 changes: 12 additions & 1 deletion libkirk/sut.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ async def _get_kernel(self) -> str:
"""
return await self._run_cmd("uname -s -r -v")

async def _get_cmdline(self) -> str:
"""
Return /proc/cmdline content.
"""
return await self._run_cmd("cat /proc/cmdline")

async def _get_arch(self) -> str:
"""
Return the architecture name.
Expand Down Expand Up @@ -185,6 +191,7 @@ async def get_info(self) -> Dict[str, str]:
"distro": str,
"distro_ver": str,
"kernel": str,
"cmdline": str,
"arch": str,
"cpu" : str,
"swap" : str,
Expand All @@ -199,17 +206,19 @@ async def get_info(self) -> Dict[str, str]:
distro = ""
distro_ver = ""
kernel = ""
cmdline = ""
arch = ""
cpu = ""
meminfo = ""

if self.optimize:
# pyrefly: ignore[bad-unpacking]
distro, distro_ver, kernel, arch, cpu, meminfo = await asyncio.gather(
distro, distro_ver, kernel, cmdline, arch, cpu, meminfo = await asyncio.gather(
*[
self._get_distro(),
self._get_distro_ver(),
self._get_kernel(),
self._get_cmdline(),
self._get_arch(),
self._get_cpu(),
self._get_meminfo(),
Expand All @@ -219,6 +228,7 @@ async def get_info(self) -> Dict[str, str]:
distro = await self._get_distro()
distro_ver = await self._get_distro_ver()
kernel = await self._get_kernel()
cmdline = await self._get_cmdline()
arch = await self._get_arch()
cpu = await self._get_cpu()
meminfo = await self._get_meminfo()
Expand All @@ -239,6 +249,7 @@ async def get_info(self) -> Dict[str, str]:
"distro": distro,
"distro_ver": distro_ver,
"kernel": kernel,
"cmdline": cmdline,
"arch": arch,
"cpu": cpu,
"ram": memory,
Expand Down
2 changes: 2 additions & 0 deletions libkirk/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ async def test_save_file(self, tmpdir):
distro="openSUSE-Leap",
distro_ver="15.3",
kernel="5.17",
cmdline="security=selinux selinux=1 enforcing=1 ima_policy=tcb",
arch="x86_64",
cpu="x86_64",
swap="10 kB",
Expand Down Expand Up @@ -171,6 +172,7 @@ async def test_save_file(self, tmpdir):
"distribution_version": "15.3",
"distribution": "openSUSE-Leap",
"kernel": "5.17",
"cmdline": "security=selinux selinux=1 enforcing=1 ima_policy=tcb",
"arch": "x86_64",
"cpu": "x86_64",
"swap": "10 kB",
Expand Down
1 change: 1 addition & 0 deletions libkirk/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async def get_info(self) -> dict:
"distro": "openSUSE",
"distro_ver": "15.3",
"kernel": "5.10",
"cmdline": "ima_policy=tcb",
"arch": "x86_64",
"cpu": "x86_64",
"swap": "0",
Expand Down
1 change: 1 addition & 0 deletions libkirk/tests/test_sut.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async def test_get_info(self, sut):
assert info["distro"]
assert info["distro_ver"]
assert info["kernel"]
assert info["cmdline"]
assert info["arch"]

async def test_get_tainted_info(self, sut):
Expand Down
29 changes: 15 additions & 14 deletions libkirk/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,21 @@ async def suite_completed(self, results: SuiteResults, exec_time: float) -> None
message = (
f"{' ' * 128}\n"
f"Execution time: {exec_time_uf}\n\n"
f"\tSuite: {results.suite.name}\n"
f"\tTotal runs: {len(results.suite.tests)}\n"
f"\tRuntime: {duration}\n"
f"\tPassed: {results.passed}\n"
f"\tFailed: {results.failed}\n"
f"\tSkipped: {results.skipped}\n"
f"\tBroken: {results.broken}\n"
f"\tWarnings: {results.warnings}\n"
f"\tKernel: {results.kernel}\n"
f"\tMachine: {results.cpu}\n"
f"\tArch: {results.arch}\n"
f"\tRAM: {results.ram}\n"
f"\tSwap: {results.swap}\n"
f"\tDistro: {results.distro} {results.distro_ver}"
f"\tSuite: {results.suite.name}\n"
f"\tTotal runs: {len(results.suite.tests)}\n"
f"\tRuntime: {duration}\n"
f"\tPassed: {results.passed}\n"
f"\tFailed: {results.failed}\n"
f"\tSkipped: {results.skipped}\n"
f"\tBroken: {results.broken}\n"
f"\tWarnings: {results.warnings}\n"
f"\tKernel: {results.kernel}\n"
f"\t/proc/cmdline: {results.cmdline}\n"
f"\tMachine: {results.cpu}\n"
f"\tArch: {results.arch}\n"
f"\tRAM: {results.ram}\n"
f"\tSwap: {results.swap}\n"
f"\tDistro: {results.distro} {results.distro_ver}"
)

await self._print(message)
Expand Down