r314960 - [Analyzer Tests] Fix misc bugs in analyzer reference results updater.
George Karpenkov via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 4 18:02:20 PDT 2017
Author: george.karpenkov
Date: Wed Oct 4 18:02:20 2017
New Revision: 314960
URL: http://llvm.org/viewvc/llvm-project?rev=314960&view=rev
Log:
[Analyzer Tests] Fix misc bugs in analyzer reference results updater.
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=314960&r1=314959&r2=314960&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestUpdateDiffs.py (original)
+++ cfe/trunk/utils/analyzer/SATestUpdateDiffs.py Wed Oct 4 18:02:20 2017
@@ -34,8 +34,11 @@ def updateReferenceResults(ProjName, Pro
"previously run?"
sys.exit(-1)
- # Remove reference results.
- runCmd('git rm -r "%s"' % (RefResultsPath,))
+ # 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,))
@@ -52,12 +55,21 @@ def updateReferenceResults(ProjName, Pro
SATestBuild.cleanupReferenceResults(RefResultsPath)
# Remove the created .diffs file before adding.
- runCmd('rm -f "%s/*/%s"' % (
- RefResultsPath, SATestBuild.DiffsSummaryFileName))
+ 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