[llvm] b95f543 - [lit] [Windows] Print exit codes > 255 as hex too

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 02:10:56 PST 2022


Author: Martin Storsjö
Date: 2022-11-15T12:09:32+02:00
New Revision: b95f54350c85f535282cf2d8cd5c5925febb27f8

URL: https://github.com/llvm/llvm-project/commit/b95f54350c85f535282cf2d8cd5c5925febb27f8
DIFF: https://github.com/llvm/llvm-project/commit/b95f54350c85f535282cf2d8cd5c5925febb27f8.diff

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

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.

Differential Revision: https://reviews.llvm.org/D137771

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 664235beaae6b..f3499bb122d82 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -988,7 +988,7 @@ def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
         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)


        


More information about the llvm-commits mailing list