[llvm] [lit] Add readfile substitution (PR #158441)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 09:21:29 PDT 2025


================
@@ -720,6 +720,23 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files):
     return std_fds
 
 
+def _expandLateSubstitutions(arguments, cwd):
+    for i, arg in enumerate(arguments):
+        if not isinstance(arg, str):
+            continue
+
+        def _replaceReadFile(match):
+            filePath = match.group(1)
+            if not os.path.isabs(filePath):
+                filePath = os.path.join(cwd, filePath)
+            with open(filePath) as fileHandle:
----------------
boomanaiden154 wrote:

To get this to be marked as a failure instead of unresolved we need to propagate it up as a `InternalShellError`. I've made the necessary modifications and added a test for this case. Please take a look.

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


More information about the llvm-commits mailing list