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

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


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

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.

>From 735e54eb2d16d0b472d078d9d8875bd00ec5f9fc Mon Sep 17 00:00:00 2001
From: Jake Egan <Jake.egan at ibm.com>
Date: Mon, 13 May 2024 13:34:01 -0400
Subject: [PATCH] [PowerPC][test] Catch any exception when retrieving git
 revision

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.
---
 llvm/test/CodeGen/PowerPC/lit.local.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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:



More information about the llvm-commits mailing list