[llvm] [PowerPC][test] Catch any exception when retrieving git revision (PR #92004)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 10:35:38 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-powerpc

Author: Jake Egan (jakeegan)

<details>
<summary>Changes</summary>

This makes the `vc-rev-enabled` feature unsupported if we fail to retrieve the git revision for any reason, such as if git is not installed.

---
Full diff: https://github.com/llvm/llvm-project/pull/92004.diff


1 Files Affected:

- (modified) llvm/test/CodeGen/PowerPC/lit.local.cfg (+2-2) 


``````````diff
diff --git a/llvm/test/CodeGen/PowerPC/lit.local.cfg b/llvm/test/CodeGen/PowerPC/lit.local.cfg
index 4cc802afef4a0..e56ce48eff401 100644
--- a/llvm/test/CodeGen/PowerPC/lit.local.cfg
+++ b/llvm/test/CodeGen/PowerPC/lit.local.cfg
@@ -9,8 +9,8 @@ def get_revision(repo_path):
     cmd = ['git', '-C', repo_path, 'rev-parse', 'HEAD']
     try:
         return subprocess.run(cmd, stdout=subprocess.PIPE, check=True).stdout.decode()
-    except subprocess.CalledProcessError:
-        print("An error occurred retrieving the git revision.")
+    except Exception as e:
+        print("An error occurred retrieving the git revision:", e)
         return None
 
 if config.have_vc_rev:

``````````

</details>


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


More information about the llvm-commits mailing list