aboutsummaryrefslogtreecommitdiff
path: root/utils/analyzer/SATestBuild.py
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-08-28 20:40:02 +0000
committerTed Kremenek <kremenek@apple.com>2012-08-28 20:40:02 +0000
commit7c14c4456532fbaff17c6ae3e5d259d475bfd7f7 (patch)
tree28464e0e2ffcf930c35a050b0f5d5624e563cdaa /utils/analyzer/SATestBuild.py
parentc0c00664887f5d99780c9b3e33e2f204712823b7 (diff)
Consolidate helper methods and configuration logic. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/analyzer/SATestBuild.py')
-rwxr-xr-xutils/analyzer/SATestBuild.py80
1 files changed, 46 insertions, 34 deletions
diff --git a/utils/analyzer/SATestBuild.py b/utils/analyzer/SATestBuild.py
index 71946c75c7..8f008f1947 100755
--- a/utils/analyzer/SATestBuild.py
+++ b/utils/analyzer/SATestBuild.py
@@ -47,34 +47,9 @@ import time
import plistlib
from subprocess import check_call, CalledProcessError
-# Project map stores info about all the "registered" projects.
-ProjectMapFile = "projectMap.csv"
-
-# Names of the project specific scripts.
-# The script that needs to be executed before the build can start.
-CleanupScript = "cleanup_run_static_analyzer.sh"
-# This is a file containing commands for scan-build.
-BuildScript = "run_static_analyzer.cmd"
-
-# The log file name.
-LogFolderName = "Logs"
-BuildLogName = "run_static_analyzer.log"
-# Summary file - contains the summary of the failures. Ex: This info can be be
-# displayed when buildbot detects a build failure.
-NumOfFailuresInSummary = 10
-FailuresSummaryFileName = "failures.txt"
-# Summary of the result diffs.
-DiffsSummaryFileName = "diffs.txt"
-
-# The scan-build result directory.
-SBOutputDirName = "ScanBuildResults"
-SBOutputDirReferencePrefix = "Ref"
-
-# The list of checkers used during analyzes.
-# Currently, consists of all the non experimental checkers.
-Checkers="alpha.security.taint,core,deadcode,security,unix,osx"
-
-Verbose = 1
+#------------------------------------------------------------------------------
+# Helper functions.
+#------------------------------------------------------------------------------
def which(command, paths = None):
"""which(command, [paths]) - Look up the given command in the paths string
@@ -107,12 +82,6 @@ def which(command, paths = None):
return None
-# Find Clang for static analysis.
-Clang = which("clang", os.environ['PATH'])
-if not Clang:
- print "Error: cannot find 'clang' in PATH"
- sys.exit(-1)
-
# Make sure we flush the output after every print statement.
class flushfile(object):
def __init__(self, f):
@@ -141,6 +110,49 @@ def getSBOutputDirName(IsReferenceBuild) :
else :
return SBOutputDirName
+#------------------------------------------------------------------------------
+# Configuration setup.
+#------------------------------------------------------------------------------
+
+# Find Clang for static analysis.
+Clang = which("clang", os.environ['PATH'])
+if not Clang:
+ print "Error: cannot find 'clang' in PATH"
+ sys.exit(-1)
+
+# Project map stores info about all the "registered" projects.
+ProjectMapFile = "projectMap.csv"
+
+# Names of the project specific scripts.
+# The script that needs to be executed before the build can start.
+CleanupScript = "cleanup_run_static_analyzer.sh"
+# This is a file containing commands for scan-build.
+BuildScript = "run_static_analyzer.cmd"
+
+# The log file name.
+LogFolderName = "Logs"
+BuildLogName = "run_static_analyzer.log"
+# Summary file - contains the summary of the failures. Ex: This info can be be
+# displayed when buildbot detects a build failure.
+NumOfFailuresInSummary = 10
+FailuresSummaryFileName = "failures.txt"
+# Summary of the result diffs.
+DiffsSummaryFileName = "diffs.txt"
+
+# The scan-build result directory.
+SBOutputDirName = "ScanBuildResults"
+SBOutputDirReferencePrefix = "Ref"
+
+# The list of checkers used during analyzes.
+# Currently, consists of all the non experimental checkers.
+Checkers="alpha.security.taint,core,deadcode,security,unix,osx"
+
+Verbose = 1
+
+#------------------------------------------------------------------------------
+# Test harness logic.
+#------------------------------------------------------------------------------
+
# Run pre-processing script if any.
def runCleanupScript(Dir, PBuildLogFile):
ScriptPath = os.path.join(Dir, CleanupScript)