r316948 - [analyzer] [tests] Remove empty folders in reference results, do not store diffs.txt

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 12:40:34 PDT 2017


Author: george.karpenkov
Date: Mon Oct 30 12:40:33 2017
New Revision: 316948

URL: http://llvm.org/viewvc/llvm-project?rev=316948&view=rev
Log:
[analyzer] [tests] Remove empty folders in reference results, do not store diffs.txt

Storing diffs.txt is now redundant, as we simply dump the CmpRuns output
to stdout (it is saved in CI and tends to be small).
Not generating those files enables us to remove empty folders, which
confuse git, as it would not add them with reference results.

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

Modified: cfe/trunk/utils/analyzer/SATestBuild.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=316948&r1=316947&r2=316948&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestBuild.py (original)
+++ cfe/trunk/utils/analyzer/SATestBuild.py Mon Oct 30 12:40:33 2017
@@ -120,8 +120,6 @@ BuildLogName = "run_static_analyzer.log"
 # displayed when buildbot detects a build failure.
 NumOfFailuresInSummary = 10
 FailuresSummaryFileName = "failures.txt"
-# Summary of the result diffs.
-DiffsSummaryFileName = "diffs.txt"
 
 # The scan-build result directory.
 SBOutputDirName = "ScanBuildResults"
@@ -434,6 +432,16 @@ def CleanUpEmptyPlists(SBOutputDir):
             continue
 
 
+def CleanUpEmptyFolders(SBOutputDir):
+    """
+    Remove empty folders from results, as git would not store them.
+    """
+    Subfolders = glob.glob(SBOutputDir + "/*")
+    for Folder in Subfolders:
+        if not os.listdir(Folder):
+            os.removedirs(Folder)
+
+
 def checkBuild(SBOutputDir):
     """
     Given the scan-build output directory, checks if the build failed
@@ -446,6 +454,7 @@ def checkBuild(SBOutputDir):
     TotalFailed = len(Failures)
     if TotalFailed == 0:
         CleanUpEmptyPlists(SBOutputDir)
+        CleanUpEmptyFolders(SBOutputDir)
         Plists = glob.glob(SBOutputDir + "/*/*.plist")
         print "Number of bug reports (non-empty plist files) produced: %d" %\
             len(Plists)
@@ -519,9 +528,8 @@ def runCmpResults(Dir, Strictness=0):
         if Verbose == 1:
             print "  Comparing Results: %s %s" % (RefDir, NewDir)
 
-        DiffsPath = os.path.join(NewDir, DiffsSummaryFileName)
         PatchedSourceDirPath = os.path.join(Dir, PatchedSourceDirName)
-        Opts = CmpRuns.CmpOptions(DiffsPath, "", PatchedSourceDirPath)
+        Opts = CmpRuns.CmpOptions(rootA="", rootB=PatchedSourceDirPath)
         # Scan the results, delete empty plist files.
         NumDiffs, ReportsInRef, ReportsInNew = \
             CmpRuns.dumpScanBuildResultsDiff(RefDir, NewDir, Opts, False)

Modified: cfe/trunk/utils/analyzer/SATestUpdateDiffs.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestUpdateDiffs.py?rev=316948&r1=316947&r2=316948&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestUpdateDiffs.py (original)
+++ cfe/trunk/utils/analyzer/SATestUpdateDiffs.py Mon Oct 30 12:40:33 2017
@@ -54,22 +54,9 @@ def updateReferenceResults(ProjName, Pro
     # Clean up the generated difference results.
     SATestBuild.cleanupReferenceResults(RefResultsPath)
 
-    # Remove the created .diffs file before adding.
-    removeDiffsSummaryFiles(RefResultsPath)
-
     runCmd('git add "%s"' % (RefResultsPath,))
 
 
-def removeDiffsSummaryFiles(RefResultsPath):
-    """
-    Remove all auto-generated .diffs files in reference data.
-    """
-    for (Dirpath, Dirnames, Filenames) in os.walk(RefResultsPath):
-        if SATestBuild.DiffsSummaryFileName in Filenames:
-            runCmd("rm '%s'" % os.path.join(
-                Dirpath, SATestBuild.DiffsSummaryFileName))
-
-
 def main(argv):
     if len(argv) == 2 and argv[1] in ('-h', '--help'):
         print >> sys.stderr, "Update static analyzer reference results based "\




More information about the cfe-commits mailing list