r326295 - [analyzer] [tests] Write to logfile instead of stdout while updating

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 17:55:23 PST 2018


Author: george.karpenkov
Date: Tue Feb 27 17:55:23 2018
New Revision: 326295

URL: http://llvm.org/viewvc/llvm-project?rev=326295&view=rev
Log:
[analyzer] [tests] Write to logfile instead of stdout while updating

reference results

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

Modified: cfe/trunk/utils/analyzer/SATestUpdateDiffs.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestUpdateDiffs.py?rev=326295&r1=326294&r2=326295&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestUpdateDiffs.py (original)
+++ cfe/trunk/utils/analyzer/SATestUpdateDiffs.py Tue Feb 27 17:55:23 2018
@@ -13,10 +13,10 @@ import sys
 Verbose = 1
 
 
-def runCmd(Command):
+def runCmd(Command, **kwargs):
     if Verbose:
         print "Executing %s" % Command
-    check_call(Command, shell=True)
+    check_call(Command, shell=True, **kwargs)
 
 
 def updateReferenceResults(ProjName, ProjBuildMode):
@@ -34,27 +34,28 @@ def updateReferenceResults(ProjName, Pro
                              "previously run?"
         sys.exit(1)
 
-    # Remove reference results: in git, and then again for a good measure
-    # with rm, as git might not remove things fully if there are empty
-    # directories involved.
-    runCmd('git rm -r -q "%s"' % (RefResultsPath,))
-    runCmd('rm -rf "%s"' % (RefResultsPath,))
-
-    # Replace reference results with a freshly computed once.
-    runCmd('cp -r "%s" "%s"' % (CreatedResultsPath, RefResultsPath,))
-
-    # Run cleanup script.
     BuildLogPath = SATestBuild.getBuildLogPath(RefResultsPath)
     with open(BuildLogPath, "wb+") as PBuildLogFile:
+        # Remove reference results: in git, and then again for a good measure
+        # with rm, as git might not remove things fully if there are empty
+        # directories involved.
+        runCmd('git rm -r -q "%s"' % (RefResultsPath,), stdout=PBuildLogFile)
+        runCmd('rm -rf "%s"' % (RefResultsPath,), stdout=PBuildLogFile)
+
+        # Replace reference results with a freshly computed once.
+        runCmd('cp -r "%s" "%s"' % (CreatedResultsPath, RefResultsPath,),
+               stdout=PBuildLogFile)
+
+        # Run cleanup script.
         SATestBuild.runCleanupScript(ProjDir, PBuildLogFile)
 
-    SATestBuild.normalizeReferenceResults(
-        ProjDir, RefResultsPath, ProjBuildMode)
+        SATestBuild.normalizeReferenceResults(
+            ProjDir, RefResultsPath, ProjBuildMode)
 
-    # Clean up the generated difference results.
-    SATestBuild.cleanupReferenceResults(RefResultsPath)
+        # Clean up the generated difference results.
+        SATestBuild.cleanupReferenceResults(RefResultsPath)
 
-    runCmd('git add "%s"' % (RefResultsPath,))
+        runCmd('git add "%s"' % (RefResultsPath,), stdout=PBuildLogFile)
 
 
 def main(argv):




More information about the cfe-commits mailing list