[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results

llvm-svn: 316632
diff --git a/clang/utils/analyzer/SATestBuild.py b/clang/utils/analyzer/SATestBuild.py
index 2cf02ea..74a5f6e 100755
--- a/clang/utils/analyzer/SATestBuild.py
+++ b/clang/utils/analyzer/SATestBuild.py
@@ -71,7 +71,7 @@
     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 @@
     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 @@
         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 @@
                    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 @@
     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 @@
                 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 @@
         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 @@
     TestsPassed = testAll(IsReference, Strictness)
     if not TestsPassed:
         print "ERROR: Tests failed."
-        sys.exit(-1)
+        sys.exit(42)