mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-13 07:50:50 +00:00
[lit] Avoid StringIO.
- We barely used it, and it is very hard to use in a 2.5-3 compatible way because of changing expectations for its input types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6b78ef3762
commit
213ab86ee6
@ -3,10 +3,6 @@ import os, signal, subprocess, sys
|
|||||||
import re
|
import re
|
||||||
import platform
|
import platform
|
||||||
import tempfile
|
import tempfile
|
||||||
try:
|
|
||||||
from io import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from StringIO import StringIO
|
|
||||||
|
|
||||||
import lit.ShUtil as ShUtil
|
import lit.ShUtil as ShUtil
|
||||||
import lit.Test as Test
|
import lit.Test as Test
|
||||||
@ -445,23 +441,33 @@ def parseIntegratedTestScript(test, normalize_slashes=False,
|
|||||||
return script,isXFail,tmpBase,execdir
|
return script,isXFail,tmpBase,execdir
|
||||||
|
|
||||||
def formatTestOutput(status, out, err, exitCode, script):
|
def formatTestOutput(status, out, err, exitCode, script):
|
||||||
output = StringIO()
|
output = """\
|
||||||
output.write(u"Script:\n")
|
Script:
|
||||||
output.write(u"--\n")
|
--
|
||||||
output.write(u'\n'.join(script))
|
%s
|
||||||
output.write(u"\n--\n")
|
--
|
||||||
output.write(u"Exit Code: %r\n\n" % exitCode)
|
Exit Code: %d
|
||||||
|
|
||||||
|
""" % ('\n'.join(script), exitCode)
|
||||||
|
|
||||||
|
# Append the stdout, if present.
|
||||||
if out:
|
if out:
|
||||||
output.write(u"Command Output (stdout):\n")
|
output += """\
|
||||||
output.write(u"--\n")
|
Command Output (stdout):
|
||||||
output.write(unicode(out))
|
--
|
||||||
output.write(u"--\n")
|
%s
|
||||||
|
--
|
||||||
|
""" % (out,)
|
||||||
|
|
||||||
|
# Append the stderr, if present.
|
||||||
if err:
|
if err:
|
||||||
output.write(u"Command Output (stderr):\n")
|
output += """\
|
||||||
output.write(u"--\n")
|
Command Output (stderr):
|
||||||
output.write(unicode(err))
|
--
|
||||||
output.write(u"--\n")
|
%s
|
||||||
return (status, output.getvalue())
|
--
|
||||||
|
""" % (err,)
|
||||||
|
return (status, output)
|
||||||
|
|
||||||
def executeShTest(test, litConfig, useExternalSh,
|
def executeShTest(test, litConfig, useExternalSh,
|
||||||
extra_substitutions=[]):
|
extra_substitutions=[]):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user