[llvm] [llvm] Add support for running tests as root (PR #75285)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 14:29:15 PST 2023


================
@@ -13,6 +14,18 @@
 lit_path_displayed = False
 
 
+def user_is_root():
+    # getpass.getuser() can throw an exception in some cases:
+    # See https://github.com/python/cpython/issues/76912
+    try:
+        if getpass.getuser() == "root":
----------------
MaskRay wrote:

*NIX systems can use `os.getuid == 0`

https://github.com/llvm/llvm-project/pull/75285


More information about the llvm-commits mailing list