[llvm] r286150 - [lit] Print negative exit codes on Windows in hex

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 13:06:21 PST 2016


Author: rnk
Date: Mon Nov  7 15:06:20 2016
New Revision: 286150

URL: http://llvm.org/viewvc/llvm-project?rev=286150&view=rev
Log:
[lit] Print negative exit codes on Windows in hex

Negative exit codes are usually exceptions. They're easier to recognize
in hex. Compare -1073741502 to 0xc0000142.

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

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=286150&r1=286149&r2=286150&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Mon Nov  7 15:06:20 2016
@@ -555,8 +555,14 @@ def executeScriptInternal(test, litConfi
 
         # Show the error conditions:
         if result.exitCode != 0:
-            out += "error: command failed with exit status: %d\n" % (
-                result.exitCode,)
+            # 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:
+                codeStr = hex(int(result.exitCode & 0xFFFFFFFF)).rstrip("L")
+            else:
+                codeStr = str(result.exitCode)
+            out += "error: command failed with exit status: %s\n" % (
+                codeStr,)
         if litConfig.maxIndividualTestTime > 0:
             out += 'error: command reached timeout: %s\n' % (
                 str(result.timeoutReached),)




More information about the llvm-commits mailing list