[llvm] [lit] Clean up internal shell parse errors with ScriptFatal (PR #68496)

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 17:19:36 PDT 2023


================
@@ -1009,7 +1020,8 @@ def formatOutput(title, data, limit=None):
     return out
 
 
-# Normally returns out, err, exitCode, timeoutInfo.
+# Always either returns the tuple (out, err, exitCode, timeoutInfo) or raises a
----------------
jdenny-ornl wrote:

Thanks for the suggestion.  Are you thinking of something like the following?

```
def executeScriptInternal(
    test, litConfig, tmpBase, commands, cwd, debug=True
) -> typing.Tuple[str, str, int, str | None]:
```

I tried running mypy to check this, and it complained:

```
llvm/utils/lit/lit/TestRunner.py:1035: error: X | Y syntax for unions requires Python 3.10  [syntax]
```

However, [LLVM requires only python 3.6](https://llvm.org/docs/GettingStarted.html#software) currently.

Also, is there a way to provide names/descriptions for the tuple members?  Is there a way to specify exceptions?  I couldn't find a syntax for either.

Assuming the above limitations, it looks like the comment would be useful anyway.  I'm not experienced with type annotations in python.  Please let me know if I'm doing something wrong.

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


More information about the llvm-commits mailing list