[cfe-commits] r147862 - /cfe/trunk/utils/analyzer/SATestBuild.py

Anna Zaks ganna at apple.com
Tue Jan 10 10:10:26 PST 2012


Author: zaks
Date: Tue Jan 10 12:10:25 2012
New Revision: 147862

URL: http://llvm.org/viewvc/llvm-project?rev=147862&view=rev
Log:
[analyzer] Testing infrastructure: Flush output after every print
statement.

Modified:
    cfe/trunk/utils/analyzer/SATestBuild.py

Modified: cfe/trunk/utils/analyzer/SATestBuild.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=147862&r1=147861&r2=147862&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestBuild.py (original)
+++ cfe/trunk/utils/analyzer/SATestBuild.py Tue Jan 10 12:10:25 2012
@@ -78,6 +78,16 @@
 
 IsReferenceBuild = False
 
+# Make sure we flush the output after every print statement.
+class flushfile(object):
+    def __init__(self, f):
+        self.f = f
+    def write(self, x):
+        self.f.write(x)
+        self.f.flush()
+
+sys.stdout = flushfile(sys.stdout)
+
 def getProjectMapPath():
     ProjectMapPath = os.path.join(os.path.abspath(os.curdir), 
                                   ProjectMapFile)
@@ -397,7 +407,6 @@
                 print "Error: Second entry in the ProjectMapFile should be 0 or 1."
                 raise Exception()              
             testProject(I[0], InIsReferenceBuild, int(I[1]))
-            sys.stdout.flush()
     except:
         print "Error occurred. Premature termination."
         raise                            





More information about the cfe-commits mailing list