amd-debug-tools 0.2.6__py3-none-any.whl → 0.2.7__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.
Potentially problematic release.
This version of amd-debug-tools might be problematic. Click here for more details.
- amd_debug/ttm.py +3 -7
- {amd_debug_tools-0.2.6.dist-info → amd_debug_tools-0.2.7.dist-info}/METADATA +1 -1
- {amd_debug_tools-0.2.6.dist-info → amd_debug_tools-0.2.7.dist-info}/RECORD +8 -8
- {amd_debug_tools-0.2.6.dist-info → amd_debug_tools-0.2.7.dist-info}/top_level.txt +1 -0
- amd_debug/test_ttm.py → test_ttm.py +11 -26
- {amd_debug_tools-0.2.6.dist-info → amd_debug_tools-0.2.7.dist-info}/WHEEL +0 -0
- {amd_debug_tools-0.2.6.dist-info → amd_debug_tools-0.2.7.dist-info}/entry_points.txt +0 -0
- {amd_debug_tools-0.2.6.dist-info → amd_debug_tools-0.2.7.dist-info}/licenses/LICENSE +0 -0
amd_debug/ttm.py
CHANGED
|
@@ -9,7 +9,7 @@ from amd_debug.common import (
|
|
|
9
9
|
bytes_to_gb,
|
|
10
10
|
gb_to_pages,
|
|
11
11
|
get_system_mem,
|
|
12
|
-
|
|
12
|
+
relaunch_sudo,
|
|
13
13
|
print_color,
|
|
14
14
|
reboot,
|
|
15
15
|
version,
|
|
@@ -57,9 +57,7 @@ class AmdTtmTool(AmdTool):
|
|
|
57
57
|
|
|
58
58
|
def set(self, gb_value) -> bool:
|
|
59
59
|
"""Set a new page limit"""
|
|
60
|
-
|
|
61
|
-
print_color("Root privileges required", "❌")
|
|
62
|
-
return False
|
|
60
|
+
relaunch_sudo()
|
|
63
61
|
|
|
64
62
|
# Check against system memory
|
|
65
63
|
total = get_system_mem()
|
|
@@ -108,9 +106,7 @@ class AmdTtmTool(AmdTool):
|
|
|
108
106
|
print_color(f"{MODPROBE_CONF_PATH} doesn't exist", "❌")
|
|
109
107
|
return False
|
|
110
108
|
|
|
111
|
-
|
|
112
|
-
print_color("Root privileges required", "❌")
|
|
113
|
-
return False
|
|
109
|
+
relaunch_sudo()
|
|
114
110
|
|
|
115
111
|
os.remove(MODPROBE_CONF_PATH)
|
|
116
112
|
print_color(f"Configuration {MODPROBE_CONF_PATH} removed", "🐧")
|
|
@@ -13,6 +13,7 @@ test_prerequisites.py,sha256=-q6v80QXDMB_Mdek2KZTmKfKcRVZnHf8SBEhcT0RyIY,88498
|
|
|
13
13
|
test_pstate.py,sha256=a9oAJ9-LANX32XNQhplz6Y75VNYc__QqoSBKIrwvANg,6058
|
|
14
14
|
test_s2idle.py,sha256=FxsyujgX9Px3m56VzHNeA8yMTHmJiRLWxYt-fh1m5gw,33585
|
|
15
15
|
test_sleep_report.py,sha256=ANuxYi_C1oSKAi4xUU2wBu4SwJtcZA7VPpazBe3_WUQ,6922
|
|
16
|
+
test_ttm.py,sha256=QrCdRodQ_CD3nyDqKodb6yR158mgE0iIM5f1fV1Axu8,10515
|
|
16
17
|
test_validator.py,sha256=RpjyzxDpExhLcSJfQ0UDuonr4sTFAfa7sTtY5g7tc_Q,36410
|
|
17
18
|
test_wake.py,sha256=6zi5GVFHQKU1sTWw3O5-aGriB9uu5713QLn4l2wjhpM,7152
|
|
18
19
|
amd_debug/__init__.py,sha256=66Ya61av8RCws6bEY_vdujGmjBIZ6_UqfuWHgMNNOJY,1271
|
|
@@ -30,8 +31,7 @@ amd_debug/pstate.py,sha256=AOKCvUb0ngwHU2C59uSKrFwdLzEyn8r1w2DgWhZAMKM,9583
|
|
|
30
31
|
amd_debug/s2idle-hook,sha256=LLiaqPtGd0qetu9n6EYxKHZaIdHpVQDONdOuSc0pfFg,1695
|
|
31
32
|
amd_debug/s2idle.py,sha256=4cxHNfmvq11BE-AtkEthIqR-xrWmxW2LTa6oVDtGztY,13284
|
|
32
33
|
amd_debug/sleep_report.py,sha256=hhqu711AKtjeYF2xmGcejyCyyPtmq4-gC_hROUCrC0g,17317
|
|
33
|
-
amd_debug/
|
|
34
|
-
amd_debug/ttm.py,sha256=U7beRffgoXIPgUXet4ZMabEGo7b0qqKMluhBVMD7O04,4830
|
|
34
|
+
amd_debug/ttm.py,sha256=huXDqdcNrn0JIn-UGNTS7pXTBL5YB3gmi_OP9rfXskA,4664
|
|
35
35
|
amd_debug/validator.py,sha256=X-cNFVvHWKzFgT4aR0Td3I2kwQRBOK4vQUk6L276VCQ,34153
|
|
36
36
|
amd_debug/wake.py,sha256=xT8WrFrN6voCmXWo5dsn4mQ7iR2QJxHrrYBd3EREG-Q,3936
|
|
37
37
|
amd_debug/bash/amd-s2idle,sha256=g_cle1ElCJpwE4wcLezL6y-BdasDKTnNMhrtzKLE9ks,1142
|
|
@@ -39,9 +39,9 @@ amd_debug/templates/html,sha256=JfGhpmHIB2C2GItdGI1kuC8uayqEVgrpQvAWAj35eZ4,1458
|
|
|
39
39
|
amd_debug/templates/md,sha256=r8X2aehnH2gzj0WHYTZ5K9wAqC5y39i_3nkDORSC0uM,787
|
|
40
40
|
amd_debug/templates/stdout,sha256=hyoOJ96K2dJfnWRWhyCuariLKbEHXvs9mstV_g5aMdI,469
|
|
41
41
|
amd_debug/templates/txt,sha256=nNdsvbPFOhGdL7VA-_4k5aN3nB-6ouGQt6AsWst7T3w,649
|
|
42
|
-
amd_debug_tools-0.2.
|
|
43
|
-
amd_debug_tools-0.2.
|
|
44
|
-
amd_debug_tools-0.2.
|
|
45
|
-
amd_debug_tools-0.2.
|
|
46
|
-
amd_debug_tools-0.2.
|
|
47
|
-
amd_debug_tools-0.2.
|
|
42
|
+
amd_debug_tools-0.2.7.dist-info/licenses/LICENSE,sha256=RBlZI6r3MRGzymI2VDX2iW__D2APDbMhu_Xg5t6BWeo,1066
|
|
43
|
+
amd_debug_tools-0.2.7.dist-info/METADATA,sha256=02ahxaxXDJf3w6V3xoGItmpby-iDiyJskFc_rhhYNQw,6971
|
|
44
|
+
amd_debug_tools-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
45
|
+
amd_debug_tools-0.2.7.dist-info/entry_points.txt,sha256=hIskDz6k0_6q1qpqWCpVFsca_djxAqkLrUAwzAyEGuE,144
|
|
46
|
+
amd_debug_tools-0.2.7.dist-info/top_level.txt,sha256=VvGkkY5I7O3HoLNrc2VfgjCA-to3PUjnnKd7juONaFw,243
|
|
47
|
+
amd_debug_tools-0.2.7.dist-info/RECORD,,
|
|
@@ -199,18 +199,12 @@ class TestAmdTtmTool(unittest.TestCase):
|
|
|
199
199
|
)
|
|
200
200
|
self.assertFalse(result)
|
|
201
201
|
|
|
202
|
-
@mock.patch("amd_debug.ttm.
|
|
203
|
-
@mock.patch("amd_debug.ttm.print_color")
|
|
204
|
-
def test_set_not_root(self, mock_print, _mock_is_root):
|
|
205
|
-
"""Test set() when not root"""
|
|
206
|
-
result = self.tool.set(2)
|
|
207
|
-
mock_print.assert_called_with("Root privileges required", "❌")
|
|
208
|
-
self.assertFalse(result)
|
|
209
|
-
|
|
210
|
-
@mock.patch("amd_debug.ttm.is_root", return_value=True)
|
|
202
|
+
@mock.patch("amd_debug.ttm.relaunch_sudo", return_value=True)
|
|
211
203
|
@mock.patch("amd_debug.ttm.get_system_mem", return_value=8.0)
|
|
212
204
|
@mock.patch("amd_debug.ttm.print_color")
|
|
213
|
-
def test_set_gb_greater_than_total(
|
|
205
|
+
def test_set_gb_greater_than_total(
|
|
206
|
+
self, mock_print, _mock_mem, _mock_relaunch_sudo
|
|
207
|
+
):
|
|
214
208
|
"""Test set() when gb_value > total system memory"""
|
|
215
209
|
result = self.tool.set(16)
|
|
216
210
|
mock_print.assert_any_call(
|
|
@@ -218,19 +212,19 @@ class TestAmdTtmTool(unittest.TestCase):
|
|
|
218
212
|
)
|
|
219
213
|
self.assertFalse(result)
|
|
220
214
|
|
|
221
|
-
@mock.patch("amd_debug.ttm.
|
|
215
|
+
@mock.patch("amd_debug.ttm.relaunch_sudo", return_value=True)
|
|
222
216
|
@mock.patch("amd_debug.ttm.get_system_mem", return_value=10.0)
|
|
223
217
|
@mock.patch("amd_debug.ttm.print_color")
|
|
224
218
|
@mock.patch("builtins.input", return_value="n")
|
|
225
219
|
def test_set_gb_exceeds_max_percentage_cancel(
|
|
226
|
-
self, _mock_input, mock_print, _mock_mem,
|
|
220
|
+
self, _mock_input, mock_print, _mock_mem, mock_relaunch_sudo
|
|
227
221
|
):
|
|
228
222
|
"""Test set() when gb_value exceeds max percentage and user cancels"""
|
|
229
223
|
result = self.tool.set(9.5)
|
|
230
224
|
self.assertFalse(result)
|
|
231
225
|
mock_print.assert_any_call("Operation cancelled.", "🚦")
|
|
232
226
|
|
|
233
|
-
@mock.patch("amd_debug.ttm.
|
|
227
|
+
@mock.patch("amd_debug.ttm.relaunch_sudo", return_value=True)
|
|
234
228
|
@mock.patch("amd_debug.ttm.get_system_mem", return_value=10.0)
|
|
235
229
|
@mock.patch("amd_debug.ttm.gb_to_pages", return_value=20480)
|
|
236
230
|
@mock.patch("amd_debug.ttm.print_color")
|
|
@@ -244,8 +238,8 @@ class TestAmdTtmTool(unittest.TestCase):
|
|
|
244
238
|
mock_open,
|
|
245
239
|
mock_print,
|
|
246
240
|
_mock_gb_to_pages,
|
|
247
|
-
|
|
248
|
-
|
|
241
|
+
_mock_mem,
|
|
242
|
+
_relaunch_sudo,
|
|
249
243
|
):
|
|
250
244
|
"""Test set() success path"""
|
|
251
245
|
result = self.tool.set(5)
|
|
@@ -266,21 +260,12 @@ class TestAmdTtmTool(unittest.TestCase):
|
|
|
266
260
|
self.assertFalse(result)
|
|
267
261
|
|
|
268
262
|
@mock.patch("os.path.exists", return_value=True)
|
|
269
|
-
@mock.patch("amd_debug.ttm.
|
|
270
|
-
@mock.patch("amd_debug.ttm.print_color")
|
|
271
|
-
def test_clear_not_root(self, mock_print, _mock_is_root, _mock_exists):
|
|
272
|
-
"""Test clear() when not root"""
|
|
273
|
-
result = self.tool.clear()
|
|
274
|
-
mock_print.assert_called_with("Root privileges required", "❌")
|
|
275
|
-
self.assertFalse(result)
|
|
276
|
-
|
|
277
|
-
@mock.patch("os.path.exists", return_value=True)
|
|
278
|
-
@mock.patch("amd_debug.ttm.is_root", return_value=True)
|
|
263
|
+
@mock.patch("amd_debug.ttm.relaunch_sudo", return_value=True)
|
|
279
264
|
@mock.patch("os.remove")
|
|
280
265
|
@mock.patch("amd_debug.ttm.print_color")
|
|
281
266
|
@mock.patch("amd_debug.ttm.maybe_reboot", return_value=True)
|
|
282
267
|
def test_clear_success(
|
|
283
|
-
self, _mock_reboot, mock_print, mock_remove,
|
|
268
|
+
self, _mock_reboot, mock_print, mock_remove, _mock_relaunch_sudo, _mock_exists
|
|
284
269
|
):
|
|
285
270
|
"""Test clear() success path"""
|
|
286
271
|
result = self.tool.clear()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|