[llvm] r187861 - [lit] Use newer StringIO class.
Daniel Dunbar
daniel at zuster.org
Tue Aug 6 20:24:20 PDT 2013
Author: ddunbar
Date: Tue Aug 6 22:24:20 2013
New Revision: 187861
URL: http://llvm.org/viewvc/llvm-project?rev=187861&view=rev
Log:
[lit] Use newer StringIO class.
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=187861&r1=187860&r2=187861&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Aug 6 22:24:20 2013
@@ -1,11 +1,13 @@
from __future__ import absolute_import
import os, signal, subprocess, sys
-import StringIO
-
+import re
import platform
import tempfile
+try:
+ from io import StringIO
+except ImportError:
+ from StringIO import StringIO
-import re
import lit.ShUtil as ShUtil
import lit.Test as Test
import lit.Util as Util
@@ -436,22 +438,22 @@ def parseIntegratedTestScript(test, norm
return script,isXFail,tmpBase,execdir
def formatTestOutput(status, out, err, exitCode, script):
- output = StringIO.StringIO()
- output.write("Script:\n")
- output.write("--\n")
- output.write('\n'.join(script))
- output.write("\n--\n")
- output.write("Exit Code: %r\n\n" % exitCode)
+ 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)
if out:
- output.write("Command Output (stdout):\n")
- output.write("--\n")
- output.write(out)
- output.write("--\n")
+ output.write(u"Command Output (stdout):\n")
+ output.write(u"--\n")
+ output.write(unicode(out))
+ output.write(u"--\n")
if err:
- output.write("Command Output (stderr):\n")
- output.write("--\n")
- output.write(err)
- output.write("--\n")
+ output.write(u"Command Output (stderr):\n")
+ output.write(u"--\n")
+ output.write(unicode(err))
+ output.write(u"--\n")
return (status, output.getvalue())
def executeShTest(test, litConfig, useExternalSh,
More information about the llvm-commits
mailing list