r316806 - [Analyzer] [Tests] Dump the output of scan-build to stdout on failure.

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 15:39:54 PDT 2017


Author: george.karpenkov
Date: Fri Oct 27 15:39:54 2017
New Revision: 316806

URL: http://llvm.org/viewvc/llvm-project?rev=316806&view=rev
Log:
[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.

Eliminates extra lookup step during debugging.

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=316806&r1=316805&r2=316806&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestBuild.py (original)
+++ cfe/trunk/utils/analyzer/SATestBuild.py Fri Oct 27 15:39:54 2017
@@ -272,10 +272,11 @@ def runScanBuild(Dir, SBOutputDir, PBuil
                        stderr=PBuildLogFile,
                        stdout=PBuildLogFile,
                        shell=True)
-    except:
-        print "Error: scan-build failed. See ", PBuildLogFile.name,\
-              " for details."
-        raise
+    except CalledProcessError:
+        print "Error: scan-build failed. Its output was: "
+        PBuildLogFile.seek(0)
+        shutil.copyfileobj(PBuildLogFile, sys.stdout)
+        sys.exit(1)
 
 
 def runAnalyzePreprocessed(Dir, SBOutputDir, Mode):
@@ -373,7 +374,7 @@ def buildProject(Dir, SBOutputDir, Proje
     os.makedirs(os.path.join(SBOutputDir, LogFolderName))
 
     # Build and analyze the project.
-    with open(BuildLogPath, "wb+") as PBuildLogFile:
+    with open(BuildLogPath, "r+b") as PBuildLogFile:
         if (ProjectBuildMode == 1):
             downloadAndPatch(Dir, PBuildLogFile)
             runCleanupScript(Dir, PBuildLogFile)




More information about the cfe-commits mailing list