[llvm] [llvm-lit] Fix Unhashable TypeError when using lit's internal shell (PR #101590)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 10:03:06 PDT 2024
https://github.com/Harini0924 updated https://github.com/llvm/llvm-project/pull/101590
>From f7aab483320e92d4acf52a7035553e6766034f43 Mon Sep 17 00:00:00 2001
From: Harini <harinidonthula at google.com>
Date: Wed, 31 Jul 2024 20:44:28 +0000
Subject: [PATCH] [llvm-lit] Unhashable type Support
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.
---
llvm/utils/lit/lit/TestRunner.py | 7 +++++++
1 file changed, 7 insertions(+)
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
More information about the llvm-commits
mailing list