amd-debug-tools 0.2.14__tar.gz → 0.2.15__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 (69) hide show
  1. {amd_debug_tools-0.2.14/src/amd_debug_tools.egg-info → amd_debug_tools-0.2.15}/PKG-INFO +1 -1
  2. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/common.py +13 -1
  3. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/prerequisites.py +5 -2
  4. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/s2idle.py +12 -6
  5. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15/src/amd_debug_tools.egg-info}/PKG-INFO +1 -1
  6. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_s2idle.py +7 -4
  7. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/.github/workflows/ci.yml +0 -0
  8. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/.github/workflows/mirror.yml +0 -0
  9. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/.gitignore +0 -0
  10. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/.pre-commit-config.yaml +0 -0
  11. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/.vscode/settings.json +0 -0
  12. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/LICENSE +0 -0
  13. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/Makefile +0 -0
  14. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/README.md +0 -0
  15. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/amd_bios.py +0 -0
  16. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/amd_pstate.py +0 -0
  17. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/amd_s2idle.py +0 -0
  18. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/amd_ttm.py +0 -0
  19. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/docs/amd-bios.md +0 -0
  20. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/docs/amd-pstate.md +0 -0
  21. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/docs/amd-s2idle.md +0 -0
  22. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/docs/amd-ttm.md +0 -0
  23. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/docs/in-tree.md +0 -0
  24. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/install_deps.py +0 -0
  25. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/psr.py +0 -0
  26. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/pyproject.toml +0 -0
  27. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/setup.cfg +0 -0
  28. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/__init__.py +0 -0
  29. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/acpi.py +0 -0
  30. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/bash/amd-s2idle +0 -0
  31. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/battery.py +0 -0
  32. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/bios.py +0 -0
  33. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/database.py +0 -0
  34. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/display.py +0 -0
  35. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/failures.py +0 -0
  36. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/installer.py +0 -0
  37. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/kernel.py +0 -0
  38. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/pstate.py +0 -0
  39. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/s2idle-hook +0 -0
  40. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/sleep_report.py +0 -0
  41. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/templates/html +0 -0
  42. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/templates/md +0 -0
  43. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/templates/stdout +0 -0
  44. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/templates/txt +0 -0
  45. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/ttm.py +0 -0
  46. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/validator.py +0 -0
  47. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug/wake.py +0 -0
  48. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug_tools.egg-info/SOURCES.txt +0 -0
  49. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug_tools.egg-info/dependency_links.txt +0 -0
  50. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug_tools.egg-info/entry_points.txt +0 -0
  51. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug_tools.egg-info/requires.txt +0 -0
  52. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/amd_debug_tools.egg-info/top_level.txt +0 -0
  53. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/launcher.py +0 -0
  54. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_acpi.py +0 -0
  55. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_batteries.py +0 -0
  56. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_bios.py +0 -0
  57. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_common.py +0 -0
  58. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_database.py +0 -0
  59. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_display.py +0 -0
  60. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_failures.py +0 -0
  61. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_installer.py +0 -0
  62. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_kernel.py +0 -0
  63. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_launcher.py +0 -0
  64. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_prerequisites.py +0 -0
  65. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_pstate.py +0 -0
  66. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_sleep_report.py +0 -0
  67. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_ttm.py +0 -0
  68. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/src/test_validator.py +0 -0
  69. {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.15}/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.14
3
+ Version: 0.2.15
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -382,7 +382,19 @@ def relaunch_sudo() -> None:
382
382
  """Relaunch the script with sudo if not already running as root"""
383
383
  if not is_root():
384
384
  logging.debug("Relaunching with sudo")
385
- os.execvp("sudo", ["sudo", "-E"] + sys.argv)
385
+ env_vars = []
386
+ for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
387
+ "DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
388
+ value = os.environ.get(var)
389
+ if value:
390
+ env_vars.append(f"{var}={value}")
391
+
392
+ if env_vars:
393
+ sudo_cmd = ["sudo"] + [f"--preserve-env={var.split('=')[0]}" for var in env_vars] + sys.argv
394
+ else:
395
+ sudo_cmd = ["sudo"] + sys.argv
396
+
397
+ os.execvp("sudo", sudo_cmd)
386
398
 
387
399
 
388
400
  def running_ssh():
@@ -353,8 +353,11 @@ class PrerequisiteValidator(AmdTool):
353
353
  self.failures += [MissingDriver(slot)]
354
354
  return False
355
355
  p = os.path.join(device.sys_path, "fw_version")
356
- xdna_fw_version = read_file(p)
357
- self.db.record_prereq(f"NPU loaded with firmware {xdna_fw_version}", "✅")
356
+ if os.path.exists(p):
357
+ xdna_fw_version = read_file(p)
358
+ self.db.record_prereq(
359
+ f"NPU loaded with firmware {xdna_fw_version}", "✅"
360
+ )
358
361
  return True
359
362
 
360
363
  def check_amd_hsmp(self):
@@ -60,14 +60,20 @@ def display_report_file(fname, fmt) -> None:
60
60
  return
61
61
  user = os.environ.get("SUDO_USER")
62
62
  if user:
63
- # ensure that xdg tools will know how to display the file
64
- # (user may need to call tool with sudo -E)
65
- if os.environ.get("XDG_SESSION_TYPE"):
66
- subprocess.call(["sudo", "-E", "-u", user, "xdg-open", fname])
63
+ env_vars = []
64
+ for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
65
+ "DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
66
+ value = os.environ.get(var)
67
+ if value:
68
+ env_vars.append(f"{var}={value}")
69
+
70
+ if env_vars:
71
+ cmd = ["sudo", "-u", user] + [f"env"] + env_vars + ["xdg-open", fname]
72
+ subprocess.call(cmd)
67
73
  else:
68
74
  print(
69
- "To display report automatically in browser launch tool "
70
- f"with '-E' argument (Example: sudo -E {sys.argv[0]})"
75
+ "Unable to detect graphical session environment. "
76
+ "Report saved to: " + fname
71
77
  )
72
78
 
73
79
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amd-debug-tools
3
- Version: 0.2.14
3
+ Version: 0.2.15
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -614,10 +614,13 @@ class TestDisplayReportFile(unittest.TestCase):
614
614
  display_report_file("report.html", "html")
615
615
  mock_is_root.assert_called_once()
616
616
  mock_env_get.assert_any_call("SUDO_USER")
617
- mock_env_get.assert_any_call("XDG_SESSION_TYPE")
618
- mock_subprocess_call.assert_called_once_with(
619
- ["sudo", "-E", "-u", "testuser", "xdg-open", "report.html"]
620
- )
617
+ call_args = mock_subprocess_call.call_args[0][0]
618
+ assert call_args[0] == "sudo"
619
+ assert call_args[1] == "-u"
620
+ assert call_args[2] == "testuser"
621
+ assert call_args[3] == "env"
622
+ assert "xdg-open" in call_args
623
+ assert "report.html" in call_args
621
624
 
622
625
  @patch("amd_debug.s2idle.is_root", return_value=True)
623
626
  @patch("os.environ.get", side_effect=lambda key: None)