amd-debug-tools 0.2.16__tar.gz → 0.2.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {amd_debug_tools-0.2.16/src/amd_debug_tools.egg-info → amd_debug_tools-0.2.18}/PKG-INFO +1 -1
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/common.py +21 -7
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/failures.py +13 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/prerequisites.py +16 -3
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/s2idle.py +1 -1
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/ttm.py +93 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/validator.py +4 -1
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18/src/amd_debug_tools.egg-info}/PKG-INFO +1 -1
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_common.py +62 -49
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/.github/workflows/ci.yml +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/.github/workflows/mirror.yml +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/.gitignore +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/.pre-commit-config.yaml +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/.vscode/settings.json +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/LICENSE +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/Makefile +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/README.md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/amd_bios.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/amd_pstate.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/amd_s2idle.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/amd_ttm.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/docs/amd-bios.md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/docs/amd-pstate.md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/docs/amd-s2idle.md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/docs/amd-ttm.md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/docs/in-tree.md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/install_deps.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/psr.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/pyproject.toml +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/setup.cfg +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/__init__.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/acpi.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/bash/amd-s2idle +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/battery.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/bios.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/database.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/display.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/installer.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/kernel.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/pstate.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/s2idle-hook +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/sleep_report.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/templates/html +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/templates/md +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/templates/stdout +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/templates/txt +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug/wake.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/SOURCES.txt +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/dependency_links.txt +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/entry_points.txt +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/requires.txt +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/top_level.txt +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/launcher.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_acpi.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_batteries.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_bios.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_database.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_display.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_failures.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_installer.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_kernel.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_launcher.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_prerequisites.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_pstate.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_s2idle.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_sleep_report.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_ttm.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_validator.py +0 -0
- {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/test_wake.py +0 -0
|
@@ -273,8 +273,7 @@ def reboot():
|
|
|
273
273
|
return False
|
|
274
274
|
return True
|
|
275
275
|
|
|
276
|
-
|
|
277
|
-
result = loop.run_until_complete(reboot_dbus_fast())
|
|
276
|
+
result = asyncio.run(reboot_dbus_fast())
|
|
278
277
|
if not result:
|
|
279
278
|
return reboot_dbus()
|
|
280
279
|
|
|
@@ -321,9 +320,11 @@ def get_log_priority(num):
|
|
|
321
320
|
|
|
322
321
|
def minimum_kernel(major, minor) -> bool:
|
|
323
322
|
"""Checks if the kernel version is at least major.minor"""
|
|
323
|
+
import re
|
|
324
|
+
|
|
324
325
|
ver = platform.uname().release.split(".")
|
|
325
|
-
kmajor = int(ver[0])
|
|
326
|
-
kminor = int(ver[1])
|
|
326
|
+
kmajor = int(re.match(r"\d+", ver[0]).group())
|
|
327
|
+
kminor = int(re.match(r"\d+", ver[1]).group())
|
|
327
328
|
if kmajor > int(major):
|
|
328
329
|
return True
|
|
329
330
|
if kmajor < int(major):
|
|
@@ -383,14 +384,27 @@ def relaunch_sudo() -> None:
|
|
|
383
384
|
if not is_root():
|
|
384
385
|
logging.debug("Relaunching with sudo")
|
|
385
386
|
env_vars = []
|
|
386
|
-
for var in [
|
|
387
|
-
|
|
387
|
+
for var in [
|
|
388
|
+
"DISPLAY",
|
|
389
|
+
"WAYLAND_DISPLAY",
|
|
390
|
+
"XAUTHORITY",
|
|
391
|
+
"XDG_RUNTIME_DIR",
|
|
392
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
393
|
+
"XDG_SESSION_TYPE",
|
|
394
|
+
"XDG_DATA_DIRS",
|
|
395
|
+
"SSH_CLIENT",
|
|
396
|
+
"SSH_TTY"
|
|
397
|
+
]:
|
|
388
398
|
value = os.environ.get(var)
|
|
389
399
|
if value:
|
|
390
400
|
env_vars.append(f"{var}={value}")
|
|
391
401
|
|
|
392
402
|
if env_vars:
|
|
393
|
-
sudo_cmd =
|
|
403
|
+
sudo_cmd = (
|
|
404
|
+
["sudo"]
|
|
405
|
+
+ [f"--preserve-env={var.split('=')[0]}" for var in env_vars]
|
|
406
|
+
+ sys.argv
|
|
407
|
+
)
|
|
394
408
|
else:
|
|
395
409
|
sudo_cmd = ["sudo"] + sys.argv
|
|
396
410
|
|
|
@@ -146,6 +146,19 @@ class MissingXhciHcd(S0i3Failure):
|
|
|
146
146
|
)
|
|
147
147
|
|
|
148
148
|
|
|
149
|
+
class MissingPcieHotplug(S0i3Failure):
|
|
150
|
+
"""PCIe hotplug driver is missing"""
|
|
151
|
+
|
|
152
|
+
def __init__(self):
|
|
153
|
+
super().__init__()
|
|
154
|
+
self.description = "PCIe hotplug driver is missing"
|
|
155
|
+
self.explanation = (
|
|
156
|
+
"The pciehp driver is required for PCIe hotplug support. "
|
|
157
|
+
"Without this driver, PCIe devices may not be able to enter proper power states. "
|
|
158
|
+
"Be sure that you have enabled CONFIG_HOTPLUG_PCI_PCIE in your kernel."
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
|
|
149
162
|
class MissingDriver(S0i3Failure):
|
|
150
163
|
"""driver is missing"""
|
|
151
164
|
|
|
@@ -63,6 +63,7 @@ from amd_debug.failures import (
|
|
|
63
63
|
MissingIommuACPI,
|
|
64
64
|
MissingIommuPolicy,
|
|
65
65
|
MissingIsp4PlatformDriver,
|
|
66
|
+
MissingPcieHotplug,
|
|
66
67
|
MissingThunderbolt,
|
|
67
68
|
MissingXhciHcd,
|
|
68
69
|
MSRFailure,
|
|
@@ -351,7 +352,6 @@ class PrerequisiteValidator(AmdTool):
|
|
|
351
352
|
if not driver:
|
|
352
353
|
self.db.record_prereq(f"NPU device in {slot} missing driver", "🚦")
|
|
353
354
|
self.failures += [MissingDriver(slot)]
|
|
354
|
-
return False
|
|
355
355
|
p = os.path.join(device.sys_path, "fw_version")
|
|
356
356
|
if os.path.exists(p):
|
|
357
357
|
xdna_fw_version = read_file(p)
|
|
@@ -509,6 +509,15 @@ class PrerequisiteValidator(AmdTool):
|
|
|
509
509
|
)
|
|
510
510
|
return True
|
|
511
511
|
|
|
512
|
+
def check_pcie_hotplug(self):
|
|
513
|
+
"""Check if PCIe hotplug support is enabled"""
|
|
514
|
+
if not os.path.exists("/sys/module/pciehp"):
|
|
515
|
+
self.db.record_prereq("PCIe hotplug driver `pciehp` missing", "❌")
|
|
516
|
+
self.failures += [MissingPcieHotplug()]
|
|
517
|
+
return False
|
|
518
|
+
self.db.record_prereq("PCIe hotplug driver `pciehp` loaded", "✅")
|
|
519
|
+
return True
|
|
520
|
+
|
|
512
521
|
def check_sleep_mode(self):
|
|
513
522
|
"""Check if the system is configured for s2idle"""
|
|
514
523
|
fn = os.path.join("/", "sys", "power", "mem_sleep")
|
|
@@ -1033,11 +1042,14 @@ class PrerequisiteValidator(AmdTool):
|
|
|
1033
1042
|
p2 = os.path.join("/", "sys", "module", "amd_isp4_capture")
|
|
1034
1043
|
if not os.path.exists(p1) and not os.path.exists(p2):
|
|
1035
1044
|
self.db.record_prereq(
|
|
1036
|
-
"Camera driver module 'amd_capture'/'amd_isp4_capture' not loaded",
|
|
1045
|
+
"Camera driver module 'amd_capture'/'amd_isp4_capture' not loaded",
|
|
1046
|
+
"❌",
|
|
1037
1047
|
)
|
|
1038
1048
|
self.failures += [MissingAmdCaptureModule()]
|
|
1039
1049
|
return False
|
|
1040
|
-
self.db.record_prereq(
|
|
1050
|
+
self.db.record_prereq(
|
|
1051
|
+
"Camera driver module 'amd_capture'/'amd_isp4_capture' loaded", "✅"
|
|
1052
|
+
)
|
|
1041
1053
|
return True
|
|
1042
1054
|
|
|
1043
1055
|
def map_acpi_path(self):
|
|
@@ -1381,6 +1393,7 @@ class PrerequisiteValidator(AmdTool):
|
|
|
1381
1393
|
self.check_amd_pmc,
|
|
1382
1394
|
self.check_amd_cpu_hpet_wa,
|
|
1383
1395
|
self.check_port_pm_override,
|
|
1396
|
+
self.check_pcie_hotplug,
|
|
1384
1397
|
self.check_usb3,
|
|
1385
1398
|
self.check_usb4,
|
|
1386
1399
|
self.check_sleep_mode,
|
|
@@ -62,7 +62,7 @@ def display_report_file(fname, fmt) -> None:
|
|
|
62
62
|
if user:
|
|
63
63
|
env_vars = []
|
|
64
64
|
for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
|
|
65
|
-
"DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
|
|
65
|
+
"DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE", "XDG_DATA_DIRS"]:
|
|
66
66
|
value = os.environ.get(var)
|
|
67
67
|
if value:
|
|
68
68
|
env_vars.append(f"{var}={value}")
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import os
|
|
6
6
|
import argparse
|
|
7
|
+
import glob
|
|
8
|
+
import subprocess
|
|
7
9
|
from amd_debug.common import (
|
|
8
10
|
AmdTool,
|
|
9
11
|
bytes_to_gb,
|
|
@@ -28,6 +30,94 @@ def maybe_reboot() -> bool:
|
|
|
28
30
|
return reboot()
|
|
29
31
|
return True
|
|
30
32
|
|
|
33
|
+
def is_ttm_in_initramfs(initramfs_path: str) -> bool:
|
|
34
|
+
"""
|
|
35
|
+
Check if the ttm module is included in the initramfs.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
initramfs_path: Path to the initramfs image (e.g., "/boot/initrd.img-6.12.74-amd64")
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
bool: True if "gpu/drm/ttm/ttm.ko" is found, False otherwise
|
|
42
|
+
"""
|
|
43
|
+
try:
|
|
44
|
+
# Run lsinitramfs and search for "ttm" in the output
|
|
45
|
+
result = subprocess.run(
|
|
46
|
+
["lsinitramfs", initramfs_path],
|
|
47
|
+
capture_output=True,
|
|
48
|
+
text=True,
|
|
49
|
+
check=True
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Check if "gpu/drm/ttm/ttm.ko" appears in the output
|
|
53
|
+
return "gpu/drm/ttm/ttm.ko" in result.stdout.lower()
|
|
54
|
+
|
|
55
|
+
except subprocess.CalledProcessError as e:
|
|
56
|
+
print_color(f"Error running lsinitramfs: {e}", "❌")
|
|
57
|
+
return False
|
|
58
|
+
except FileNotFoundError:
|
|
59
|
+
print_color("Error: 'lsinitramfs' command not found. Is initramfs-tools installed?", "❌")
|
|
60
|
+
return False
|
|
61
|
+
|
|
62
|
+
def check_initramfs_images() -> bool:
|
|
63
|
+
"""Check if initramfs images exist in /boot/"""
|
|
64
|
+
print_color("Checking if the initramfs image needs to be regenerated", "🐧")
|
|
65
|
+
if not os.path.exists("/boot"):
|
|
66
|
+
print_color("Warning: /boot not found. Is it mounted?", "🚦")
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
# Check for common initramfs patterns
|
|
70
|
+
patterns = [
|
|
71
|
+
'/boot/initrd.img-*', # Debian/Ubuntu
|
|
72
|
+
'/boot/initramfs-*.img', # Fedora/RHEL
|
|
73
|
+
'/boot/initramfs-*' # Arch
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
for pattern in patterns:
|
|
77
|
+
initramfs_files = glob.glob(pattern)
|
|
78
|
+
if initramfs_files:
|
|
79
|
+
print_color(f"Found initramfs images: {initramfs_files}", "🐧")
|
|
80
|
+
|
|
81
|
+
latest_initramfs = max(initramfs_files)
|
|
82
|
+
if is_ttm_in_initramfs(latest_initramfs):
|
|
83
|
+
print_color(f"TTM module is included in initramfs: {latest_initramfs}", "✅")
|
|
84
|
+
print_color("The initramfs image needs to be regenerated", "🐧")
|
|
85
|
+
return True
|
|
86
|
+
else:
|
|
87
|
+
print_color(f"TTM module is not included in initramfs", "○")
|
|
88
|
+
print_color(f"The initramfs image does not need to be regenerated", "○")
|
|
89
|
+
return False
|
|
90
|
+
|
|
91
|
+
def regenerate_initramfs():
|
|
92
|
+
"""Regenerate initramfs image"""
|
|
93
|
+
if not check_initramfs_images():
|
|
94
|
+
print_color("No initramfs images found, skipping regeneration", "○")
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
# Supported initramfs tools
|
|
98
|
+
initramfs_tools = [
|
|
99
|
+
["update-initramfs", "-u"],
|
|
100
|
+
["dracut", "--force"],
|
|
101
|
+
["mkinitcpio", "-P"]
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
for cmd in initramfs_tools:
|
|
105
|
+
tool = cmd[0]
|
|
106
|
+
if os.path.exists(f"/usr/sbin/{cmd[0]}") or os.path.exists(f"/usr/bin/{cmd[0]}"):
|
|
107
|
+
print_color(f"Updating initramfs using {tool}", "🐧")
|
|
108
|
+
try:
|
|
109
|
+
subprocess.run(cmd, check=True)
|
|
110
|
+
print_color("Initramfs updated successfully", "✅")
|
|
111
|
+
return
|
|
112
|
+
except subprocess.CalledProcessError as e:
|
|
113
|
+
print_color(f"Failed to update initramfs: {e}", "❌")
|
|
114
|
+
continue
|
|
115
|
+
except FileNotFoundError:
|
|
116
|
+
continue
|
|
117
|
+
|
|
118
|
+
print_color("No supported initramfs tool found", "❌")
|
|
119
|
+
return
|
|
120
|
+
|
|
31
121
|
|
|
32
122
|
class AmdTtmTool(AmdTool):
|
|
33
123
|
"""Class for handling TTM page configuration"""
|
|
@@ -96,6 +186,9 @@ class AmdTtmTool(AmdTool):
|
|
|
96
186
|
"🐧",
|
|
97
187
|
)
|
|
98
188
|
print_color(f"Configuration written to {MODPROBE_CONF_PATH}", "🐧")
|
|
189
|
+
|
|
190
|
+
regenerate_initramfs()
|
|
191
|
+
|
|
99
192
|
print_color("NOTE: You need to reboot for changes to take effect.", "○")
|
|
100
193
|
|
|
101
194
|
return maybe_reboot()
|
|
@@ -693,7 +693,10 @@ class SleepValidator(AmdTool):
|
|
|
693
693
|
"""Program the RTC wakealarm to wake the system after the requested duration"""
|
|
694
694
|
wakealarm = None
|
|
695
695
|
for device in self.pyudev.list_devices(subsystem="rtc"):
|
|
696
|
-
|
|
696
|
+
target = os.path.join(device.sys_path, "wakealarm")
|
|
697
|
+
if os.path.exists(target):
|
|
698
|
+
wakealarm = target
|
|
699
|
+
break
|
|
697
700
|
if wakealarm:
|
|
698
701
|
with open(wakealarm, "w", encoding="utf-8") as w:
|
|
699
702
|
w.write("0")
|
|
@@ -265,6 +265,59 @@ class TestCommon(unittest.TestCase):
|
|
|
265
265
|
with self.assertRaises(TypeError):
|
|
266
266
|
minimum_kernel(None, None)
|
|
267
267
|
|
|
268
|
+
def test_minimum_kernel_with_suffix(self):
|
|
269
|
+
"""Test minimum_kernel function with version strings containing suffixes"""
|
|
270
|
+
with patch("platform.uname") as mock_uname:
|
|
271
|
+
# Test with +unreleased suffix (the bug case)
|
|
272
|
+
mock_uname.return_value = uname_result(
|
|
273
|
+
system="Linux",
|
|
274
|
+
node="foo",
|
|
275
|
+
release="7.18+unreleased-amd64",
|
|
276
|
+
version="baz",
|
|
277
|
+
machine="x86_64",
|
|
278
|
+
)
|
|
279
|
+
self.assertTrue(minimum_kernel(7, 18))
|
|
280
|
+
self.assertTrue(minimum_kernel(7, 17))
|
|
281
|
+
self.assertFalse(minimum_kernel(7, 19))
|
|
282
|
+
self.assertTrue(minimum_kernel(6, 10))
|
|
283
|
+
self.assertFalse(minimum_kernel(8, 0))
|
|
284
|
+
|
|
285
|
+
# Test with -rc suffix
|
|
286
|
+
mock_uname.return_value = uname_result(
|
|
287
|
+
system="Linux",
|
|
288
|
+
node="foo",
|
|
289
|
+
release="6.10-rc1-amd64",
|
|
290
|
+
version="baz",
|
|
291
|
+
machine="x86_64",
|
|
292
|
+
)
|
|
293
|
+
self.assertTrue(minimum_kernel(6, 10))
|
|
294
|
+
self.assertTrue(minimum_kernel(6, 9))
|
|
295
|
+
self.assertFalse(minimum_kernel(6, 11))
|
|
296
|
+
|
|
297
|
+
# Test with custom build suffix
|
|
298
|
+
mock_uname.return_value = uname_result(
|
|
299
|
+
system="Linux",
|
|
300
|
+
node="foo",
|
|
301
|
+
release="5.15+custom-build",
|
|
302
|
+
version="baz",
|
|
303
|
+
machine="x86_64",
|
|
304
|
+
)
|
|
305
|
+
self.assertTrue(minimum_kernel(5, 15))
|
|
306
|
+
self.assertTrue(minimum_kernel(5, 14))
|
|
307
|
+
self.assertFalse(minimum_kernel(5, 16))
|
|
308
|
+
|
|
309
|
+
# Test with -generic suffix (Ubuntu-style)
|
|
310
|
+
mock_uname.return_value = uname_result(
|
|
311
|
+
system="Linux",
|
|
312
|
+
node="foo",
|
|
313
|
+
release="5.4.0-generic",
|
|
314
|
+
version="baz",
|
|
315
|
+
machine="x86_64",
|
|
316
|
+
)
|
|
317
|
+
self.assertTrue(minimum_kernel(5, 4))
|
|
318
|
+
self.assertTrue(minimum_kernel(5, 3))
|
|
319
|
+
self.assertFalse(minimum_kernel(5, 5))
|
|
320
|
+
|
|
268
321
|
def test_systemd_in_use(self):
|
|
269
322
|
"""Test systemd_in_use function"""
|
|
270
323
|
with patch(
|
|
@@ -477,44 +530,17 @@ class TestCommon(unittest.TestCase):
|
|
|
477
530
|
self.assertAlmostEqual(get_system_mem(), expected_gb)
|
|
478
531
|
mock_file.assert_called_once_with("/proc/meminfo", "r", encoding="utf-8")
|
|
479
532
|
|
|
480
|
-
|
|
533
|
+
@patch("amd_debug.common.asyncio.run", return_value=True)
|
|
534
|
+
def test_reboot_dbus_fast_success(self, mock_asyncio_run):
|
|
481
535
|
"""Test reboot returns True when reboot_dbus_fast succeeds"""
|
|
536
|
+
result = reboot()
|
|
537
|
+
self.assertTrue(result)
|
|
538
|
+
mock_asyncio_run.assert_called_once()
|
|
482
539
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
# Consume the coroutine to prevent the warning
|
|
486
|
-
try:
|
|
487
|
-
# Close the coroutine to prevent the warning
|
|
488
|
-
coro.close()
|
|
489
|
-
except (AttributeError, RuntimeError):
|
|
490
|
-
pass
|
|
491
|
-
return True
|
|
492
|
-
|
|
493
|
-
mock_loop = Mock()
|
|
494
|
-
mock_loop.run_until_complete.side_effect = mock_run_until_complete
|
|
495
|
-
|
|
496
|
-
with patch("amd_debug.common.asyncio.get_event_loop", return_value=mock_loop):
|
|
497
|
-
result = reboot()
|
|
498
|
-
self.assertTrue(result)
|
|
499
|
-
mock_loop.run_until_complete.assert_called_once()
|
|
500
|
-
|
|
501
|
-
@patch("asyncio.get_event_loop")
|
|
502
|
-
def test_reboot_dbus_fast_failure_and_dbus_success(self, mock_get_event_loop):
|
|
540
|
+
@patch("amd_debug.common.asyncio.run", return_value=False)
|
|
541
|
+
def test_reboot_dbus_fast_failure_and_dbus_success(self, mock_asyncio_run):
|
|
503
542
|
"""Test reboot falls back to reboot_dbus when reboot_dbus_fast fails"""
|
|
504
543
|
|
|
505
|
-
# Create a mock loop that properly handles coroutines
|
|
506
|
-
def mock_run_until_complete(coro):
|
|
507
|
-
# Consume the coroutine to prevent the warning
|
|
508
|
-
try:
|
|
509
|
-
coro.close()
|
|
510
|
-
except (AttributeError, RuntimeError):
|
|
511
|
-
pass
|
|
512
|
-
return False
|
|
513
|
-
|
|
514
|
-
mock_loop = Mock()
|
|
515
|
-
mock_loop.run_until_complete.side_effect = mock_run_until_complete
|
|
516
|
-
mock_get_event_loop.return_value = mock_loop
|
|
517
|
-
|
|
518
544
|
# Mock the dbus module to avoid ImportError in CI
|
|
519
545
|
mock_dbus = Mock()
|
|
520
546
|
mock_bus = Mock()
|
|
@@ -530,23 +556,10 @@ class TestCommon(unittest.TestCase):
|
|
|
530
556
|
result = reboot()
|
|
531
557
|
self.assertTrue(result)
|
|
532
558
|
|
|
533
|
-
@patch("asyncio.
|
|
534
|
-
def test_reboot_dbus_fast_failure_and_dbus_failure(self,
|
|
559
|
+
@patch("amd_debug.common.asyncio.run", return_value=False)
|
|
560
|
+
def test_reboot_dbus_fast_failure_and_dbus_failure(self, mock_asyncio_run):
|
|
535
561
|
"""Test reboot returns False when both reboot_dbus_fast and reboot_dbus fail"""
|
|
536
562
|
|
|
537
|
-
# Create a mock loop that properly handles coroutines
|
|
538
|
-
def mock_run_until_complete(coro):
|
|
539
|
-
# Consume the coroutine to prevent the warning
|
|
540
|
-
try:
|
|
541
|
-
coro.close()
|
|
542
|
-
except (AttributeError, RuntimeError):
|
|
543
|
-
pass
|
|
544
|
-
return False
|
|
545
|
-
|
|
546
|
-
mock_loop = Mock()
|
|
547
|
-
mock_loop.run_until_complete.side_effect = mock_run_until_complete
|
|
548
|
-
mock_get_event_loop.return_value = mock_loop
|
|
549
|
-
|
|
550
563
|
# Mock the import to raise ImportError when dbus is imported
|
|
551
564
|
original_import = builtins.__import__
|
|
552
565
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{amd_debug_tools-0.2.16 → amd_debug_tools-0.2.18}/src/amd_debug_tools.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|