summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-11-08 22:41:22 +0000
committerAnna Zaks <ganna@apple.com>2011-11-08 22:41:22 +0000
commit86f14abc027676513aa7590fc254d22f279543d7 (patch)
tree0822d5d29b99df11c9035763cda3e4b2401eab69 /utils
parentaf9b5e9f3eede62347835d8dedd44df86cbcc308 (diff)
[analyzer] Testing: support for regenerate reference output
Change the flow of the SATestAdd so that it could be used for regenerating the reference output without exiting with an error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144141 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-xutils/analyzer/SATestAdd.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/utils/analyzer/SATestAdd.py b/utils/analyzer/SATestAdd.py
index ea3ec21d64..ce64bc82f7 100755
--- a/utils/analyzer/SATestAdd.py
+++ b/utils/analyzer/SATestAdd.py
@@ -22,6 +22,13 @@ import os
import csv
import sys
+def isExistingProject(PMapFile, projectID) :
+ PMapReader = csv.reader(PMapFile)
+ for I in PMapReader:
+ if projectID == I[0]:
+ return True
+ return False
+
# Add a new project for testing: build it and add to the Project Map file.
# Params:
# Dir is the directory where the sources are.
@@ -44,20 +51,16 @@ def addNewProject(ID, IsScanBuild) :
print "Warning: Creating the Project Map file!!"
PMapFile = open(ProjectMapPath, "w+b")
try:
- PMapReader = csv.reader(PMapFile)
- for I in PMapReader:
- IID = I[0]
- if ID == IID:
- print >> sys.stderr, 'Warning: Project with ID \'', ID, \
- '\' already exists.'
- sys.exit(-1)
-
- PMapWriter = csv.writer(PMapFile)
- PMapWriter.writerow( (ID, int(IsScanBuild)) );
+ if (isExistingProject(PMapFile, ID)) :
+ print >> sys.stdout, 'Warning: Project with ID \'', ID, \
+ '\' already exists.'
+ print >> sys.stdout, "Reference output has been regenerated."
+ else:
+ PMapWriter = csv.writer(PMapFile)
+ PMapWriter.writerow( (ID, int(IsScanBuild)) );
+ print "The project map is updated: ", ProjectMapPath
finally:
PMapFile.close()
-
- print "The project map is updated: ", ProjectMapPath
# TODO: Add an option not to build.