From: Anna Zaks Date: Wed, 2 Nov 2011 20:46:50 +0000 (+0000) Subject: [analyzer] Tweak the test script X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5fa3f1309b27d2f117dfd10a45a8642b7d4baae9;p=clang [analyzer] Tweak the test script Rename the pre_run_static_analyzer script into cleanup_run_static_analyzer and use it to clean up after the reference build - which is done as part of adding a new project to the system. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143568 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/analyzer/SATestBuild.py b/utils/analyzer/SATestBuild.py index c2209cc93c..e6527eedc5 100644 --- a/utils/analyzer/SATestBuild.py +++ b/utils/analyzer/SATestBuild.py @@ -29,7 +29,7 @@ The files which should be kept around for failure investigations: Assumptions (TODO: shouldn't need to assume these.): The script is being run from the Repository Directory. - The compiler for scan-build is in the PATH. + The compiler for scan-build and scan-build are in the PATH. export PATH=/Users/zaks/workspace/c2llvm/build/Release+Asserts/bin:$PATH For more logging, set the env variables: @@ -52,7 +52,7 @@ ProjectMapFile = "projectMap.csv" # Names of the project specific scripts. # The script that needs to be executed before the build can start. -PreprocessScript = "pre_run_static_analyzer.sh" +CleanupScript = "cleanup_run_static_analyzer.sh" # This is a file containing commands for scan-build. BuildScript = "run_static_analyzer.cmd" @@ -84,8 +84,8 @@ def getProjectDir(ID): return os.path.join(os.path.abspath(os.curdir), ID) # Run pre-processing script if any. -def runPreProcessingScript(Dir, PBuildLogFile): - ScriptPath = os.path.join(Dir, PreprocessScript) +def runCleanupScript(Dir, PBuildLogFile): + ScriptPath = os.path.join(Dir, CleanupScript) if os.path.exists(ScriptPath): try: if Verbose == 1: @@ -126,7 +126,7 @@ def runScanBuild(Dir, SBOutputDir, PBuildLogFile): " for details." sys.exit(-1) -def buildProject(Dir, SBOutputDir): +def buildProject(Dir, SBOutputDir, ClenupAfterBuild): TBegin = time.time() BuildLogPath = os.path.join(Dir, BuildLogName) @@ -136,7 +136,7 @@ def buildProject(Dir, SBOutputDir): if (os.path.exists(BuildLogPath)) : RmCommand = "rm " + BuildLogPath if Verbose == 1: - print " Executing: %s." % (RmCommand,) + print " Executing: %s" % (RmCommand,) check_call(RmCommand, shell=True) # Open the log file. @@ -150,8 +150,12 @@ def buildProject(Dir, SBOutputDir): check_call(RmCommand, stderr=PBuildLogFile, stdout=PBuildLogFile, shell=True) - runPreProcessingScript(Dir, PBuildLogFile) - runScanBuild(Dir, SBOutputDir, PBuildLogFile) + runCleanupScript(Dir, PBuildLogFile) + runScanBuild(Dir, SBOutputDir, PBuildLogFile) + + if ClenupAfterBuild : + runCleanupScript(Dir, PBuildLogFile) + finally: PBuildLogFile.close() @@ -283,7 +287,7 @@ def testProject(ID, IsReferenceBuild, Dir=None): else : SBOutputDir = os.path.join(Dir, SBOutputDirName) - buildProject(Dir, SBOutputDir) + buildProject(Dir, SBOutputDir, IsReferenceBuild) checkBuild(SBOutputDir)