Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PowerPC][test] Catch any exception when retrieving git revision #92004

Merged
merged 1 commit into from
May 14, 2024

Conversation

jakeegan
Copy link
Member

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.

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.
@jakeegan jakeegan requested review from nikic and daltenty May 13, 2024 17:34
@jakeegan jakeegan self-assigned this May 13, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 13, 2024

@llvm/pr-subscribers-backend-powerpc

Author: Jake Egan (jakeegan)

Changes

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 --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:

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@dtzSiFive dtzSiFive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jakeegan jakeegan merged commit d9db266 into llvm:main May 14, 2024
6 checks passed
@jakeegan jakeegan deleted the git_revision_except branch May 14, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants