[cfe-commits] r163357 - in /cfe/trunk/utils/analyzer: SATestAdd.py SATestBuild.py
Jordan Rose
jordan_rose at apple.com
Thu Sep 6 16:39:50 PDT 2012
Since we are doing a string comparison here anyway, can we just make the build modes have names? 'project', 'single-file', 'single-file-c++11'.
On Sep 6, 2012, at 16:30 , Anna Zaks <ganna at apple.com> wrote:
> Author: zaks
> Date: Thu Sep 6 18:30:27 2012
> New Revision: 163357
>
> URL: http://llvm.org/viewvc/llvm-project?rev=163357&view=rev
> Log:
> [analyzer] testing: add a build mode to allow C++11 testing.
>
> Modified:
> cfe/trunk/utils/analyzer/SATestAdd.py
> cfe/trunk/utils/analyzer/SATestBuild.py
>
> Modified: cfe/trunk/utils/analyzer/SATestAdd.py
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestAdd.py?rev=163357&r1=163356&r2=163357&view=diff
> ==============================================================================
> --- cfe/trunk/utils/analyzer/SATestAdd.py (original)
> +++ cfe/trunk/utils/analyzer/SATestAdd.py Thu Sep 6 18:30:27 2012
> @@ -33,7 +33,7 @@
> # Params:
> # Dir is the directory where the sources are.
> # ID is a short string used to identify a project.
> -def addNewProject(ID, IsScanBuild) :
> +def addNewProject(ID, BuildMode) :
> CurDir = os.path.abspath(os.curdir)
> Dir = SATestBuild.getProjectDir(ID)
> if not os.path.exists(Dir):
> @@ -41,7 +41,7 @@
> sys.exit(-1)
>
> # Build the project.
> - SATestBuild.testProject(ID, IsScanBuild, IsReferenceBuild=True, Dir=Dir)
> + SATestBuild.testProject(ID, BuildMode, IsReferenceBuild=True, Dir=Dir)
>
> # Add the project ID to the project map.
> ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile)
> @@ -57,7 +57,7 @@
> print >> sys.stdout, "Reference output has been regenerated."
> else:
> PMapWriter = csv.writer(PMapFile)
> - PMapWriter.writerow( (ID, int(IsScanBuild)) );
> + PMapWriter.writerow( (ID, int(BuildMode)) );
> print "The project map is updated: ", ProjectMapPath
> finally:
> PMapFile.close()
> @@ -69,12 +69,14 @@
> if len(sys.argv) < 2:
> print >> sys.stderr, 'Usage: ', sys.argv[0],\
> 'project_ID <mode>' \
> - 'mode - 0 for single file project; 1 for scan_build'
> + 'mode - 0 for single file project; ' \
> + '1 for scan_build; ' \
> + '2 for single file c++11 project'
> sys.exit(-1)
>
> - IsScanBuild = 1
> + BuildMode = 1
> if (len(sys.argv) >= 3):
> - IsScanBuild = int(sys.argv[2])
> - assert((IsScanBuild == 0) | (IsScanBuild == 1))
> + BuildMode = int(sys.argv[2])
> + assert((BuildMode == 0) | (BuildMode == 1) | (BuildMode == 2))
>
> - addNewProject(sys.argv[1], IsScanBuild)
> + addNewProject(sys.argv[1], BuildMode)
>
> Modified: cfe/trunk/utils/analyzer/SATestBuild.py
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=163357&r1=163356&r2=163357&view=diff
> ==============================================================================
> --- cfe/trunk/utils/analyzer/SATestBuild.py (original)
> +++ cfe/trunk/utils/analyzer/SATestBuild.py Thu Sep 6 18:30:27 2012
> @@ -241,7 +241,7 @@
> return False
>
> # Run analysis on a set of preprocessed files.
> -def runAnalyzePreprocessed(Dir, SBOutputDir):
> +def runAnalyzePreprocessed(Dir, SBOutputDir, Mode):
> if os.path.exists(os.path.join(Dir, BuildScript)):
> print "Error: The preprocessed files project should not contain %s" % \
> BuildScript
> @@ -250,6 +250,9 @@
> CmdPrefix = Clang + " -cc1 -analyze -analyzer-output=plist -w "
> CmdPrefix += "-analyzer-checker=" + Checkers +" -fcxx-exceptions -fblocks "
>
> + if (Mode == 2) :
> + CmdPrefix += "-std=c++11 "
> +
> PlistPath = os.path.join(Dir, SBOutputDir, "date")
> FailPath = os.path.join(PlistPath, "failures");
> os.makedirs(FailPath);
> @@ -287,7 +290,7 @@
> if Failed == False:
> os.remove(LogFile.name);
>
> -def buildProject(Dir, SBOutputDir, IsScanBuild, IsReferenceBuild):
> +def buildProject(Dir, SBOutputDir, ProjectBuildMode, IsReferenceBuild):
> TBegin = time.time()
>
> BuildLogPath = os.path.join(SBOutputDir, LogFolderName, BuildLogName)
> @@ -317,10 +320,10 @@
> try:
> runCleanupScript(Dir, PBuildLogFile)
>
> - if IsScanBuild:
> + if (ProjectBuildMode == 1):
> runScanBuild(Dir, SBOutputDir, PBuildLogFile)
> else:
> - runAnalyzePreprocessed(Dir, SBOutputDir)
> + runAnalyzePreprocessed(Dir, SBOutputDir, ProjectBuildMode)
>
> if IsReferenceBuild :
> runCleanupScript(Dir, PBuildLogFile)
> @@ -474,7 +477,7 @@
> print "Error: SVN update failed."
> sys.exit(-1)
>
> -def testProject(ID, IsScanBuild, IsReferenceBuild=False, Dir=None):
> +def testProject(ID, ProjectBuildMode, IsReferenceBuild=False, Dir=None):
> print " \n\n--- Building project %s" % (ID,)
>
> TBegin = time.time()
> @@ -488,7 +491,7 @@
> RelOutputDir = getSBOutputDirName(IsReferenceBuild)
> SBOutputDir = os.path.join(Dir, RelOutputDir)
>
> - buildProject(Dir, SBOutputDir, IsScanBuild, IsReferenceBuild)
> + buildProject(Dir, SBOutputDir, ProjectBuildMode, IsReferenceBuild)
>
> checkBuild(SBOutputDir)
>
> @@ -506,8 +509,9 @@
> if (len(I) != 2) :
> print "Error: Rows in the ProjectMapFile should have 3 entries."
> raise Exception()
> - if (not ((I[1] == "1") | (I[1] == "0"))):
> - print "Error: Second entry in the ProjectMapFile should be 0 or 1."
> + if (not ((I[1] == "0") | (I[1] == "1") | (I[1] == "2"))):
> + print "Error: Second entry in the ProjectMapFile should be 0" \
> + " (single file), 1 (project), or 2(single file c++11)."
> raise Exception()
>
> # When we are regenerating the reference results, we might need to
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list