mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-25 13:35:10 +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 platform
|
||||
import tempfile
|
||||
try:
|
||||
from io import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
import lit.ShUtil as ShUtil
|
||||
import lit.Test as Test
|
||||
@ -445,23 +441,33 @@ def parseIntegratedTestScript(test, normalize_slashes=False,
|
||||
return script,isXFail,tmpBase,execdir
|
||||
|
||||
def formatTestOutput(status, out, err, exitCode, script):
|
||||
output = StringIO()
|
||||
output.write(u"Script:\n")
|
||||
output.write(u"--\n")
|
||||
output.write(u'\n'.join(script))
|
||||
output.write(u"\n--\n")
|
||||
output.write(u"Exit Code: %r\n\n" % exitCode)
|
||||
output = """\
|
||||
Script:
|
||||
--
|
||||
%s
|
||||
--
|
||||
Exit Code: %d
|
||||
|
||||
""" % ('\n'.join(script), exitCode)
|
||||
|
||||
# Append the stdout, if present.
|
||||
if out:
|
||||
output.write(u"Command Output (stdout):\n")
|
||||
output.write(u"--\n")
|
||||
output.write(unicode(out))
|
||||
output.write(u"--\n")
|
||||
output += """\
|
||||
Command Output (stdout):
|
||||
--
|
||||
%s
|
||||
--
|
||||
""" % (out,)
|
||||
|
||||
# Append the stderr, if present.
|
||||
if err:
|
||||
output.write(u"Command Output (stderr):\n")
|
||||
output.write(u"--\n")
|
||||
output.write(unicode(err))
|
||||
output.write(u"--\n")
|
||||
return (status, output.getvalue())
|
||||
output += """\
|
||||
Command Output (stderr):
|
||||
--
|
||||
%s
|
||||
--
|
||||
""" % (err,)
|
||||
return (status, output)
|
||||
|
||||
def executeShTest(test, litConfig, useExternalSh,
|
||||
extra_substitutions=[]):
|
||||
|
Loading…
Reference in New Issue
Block a user