summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2017-10-26 01:13:22 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2017-10-26 01:13:22 +0000
commit9107ad9e5f2f8551e9b6b90af76d25bd26735d27 (patch)
tree367ac27dd2adb71514b42a06007bfa854e8f665b /utils
parentf19ada140e21a47e9ee3b1ce5e36a2b219cb6f40 (diff)
[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-xutils/analyzer/SATestBuild.py19
-rwxr-xr-xutils/analyzer/SATestUpdateDiffs.py4
2 files changed, 13 insertions, 10 deletions
diff --git a/utils/analyzer/SATestBuild.py b/utils/analyzer/SATestBuild.py
index 2cf02ea64a..74a5f6ebda 100755
--- a/utils/analyzer/SATestBuild.py
+++ b/utils/analyzer/SATestBuild.py
@@ -71,7 +71,7 @@ def getProjectMapPath():
if not os.path.exists(ProjectMapPath):
print "Error: Cannot find the Project Map file " + ProjectMapPath +\
"\nRunning script for the wrong directory?"
- sys.exit(-1)
+ sys.exit(1)
return ProjectMapPath
@@ -97,7 +97,7 @@ else:
Clang = SATestUtils.which("clang", os.environ['PATH'])
if not Clang:
print "Error: cannot find 'clang' in PATH"
- sys.exit(-1)
+ sys.exit(1)
# Number of jobs.
Jobs = int(math.ceil(multiprocessing.cpu_count() * 0.75))
@@ -196,7 +196,7 @@ def downloadAndPatch(Dir, PBuildLogFile):
if not os.path.exists(CachedSourceDirPath):
print "Error: '%s' not found after download." % (
CachedSourceDirPath)
- exit(-1)
+ exit(1)
PatchedSourceDirPath = os.path.join(Dir, PatchedSourceDirName)
@@ -225,7 +225,7 @@ def applyPatch(Dir, PBuildLogFile):
shell=True)
except:
print "Error: Patch failed. See %s for details." % (PBuildLogFile.name)
- sys.exit(-1)
+ sys.exit(1)
def runScanBuild(Dir, SBOutputDir, PBuildLogFile):
@@ -236,7 +236,7 @@ def runScanBuild(Dir, SBOutputDir, PBuildLogFile):
BuildScriptPath = os.path.join(Dir, BuildScript)
if not os.path.exists(BuildScriptPath):
print "Error: build script is not defined: %s" % BuildScriptPath
- sys.exit(-1)
+ sys.exit(1)
AllCheckers = Checkers
if 'SA_ADDITIONAL_CHECKERS' in os.environ:
@@ -473,7 +473,7 @@ def checkBuild(SBOutputDir):
shutil.copyfileobj(FailLogI, SummaryLog)
print "Error: analysis failed. See ", SummaryPath
- sys.exit(-1)
+ sys.exit(1)
def runCmpResults(Dir, Strictness=0):
@@ -503,7 +503,10 @@ def runCmpResults(Dir, Strictness=0):
RefList.remove(RefLogDir)
NewList.remove(os.path.join(NewDir, LogFolderName))
- assert(len(RefList) == len(NewList))
+ if len(RefList) != len(NewList):
+ print "Mismatch in number of results folders: %s vs %s" % (
+ RefList, NewList)
+ sys.exit(1)
# There might be more then one folder underneath - one per each scan-build
# command (Ex: one for configure and one for make).
@@ -656,4 +659,4 @@ if __name__ == '__main__':
TestsPassed = testAll(IsReference, Strictness)
if not TestsPassed:
print "ERROR: Tests failed."
- sys.exit(-1)
+ sys.exit(42)
diff --git a/utils/analyzer/SATestUpdateDiffs.py b/utils/analyzer/SATestUpdateDiffs.py
index a60c625245..c1c3a25cf5 100755
--- a/utils/analyzer/SATestUpdateDiffs.py
+++ b/utils/analyzer/SATestUpdateDiffs.py
@@ -32,7 +32,7 @@ def updateReferenceResults(ProjName, ProjBuildMode):
if not os.path.exists(CreatedResultsPath):
print >> sys.stderr, "New results not found, was SATestBuild.py "\
"previously run?"
- sys.exit(-1)
+ sys.exit(1)
# Remove reference results: in git, and then again for a good measure
# with rm, as git might not remove things fully if there are empty
@@ -75,7 +75,7 @@ def main(argv):
print >> sys.stderr, "Update static analyzer reference results based "\
"\non the previous run of SATestBuild.py.\n"\
"\nN.B.: Assumes that SATestBuild.py was just run"
- sys.exit(-1)
+ sys.exit(1)
with SATestBuild.projectFileHandler() as f:
for (ProjName, ProjBuildMode) in SATestBuild.iterateOverProjects(f):