amd-debug-tools 0.2.3__tar.gz → 0.2.4__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.
Files changed (50) hide show
  1. {amd_debug_tools-0.2.3/src/amd_debug_tools.egg-info → amd_debug_tools-0.2.4}/PKG-INFO +1 -1
  2. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/__init__.py +1 -1
  3. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/bios.py +4 -2
  4. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/installer.py +4 -2
  5. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/prerequisites.py +3 -0
  6. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/pstate.py +5 -3
  7. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/s2idle.py +6 -4
  8. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/validator.py +4 -5
  9. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4/src/amd_debug_tools.egg-info}/PKG-INFO +1 -1
  10. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/launcher.py +0 -1
  11. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_bios.py +4 -4
  12. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_launcher.py +2 -1
  13. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_prerequisites.py +1 -2
  14. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_s2idle.py +3 -3
  15. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/LICENSE +0 -0
  16. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/README.md +0 -0
  17. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/pyproject.toml +0 -0
  18. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/setup.cfg +0 -0
  19. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/acpi.py +0 -0
  20. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/bash/amd-s2idle +0 -0
  21. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/battery.py +0 -0
  22. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/common.py +0 -0
  23. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/database.py +0 -0
  24. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/display.py +0 -0
  25. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/failures.py +0 -0
  26. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/kernel.py +0 -0
  27. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/s2idle-hook +0 -0
  28. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/sleep_report.py +0 -0
  29. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/templates/html +0 -0
  30. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/templates/md +0 -0
  31. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/templates/stdout +0 -0
  32. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/templates/txt +0 -0
  33. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug/wake.py +0 -0
  34. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug_tools.egg-info/SOURCES.txt +0 -0
  35. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug_tools.egg-info/dependency_links.txt +0 -0
  36. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug_tools.egg-info/entry_points.txt +0 -0
  37. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug_tools.egg-info/requires.txt +0 -0
  38. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/amd_debug_tools.egg-info/top_level.txt +0 -0
  39. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_acpi.py +0 -0
  40. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_batteries.py +0 -0
  41. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_common.py +0 -0
  42. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_database.py +0 -0
  43. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_display.py +0 -0
  44. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_failures.py +0 -0
  45. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_installer.py +0 -0
  46. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_kernel.py +0 -0
  47. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_pstate.py +0 -0
  48. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_sleep_report.py +0 -0
  49. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_validator.py +0 -0
  50. {amd_debug_tools-0.2.3 → amd_debug_tools-0.2.4}/src/test_wake.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amd-debug-tools
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -42,4 +42,4 @@ def launch_tool(tool_name):
42
42
  return tools[tool_name]()
43
43
  else:
44
44
  print(f"\033[91mUnknown exe: {tool_name}\033[0m")
45
- return False
45
+ return 1
@@ -122,7 +122,7 @@ def parse_args():
122
122
  return args
123
123
 
124
124
 
125
- def main():
125
+ def main() -> None|int:
126
126
  """Main function"""
127
127
  args = parse_args()
128
128
  ret = False
@@ -135,4 +135,6 @@ def main():
135
135
  elif args.command == "version":
136
136
  print(version())
137
137
  show_log_info()
138
- return ret
138
+ if ret is False:
139
+ return 1
140
+ return
@@ -446,7 +446,7 @@ def parse_args():
446
446
  return parser.parse_args()
447
447
 
448
448
 
449
- def install_dep_superset() -> bool:
449
+ def install_dep_superset() -> None|int:
450
450
  """Install all python supserset dependencies"""
451
451
  args = parse_args()
452
452
  tool = Installer(tool_debug=args.tool_debug)
@@ -465,4 +465,6 @@ def install_dep_superset() -> bool:
465
465
  if ret:
466
466
  print_color("All dependencies installed", "✅")
467
467
  show_log_info()
468
- return ret
468
+ if ret is False:
469
+ return 1
470
+ return
@@ -595,6 +595,9 @@ class PrerequisiteValidator(AmdTool):
595
595
  with open(target, "rb") as r:
596
596
  r.seek(0x70)
597
597
  found = struct.unpack("<I", r.read(4))[0] & BIT(21)
598
+ except FileNotFoundError:
599
+ self.db.record_prereq("FADT check unavailable", "🚦")
600
+ return True
598
601
  except PermissionError:
599
602
  self.db.record_prereq("FADT check unavailable", "🚦")
600
603
  return True
@@ -300,15 +300,17 @@ def parse_args():
300
300
  return parser.parse_args()
301
301
 
302
302
 
303
- def main():
303
+ def main() -> None|int:
304
304
  """Main function"""
305
305
  args = parse_args()
306
306
  ret = False
307
307
  if args.command == "version":
308
308
  print(version())
309
- return True
309
+ return
310
310
  elif args.command == "triage":
311
311
  triage = AmdPstateTriage(args.tool_debug)
312
312
  ret = triage.run()
313
313
  show_log_info()
314
- return ret
314
+ if ret is False:
315
+ return 1
316
+ return
@@ -120,7 +120,7 @@ def prompt_report_arguments(since, until, fname, fmt, report_debug) -> str:
120
120
  if report_debug is None:
121
121
  inp = (
122
122
  input(
123
- f"{Headers.ReportDebugDescription} ({colorize_choices(Defaults.boolean_choices, "true")})? "
123
+ f"{Headers.ReportDebugDescription} ({colorize_choices(Defaults.boolean_choices, 'true')})? "
124
124
  )
125
125
  .lower()
126
126
  .capitalize()
@@ -394,7 +394,7 @@ def parse_args():
394
394
  return parser.parse_args()
395
395
 
396
396
 
397
- def main():
397
+ def main() -> None|int:
398
398
  """Main function"""
399
399
  args = parse_args()
400
400
  ret = False
@@ -429,8 +429,10 @@ def main():
429
429
  )
430
430
  elif args.action == "version":
431
431
  print(version())
432
- return True
432
+ return
433
433
  else:
434
434
  sys.exit("no action specified")
435
435
  show_log_info()
436
- return ret
436
+ if ret is False:
437
+ return 1
438
+ return
@@ -443,11 +443,10 @@ class SleepValidator(AmdTool):
443
443
  """Check for hardware sleep state"""
444
444
  # try from kernel 6.4's suspend stats interface first because it works
445
445
  # even with kernel lockdown
446
- if not self.hw_sleep_duration:
447
- p = os.path.join("/", "sys", "power", "suspend_stats", "last_hw_sleep")
448
- if os.path.exists(p):
449
- self.hw_sleep_duration = int(read_file(p)) / 10**6
450
- if not self.hw_sleep_duration:
446
+ p = os.path.join("/", "sys", "power", "suspend_stats", "last_hw_sleep")
447
+ if os.path.exists(p):
448
+ self.hw_sleep_duration = int(read_file(p)) / 10**6
449
+ if not os.path.exists(p) and not self.hw_sleep_duration:
451
450
  p = os.path.join("/", "sys", "kernel", "debug", "amd_pmc", "smu_fw_info")
452
451
  try:
453
452
  val = read_file(p)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amd-debug-tools
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -28,7 +28,6 @@ def main():
28
28
  f"Missing dependency: {e}\n"
29
29
  f"Run ./install_deps.py to install dependencies."
30
30
  )
31
- return False
32
31
 
33
32
 
34
33
  if __name__ == "__main__":
@@ -194,7 +194,7 @@ class TestAmdBios(unittest.TestCase):
194
194
  mock_amd_bios.assert_called_once_with(None, True)
195
195
  mock_app.set_tracing.assert_called_once_with(True)
196
196
  mock_show_log_info.assert_called_once()
197
- self.assertTrue(result)
197
+ self.assertIsNone(result)
198
198
 
199
199
  @patch("amd_debug.bios.AmdBios")
200
200
  @patch("amd_debug.bios.parse_args")
@@ -217,7 +217,7 @@ class TestAmdBios(unittest.TestCase):
217
217
  mock_amd_bios.assert_called_once_with("test.log", True)
218
218
  mock_app.run.assert_called_once()
219
219
  mock_show_log_info.assert_called_once()
220
- self.assertTrue(result)
220
+ self.assertIsNone(result)
221
221
 
222
222
  @patch("amd_debug.bios.parse_args")
223
223
  @patch("amd_debug.bios.version")
@@ -235,7 +235,7 @@ class TestAmdBios(unittest.TestCase):
235
235
  mock_parse_args.assert_called_once()
236
236
  mock_version.assert_called_once()
237
237
  mock_show_log_info.assert_called_once()
238
- self.assertEqual(result, False)
238
+ self.assertEqual(result, 1)
239
239
 
240
240
  @patch("amd_debug.bios.parse_args")
241
241
  @patch("amd_debug.bios.show_log_info")
@@ -247,4 +247,4 @@ class TestAmdBios(unittest.TestCase):
247
247
 
248
248
  mock_parse_args.assert_called_once()
249
249
  mock_show_log_info.assert_called_once()
250
- self.assertFalse(result)
250
+ self.assertEqual(result, 1)
@@ -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"""
@@ -798,8 +798,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
798
798
  self.assertFalse(result)
799
799
  self.assertTrue(any(isinstance(f, FadtWrong) for f in self.validator.failures))
800
800
 
801
- @patch("amd_debug.prerequisites.os.path.exists", return_value=False)
802
- def test_check_fadt_file_not_found(self, mock_path_exists):
801
+ def test_check_fadt_file_not_found(self):
803
802
  """Test check_fadt when FADT file is not found"""
804
803
  self.mock_kernel_log.match_line.return_value = False
805
804
  result = self.validator.check_fadt()
@@ -180,7 +180,7 @@ class TestMainFunction(unittest.TestCase):
180
180
  mock_report.assert_called_once_with(
181
181
  "2023-01-01", "2023-02-01", None, "html", False, False
182
182
  )
183
- self.assertTrue(result)
183
+ self.assertIsNone(result)
184
184
 
185
185
  @patch("amd_debug.s2idle.relaunch_sudo")
186
186
  @patch("amd_debug.s2idle.run_test_cycle")
@@ -207,7 +207,7 @@ class TestMainFunction(unittest.TestCase):
207
207
  mock_test.assert_called_once_with(
208
208
  None, None, "5", "txt", None, False, False, False, False, False
209
209
  )
210
- self.assertTrue(result)
210
+ self.assertIsNone(result)
211
211
 
212
212
  @patch("amd_debug.s2idle.version")
213
213
  def test_main_version(self, mock_version):
@@ -220,7 +220,7 @@ class TestMainFunction(unittest.TestCase):
220
220
  result = main()
221
221
  mock_version.assert_called_once()
222
222
  mock_print.assert_called_once_with("1.0.0")
223
- self.assertTrue(result)
223
+ self.assertIsNone(result)
224
224
 
225
225
  def test_main_no_action(self):
226
226
  """Test main function with no action specified"""
File without changes