[llvm] [llvm-lit] Unhashable TypeError Support (PR #101590)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 17:23:22 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: None (Harini0924)
<details>
<summary>Changes</summary>
Used expand_glob_expressions to resolve all GlobItem instances in args list to their acutal paths. Checked and converted args[0] if it is a Glob instance and ensured the resolved path is a string (hashable) before using it as a key in the inproc_builtins dictionary. To sum everything, this patch eliminates the 'unhashable type: GlobItem' error.
---
Full diff: https://github.com/llvm/llvm-project/pull/101590.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/TestRunner.py (+7)
``````````diff
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index da7fa86fd3917..ca8028f380ae8 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -767,6 +767,13 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
# echo-appending to a file.
# FIXME: Standardize on the builtin echo implementation. We can use a
# temporary file to sidestep blocking pipe write issues.
+
+ # Ensure args[0] is hashable before using it in inproc_builtins
+ if isinstance(args[0], GlobItem):
+ expanded_args = expand_glob(args[0], cmd_shenv.cwd)
+ if expanded_args:
+ args[0] = expanded_args[0]
+
inproc_builtin = inproc_builtins.get(args[0], None)
if inproc_builtin and (args[0] != "echo" or len(cmd.commands) == 1):
# env calling an in-process builtin is useless, so we take the safe
``````````
</details>
https://github.com/llvm/llvm-project/pull/101590
More information about the llvm-commits
mailing list