From 14b08acb1efa7f32f24feb0dd31ddf3d2207db8a Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Mon, 7 Nov 2016 21:06:20 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286150 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/lit/lit/TestRunner.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index b242f8fb021..8e780a2f971 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -555,8 +555,14 @@ def executeScriptInternal(test, litConfig, tmpBase, commands, cwd): # 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),) -- 2.40.0