[analyzer] [tests] Test different projects concurrently
Differential Revision: https://reviews.llvm.org/D43031
llvm-svn: 324652
diff --git a/clang/utils/analyzer/SATestUtils.py b/clang/utils/analyzer/SATestUtils.py
index 9220acc..2320652 100644
--- a/clang/utils/analyzer/SATestUtils.py
+++ b/clang/utils/analyzer/SATestUtils.py
@@ -37,18 +37,6 @@
return None
-class flushfile(object):
- """
- Wrapper to flush the output after every print statement.
- """
- def __init__(self, f):
- self.f = f
-
- def write(self, x):
- self.f.write(x)
- self.f.flush()
-
-
def hasNoExtension(FileName):
(Root, Ext) = os.path.splitext(FileName)
return (Ext == "")
@@ -71,14 +59,15 @@
return check_output(Cmd, shell=True).rstrip()
-def runScript(ScriptPath, PBuildLogFile, Cwd):
+def runScript(ScriptPath, PBuildLogFile, Cwd, Stdout=sys.stdout,
+ Stderr=sys.stderr):
"""
Run the provided script if it exists.
"""
if os.path.exists(ScriptPath):
try:
if Verbose == 1:
- print " Executing: %s" % (ScriptPath,)
+ Stdout.write(" Executing: %s\n" % (ScriptPath,))
check_call("chmod +x '%s'" % ScriptPath, cwd=Cwd,
stderr=PBuildLogFile,
stdout=PBuildLogFile,
@@ -88,8 +77,8 @@
stdout=PBuildLogFile,
shell=True)
except:
- print "Error: Running %s failed. See %s for details." % (
- ScriptPath, PBuildLogFile.name)
+ Stderr.write("Error: Running %s failed. See %s for details.\n" % (
+ ScriptPath, PBuildLogFile.name))
sys.exit(-1)