[zorg] r257246 - [zorg] Add static analyzer benchmark builder logic to Jenkins build.py

Devin Coughlin via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 18:08:34 PST 2016


Author: dcoughlin
Date: Fri Jan  8 20:08:34 2016
New Revision: 257246

URL: http://llvm.org/viewvc/llvm-project?rev=257246&view=rev
Log:
[zorg] Add static analyzer benchmark builder logic to Jenkins build.py

Add a 'static-analyzer-benchmarks' build to build.py to call the static analyzer
build bot scripts in cfe/utils/analyzer.

Modified:
    zorg/trunk/test/jenkins/test_build.py
    zorg/trunk/zorg/jenkins/build.py

Modified: zorg/trunk/test/jenkins/test_build.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/test/jenkins/test_build.py?rev=257246&r1=257245&r2=257246&view=diff
==============================================================================
--- zorg/trunk/test/jenkins/test_build.py (original)
+++ zorg/trunk/test/jenkins/test_build.py Fri Jan  8 20:08:34 2016
@@ -133,3 +133,10 @@
 # CHECK-CMAKE-2-TESTS: '-DLLVM_LIT_ARGS=--xunit-xml-output=testresults.xunit.xml -v -j 2'
 
 # RUN: python %{src_root}/zorg/jenkins/build.py cmake all --cmake-type=RelWithDebugInfo
+
+
+# RUN: python %{src_root}/zorg/jenkins/build.py static-analyzer-benchmarks | FileCheck --check-prefix CHECK-STATIC-ANALYZER-BENCHMARKS %s
+# CHECK-STATIC-ANALYZER-BENCHMARKS: @@@ Static Analyzer Benchmarks @@@
+# CHECK-STATIC-ANALYZER-BENCHMARKS: cd [[WORKSPACE:.*]]/clang-analyzer-benchmarks/
+# CHECK-STATIC-ANALYZER-BENCHMARKS: '[[WORKSPACE]]/utils-analyzer/SATestBuild.py' '--strictness' '2'
+# CHECK-STATIC-ANALYZER-BENCHMARKS: @@@@@@

Modified: zorg/trunk/zorg/jenkins/build.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/jenkins/build.py?rev=257246&r1=257245&r2=257246&view=diff
==============================================================================
--- zorg/trunk/zorg/jenkins/build.py (original)
+++ zorg/trunk/zorg/jenkins/build.py Fri Jan  8 20:08:34 2016
@@ -306,6 +306,25 @@ def lldb_builder():
     run_cmd("lldb", xcodebuild_cmd)
     footer()
 
+def static_analyzer_benchmarks_builder():
+  """Run static analyzer benchmarks"""
+  header("Static Analyzer Benchmarks")
+
+  benchmark_script = conf.workspace + "/utils-analyzer/SATestBuild.py"
+  benchmarks_dir = conf.workspace + "/clang-analyzer-benchmarks/"
+
+  compiler_bin_dir = conf.workspace + "/host_compiler/bin/"
+
+  old_path = os.environ.get("PATH", "")
+  env = dict(os.environ, PATH=compiler_bin_dir + os.pathsep + old_path)
+
+  benchmark_cmd = [benchmark_script,
+                   "--strictness", "2"
+                  ]
+  run_cmd(benchmarks_dir, benchmark_cmd, env=env)
+
+  footer()
+
 def check_repo_state(path):
     """Check the SVN repo at the path has all the
     nessessary repos checked out.  Check this by
@@ -506,7 +525,7 @@ def build_upload_artifact():
     run_cmd(conf.workspace, ln_cmd)
 
 
-def run_cmd(working_dir, cmd):
+def run_cmd(working_dir, cmd, env=None):
     """Run a command in a working directory, and make sure it returns zero."""
     old_cwd = os.getcwd()
     cmd_to_print = ' '.join([quote_sh_string(x) for x in cmd])
@@ -516,7 +535,7 @@ def run_cmd(working_dir, cmd):
     start_time = datetime.datetime.now()
     if not os.environ.get('TESTING', False):
         os.chdir(working_dir)
-        subprocess.check_call(cmd)
+        subprocess.check_call(cmd, env=env)
         os.chdir(old_cwd)
     end_time = datetime.datetime.now()
 
@@ -526,7 +545,8 @@ def run_cmd(working_dir, cmd):
 
 KNOWN_TARGETS = ['all', 'build', 'test', 'testlong']
 KNOWN_BUILDS = ['clang', 'cmake', 'lldb', 'fetch', 'artifact',
-                'derive', 'derive-llvm+clang', 'derive-lldb', 'derive-llvm']
+                'derive', 'derive-llvm+clang', 'derive-lldb', 'derive-llvm',
+                'static-analyzer-benchmarks']
 
 
 def parse_args():
@@ -586,6 +606,8 @@ def main():
             fetch_compiler()
         elif args.build_type == 'artifact':
             build_upload_artifact()
+        elif args.build_type == 'static-analyzer-benchmarks':
+            static_analyzer_benchmarks_builder()
     except subprocess.CalledProcessError as exct:
         print "Command failed", exct.message
         print "Command:", exct.cmd




More information about the llvm-commits mailing list