[PATCH] D137771: [lit] [Windows] Print exit codes > 255 as hex too

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 01:41:52 PST 2022


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
Herald added a subscriber: delcypher.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

891bb4872c8098f8a851a92e989af3252b46f5ad made negative exit codes
be printed as hex, which makes it easier to recognize e.g.
0xC0000005 instead of -1073741819. However, current Python versions
(at least the ones I'm using) seem to end up with positive unsigned
return codes, so that again ends up printed as 3221225477.

Print any return code over 255 as a hexadecimal number instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137771

Files:
  llvm/utils/lit/lit/TestRunner.py


Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -988,7 +988,7 @@
         if result.exitCode != 0:
             # On Windows, a negative exit code indicates a signal, and those are
             # easier to recognize or look up if we print them in hex.
-            if litConfig.isWindows and result.exitCode < 0:
+            if litConfig.isWindows and (result.exitCode < 0 or result.exitCode > 255):
                 codeStr = hex(int(result.exitCode & 0xFFFFFFFF)).rstrip("L")
             else:
                 codeStr = str(result.exitCode)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137771.474476.patch
Type: text/x-patch
Size: 683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221110/a1a1a57a/attachment.bin>


More information about the llvm-commits mailing list