diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-08-14 05:07:13 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-08-14 05:07:13 +0000 |
commit | 213ab86ee6d51a27ec87ed8320c6b8407dd25595 (patch) | |
tree | d235413022851caa5424eedb24980768fd1fddf8 /utils/lit | |
parent | 6b78ef3762d0b48ac4493e81599be7af1491f8a6 (diff) | |
download | external_llvm-213ab86ee6d51a27ec87ed8320c6b8407dd25595.zip external_llvm-213ab86ee6d51a27ec87ed8320c6b8407dd25595.tar.gz external_llvm-213ab86ee6d51a27ec87ed8320c6b8407dd25595.tar.bz2 |
[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
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/TestRunner.py | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index fb724c9..068e499 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -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=[]): |