diff options
author | Anna Zaks <ganna@apple.com> | 2011-11-08 22:41:22 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-11-08 22:41:22 +0000 |
commit | a1b56e2aa3b08b02b14ceb721d9d5f6e66c7be16 (patch) | |
tree | d1e9978adb7a83ce93f06eaa79a409f32d5bdbd6 /clang/utils/analyzer/SATestAdd.py | |
parent | d5edb3847a39dce9938a4dd295b115792b0ca44e (diff) | |
download | bcm5719-llvm-a1b56e2aa3b08b02b14ceb721d9d5f6e66c7be16.tar.gz bcm5719-llvm-a1b56e2aa3b08b02b14ceb721d9d5f6e66c7be16.zip |
[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.
llvm-svn: 144141
Diffstat (limited to 'clang/utils/analyzer/SATestAdd.py')
-rwxr-xr-x | clang/utils/analyzer/SATestAdd.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/clang/utils/analyzer/SATestAdd.py b/clang/utils/analyzer/SATestAdd.py index ea3ec21d642..ce64bc82f75 100755 --- a/clang/utils/analyzer/SATestAdd.py +++ b/clang/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. |