amd-debug-tools 0.2.2__py3-none-any.whl → 0.2.12__py3-none-any.whl
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/__init__.py +10 -3
- amd_debug/acpi.py +0 -1
- amd_debug/battery.py +0 -1
- amd_debug/bios.py +8 -5
- amd_debug/common.py +70 -3
- amd_debug/database.py +22 -5
- amd_debug/display.py +2 -3
- amd_debug/failures.py +44 -3
- amd_debug/installer.py +7 -6
- amd_debug/kernel.py +20 -17
- amd_debug/prerequisites.py +166 -61
- amd_debug/pstate.py +9 -6
- amd_debug/s2idle.py +53 -44
- amd_debug/sleep_report.py +129 -87
- amd_debug/templates/html +4 -2
- amd_debug/ttm.py +157 -0
- amd_debug/validator.py +61 -34
- amd_debug/wake.py +0 -1
- amd_debug_tools-0.2.12.dist-info/METADATA +75 -0
- amd_debug_tools-0.2.12.dist-info/RECORD +47 -0
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.12.dist-info}/entry_points.txt +1 -0
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.12.dist-info}/top_level.txt +1 -0
- launcher.py +0 -1
- test_acpi.py +1 -1
- test_bios.py +30 -12
- test_common.py +117 -1
- test_database.py +1 -1
- test_display.py +6 -6
- test_installer.py +68 -1
- test_kernel.py +7 -6
- test_launcher.py +9 -1
- test_prerequisites.py +629 -26
- test_s2idle.py +66 -19
- test_sleep_report.py +29 -0
- test_ttm.py +276 -0
- test_validator.py +187 -16
- amd_debug_tools-0.2.2.dist-info/METADATA +0 -181
- amd_debug_tools-0.2.2.dist-info/RECORD +0 -45
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.12.dist-info}/WHEEL +0 -0
- {amd_debug_tools-0.2.2.dist-info → amd_debug_tools-0.2.12.dist-info}/licenses/LICENSE +0 -0
test_display.py
CHANGED
|
@@ -40,7 +40,7 @@ class TestDisplay(unittest.TestCase):
|
|
|
40
40
|
display = Display()
|
|
41
41
|
|
|
42
42
|
# Verify the EDID paths are correctly set
|
|
43
|
-
expected_edid =
|
|
43
|
+
expected_edid = ["/sys/devices/card0/edid"]
|
|
44
44
|
self.assertEqual(display.get_edid(), expected_edid)
|
|
45
45
|
mock_context.assert_called_once()
|
|
46
46
|
|
|
@@ -54,7 +54,7 @@ class TestDisplay(unittest.TestCase):
|
|
|
54
54
|
display = Display()
|
|
55
55
|
|
|
56
56
|
# Verify the EDID dictionary is empty
|
|
57
|
-
self.assertEqual(display.get_edid(),
|
|
57
|
+
self.assertEqual(display.get_edid(), [])
|
|
58
58
|
|
|
59
59
|
@patch("amd_debug.display.Context")
|
|
60
60
|
def test_device_without_card(self, mock_context):
|
|
@@ -70,7 +70,7 @@ class TestDisplay(unittest.TestCase):
|
|
|
70
70
|
display = Display()
|
|
71
71
|
|
|
72
72
|
# Verify the EDID dictionary is empty
|
|
73
|
-
self.assertEqual(display.get_edid(),
|
|
73
|
+
self.assertEqual(display.get_edid(), [])
|
|
74
74
|
|
|
75
75
|
@patch("amd_debug.display.Context")
|
|
76
76
|
@patch("amd_debug.display.read_file")
|
|
@@ -94,7 +94,7 @@ class TestDisplay(unittest.TestCase):
|
|
|
94
94
|
display = Display()
|
|
95
95
|
|
|
96
96
|
# Verify the EDID dictionary is empty
|
|
97
|
-
self.assertEqual(display.get_edid(),
|
|
97
|
+
self.assertEqual(display.get_edid(), [])
|
|
98
98
|
|
|
99
99
|
@patch("amd_debug.display.Context")
|
|
100
100
|
@patch("amd_debug.display.read_file")
|
|
@@ -116,7 +116,7 @@ class TestDisplay(unittest.TestCase):
|
|
|
116
116
|
display = Display()
|
|
117
117
|
|
|
118
118
|
# Verify the EDID dictionary is empty
|
|
119
|
-
self.assertEqual(display.get_edid(),
|
|
119
|
+
self.assertEqual(display.get_edid(), [])
|
|
120
120
|
|
|
121
121
|
@patch("amd_debug.display.Context")
|
|
122
122
|
@patch("amd_debug.display.read_file")
|
|
@@ -140,4 +140,4 @@ class TestDisplay(unittest.TestCase):
|
|
|
140
140
|
display = Display()
|
|
141
141
|
|
|
142
142
|
# Verify the EDID dictionary is empty
|
|
143
|
-
self.assertEqual(display.get_edid(),
|
|
143
|
+
self.assertEqual(display.get_edid(), [])
|
test_installer.py
CHANGED
|
@@ -125,6 +125,29 @@ class TestInstaller(unittest.TestCase):
|
|
|
125
125
|
)
|
|
126
126
|
self.assertTrue(ret)
|
|
127
127
|
|
|
128
|
+
@patch("builtins.print")
|
|
129
|
+
@patch("amd_debug.installer.get_distro", return_value="fedora")
|
|
130
|
+
@patch("builtins.open", new_callable=mock_open, read_data="VARIANT_ID=kde\n")
|
|
131
|
+
@patch("os.execvp", return_value=None)
|
|
132
|
+
@patch("subprocess.check_call", return_value=0)
|
|
133
|
+
@patch("subprocess.call", return_value=1)
|
|
134
|
+
def test_install_iasl_fedora_kde(
|
|
135
|
+
self,
|
|
136
|
+
_mock_call,
|
|
137
|
+
_mock_check_call,
|
|
138
|
+
_mock_variant,
|
|
139
|
+
_mock_distro,
|
|
140
|
+
_fake_sudo,
|
|
141
|
+
_mock_print,
|
|
142
|
+
):
|
|
143
|
+
"""Test install requirements function on Fedora KDE"""
|
|
144
|
+
self.installer.set_requirements("iasl")
|
|
145
|
+
ret = self.installer.install_dependencies()
|
|
146
|
+
_mock_check_call.assert_called_once_with(
|
|
147
|
+
["dnf", "install", "-y", "acpica-tools"]
|
|
148
|
+
)
|
|
149
|
+
self.assertTrue(ret)
|
|
150
|
+
|
|
128
151
|
@patch("builtins.print")
|
|
129
152
|
@patch("amd_debug.installer.get_distro", return_value="ubuntu")
|
|
130
153
|
@patch("os.execvp", return_value=None)
|
|
@@ -162,6 +185,27 @@ class TestInstaller(unittest.TestCase):
|
|
|
162
185
|
_mock_check_call.assert_called_once_with(["dnf", "install", "-y", "ethtool"])
|
|
163
186
|
self.assertTrue(ret)
|
|
164
187
|
|
|
188
|
+
@patch("builtins.print")
|
|
189
|
+
@patch("amd_debug.installer.get_distro", return_value="fedora")
|
|
190
|
+
@patch("builtins.open", new_callable=mock_open, read_data="VARIANT_ID=kde\n")
|
|
191
|
+
@patch("os.execvp", return_value=None)
|
|
192
|
+
@patch("subprocess.check_call", return_value=0)
|
|
193
|
+
@patch("subprocess.call", return_value=1)
|
|
194
|
+
def test_install_ethtool_fedora_kde(
|
|
195
|
+
self,
|
|
196
|
+
_mock_call,
|
|
197
|
+
_mock_check_call,
|
|
198
|
+
_mock_variant,
|
|
199
|
+
_mock_distro,
|
|
200
|
+
_fake_sudo,
|
|
201
|
+
_mock_print,
|
|
202
|
+
):
|
|
203
|
+
"""Test install requirements function on Fedora KDE"""
|
|
204
|
+
self.installer.set_requirements("ethtool")
|
|
205
|
+
ret = self.installer.install_dependencies()
|
|
206
|
+
_mock_check_call.assert_called_once_with(["dnf", "install", "-y", "ethtool"])
|
|
207
|
+
self.assertTrue(ret)
|
|
208
|
+
|
|
165
209
|
@patch("builtins.print")
|
|
166
210
|
@patch("amd_debug.installer.get_distro", return_value="arch")
|
|
167
211
|
@patch("os.execvp", return_value=None)
|
|
@@ -231,7 +275,30 @@ class TestInstaller(unittest.TestCase):
|
|
|
231
275
|
self.installer.set_requirements("edid-decode")
|
|
232
276
|
ret = self.installer.install_dependencies()
|
|
233
277
|
_mock_check_call.assert_called_once_with(
|
|
234
|
-
["dnf", "install", "-y", "libdisplay-info"]
|
|
278
|
+
["dnf", "install", "-y", "libdisplay-info-tools"]
|
|
279
|
+
)
|
|
280
|
+
self.assertTrue(ret)
|
|
281
|
+
|
|
282
|
+
@patch("builtins.print")
|
|
283
|
+
@patch("amd_debug.installer.get_distro", return_value="fedora")
|
|
284
|
+
@patch("builtins.open", new_callable=mock_open, read_data="VARIANT_ID=kde\n")
|
|
285
|
+
@patch("os.execvp", return_value=None)
|
|
286
|
+
@patch("subprocess.check_call", return_value=0)
|
|
287
|
+
@patch("subprocess.call", return_value=1)
|
|
288
|
+
def test_install_edid_decode_fedora_kde(
|
|
289
|
+
self,
|
|
290
|
+
_mock_call,
|
|
291
|
+
_mock_check_call,
|
|
292
|
+
_mock_variant,
|
|
293
|
+
_mock_distro,
|
|
294
|
+
_fake_sudo,
|
|
295
|
+
_mock_print,
|
|
296
|
+
):
|
|
297
|
+
"""Test install requirements function for edid-decode on Fedora KDE"""
|
|
298
|
+
self.installer.set_requirements("edid-decode")
|
|
299
|
+
ret = self.installer.install_dependencies()
|
|
300
|
+
_mock_check_call.assert_called_once_with(
|
|
301
|
+
["dnf", "install", "-y", "libdisplay-info-tools"]
|
|
235
302
|
)
|
|
236
303
|
self.assertTrue(ret)
|
|
237
304
|
|
test_kernel.py
CHANGED
|
@@ -26,7 +26,7 @@ class TestKernelLog(unittest.TestCase):
|
|
|
26
26
|
kernel_cmdline = "quiet splash"
|
|
27
27
|
expected_output = ""
|
|
28
28
|
with patch(
|
|
29
|
-
"
|
|
29
|
+
"amd_debug.common.open", new_callable=mock_open, read_data=kernel_cmdline
|
|
30
30
|
) as _mock_file:
|
|
31
31
|
result = get_kernel_command_line()
|
|
32
32
|
self.assertEqual(result, expected_output)
|
|
@@ -35,7 +35,7 @@ class TestKernelLog(unittest.TestCase):
|
|
|
35
35
|
kernel_cmdline = ""
|
|
36
36
|
expected_output = ""
|
|
37
37
|
with patch(
|
|
38
|
-
"
|
|
38
|
+
"amd_debug.common.open", new_callable=mock_open, read_data=kernel_cmdline
|
|
39
39
|
) as _mock_file:
|
|
40
40
|
result = get_kernel_command_line()
|
|
41
41
|
self.assertEqual(result, expected_output)
|
|
@@ -44,7 +44,7 @@ class TestKernelLog(unittest.TestCase):
|
|
|
44
44
|
kernel_cmdline = "quiet splash --debug=1"
|
|
45
45
|
expected_output = "--debug=1"
|
|
46
46
|
with patch(
|
|
47
|
-
"
|
|
47
|
+
"amd_debug.common.open", new_callable=mock_open, read_data=kernel_cmdline
|
|
48
48
|
) as _mock_file:
|
|
49
49
|
result = get_kernel_command_line()
|
|
50
50
|
self.assertEqual(result, expected_output)
|
|
@@ -53,7 +53,7 @@ class TestKernelLog(unittest.TestCase):
|
|
|
53
53
|
kernel_cmdline = "quiet splash initrd=foo modprobe.blacklist=foo"
|
|
54
54
|
expected_output = "modprobe.blacklist=foo"
|
|
55
55
|
with patch(
|
|
56
|
-
"
|
|
56
|
+
"amd_debug.common.open", new_callable=mock_open, read_data=kernel_cmdline
|
|
57
57
|
) as _mock_file:
|
|
58
58
|
result = get_kernel_command_line()
|
|
59
59
|
self.assertEqual(result, expected_output)
|
|
@@ -85,7 +85,7 @@ class TestKernelLog(unittest.TestCase):
|
|
|
85
85
|
|
|
86
86
|
# test a real post code line
|
|
87
87
|
line = 'ex_trace_args: " POST CODE: %X ACPI TIMER: %X TIME: %d.%d ms\\n", b0003f33, 83528798, 0, 77, 0, 0'
|
|
88
|
-
expected_output = "POST CODE: B0003F33 ACPI TIMER: 83528798 TIME: 0.
|
|
88
|
+
expected_output = "POST CODE: B0003F33 ACPI TIMER: 83528798 TIME: 0.119 ms"
|
|
89
89
|
result = sscanf_bios_args(line)
|
|
90
90
|
self.assertEqual(result, expected_output)
|
|
91
91
|
|
|
@@ -114,7 +114,8 @@ class TestDmesgLogger(unittest.TestCase):
|
|
|
114
114
|
"""Test Dmesg logger functions"""
|
|
115
115
|
|
|
116
116
|
@classmethod
|
|
117
|
-
|
|
117
|
+
@patch("subprocess.run")
|
|
118
|
+
def setUpClass(cls, _mock_run=None):
|
|
118
119
|
logging.basicConfig(filename="/dev/null", level=logging.DEBUG)
|
|
119
120
|
|
|
120
121
|
def test_dmesg_logger_initialization(self):
|
test_launcher.py
CHANGED
|
@@ -26,10 +26,11 @@ class TestLauncher(unittest.TestCase):
|
|
|
26
26
|
"""Test launching as unknown exe"""
|
|
27
27
|
|
|
28
28
|
with patch("builtins.print") as mock_print:
|
|
29
|
-
amd_debug.launch_tool("unknown_exe.py")
|
|
29
|
+
result = amd_debug.launch_tool("unknown_exe.py")
|
|
30
30
|
mock_print.assert_called_once_with(
|
|
31
31
|
"\033[91mUnknown exe: unknown_exe.py\033[0m"
|
|
32
32
|
)
|
|
33
|
+
self.assertIsNotNone(result)
|
|
33
34
|
|
|
34
35
|
def test_launcher_amd_s2idle(self):
|
|
35
36
|
"""Test launching amd_s2idle"""
|
|
@@ -51,3 +52,10 @@ class TestLauncher(unittest.TestCase):
|
|
|
51
52
|
with patch("amd_debug.pstate.main") as mock_main:
|
|
52
53
|
amd_debug.launch_tool("amd_pstate.py")
|
|
53
54
|
mock_main.assert_called_once()
|
|
55
|
+
|
|
56
|
+
def test_launcher_amd_ttm(self):
|
|
57
|
+
"""Test launching amd_ttm"""
|
|
58
|
+
|
|
59
|
+
with patch("amd_debug.ttm.main") as mock_main:
|
|
60
|
+
amd_debug.launch_tool("amd_ttm.py")
|
|
61
|
+
mock_main.assert_called_once()
|