[zorg] r229537 - Add an experimental Sanitizer Windows builder

Timur Iskhodzhanov timurrrr at google.com
Tue Feb 17 12:36:54 PST 2015


Author: timurrrr
Date: Tue Feb 17 14:36:54 2015
New Revision: 229537

URL: http://llvm.org/viewvc/llvm-project?rev=229537&view=rev
Log:
Add an experimental Sanitizer Windows builder

Reviewed at http://reviews.llvm.org/D7675

Added:
    zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py
Modified:
    zorg/trunk/buildbot/osuosl/master/config/builders.py
    zorg/trunk/buildbot/osuosl/master/config/slaves.py
    zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py
    zorg/trunk/zorg/buildbot/builders/Util.py

Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=229537&r1=229536&r2=229537&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/builders.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py Tue Feb 17 14:36:54 2015
@@ -38,6 +38,10 @@ from zorg.buildbot.builders import Sanit
 reload(SanitizerBuilderII)
 from zorg.buildbot.builders import SanitizerBuilderII
 
+from zorg.buildbot.builders import SanitizerBuilderWindows
+reload(SanitizerBuilderWindows)
+from zorg.buildbot.builders import SanitizerBuilderWindows
+
 from zorg.buildbot.builders import Libiomp5Builder
 reload(Libiomp5Builder)
 from zorg.buildbot.builders import Libiomp5Builder
@@ -773,6 +777,11 @@ def _get_sanitizer_builders():
            'builddir': "sanitizer-ppc64le-1",
            'factory': SanitizerBuilder.getSanitizerBuildFactory()},
 
+          {'name': "sanitizer-windows",
+           'slavenames' :["sanitizer-windows"],
+           'builddir': "sanitizer-windows",
+           'factory': SanitizerBuilderWindows.getSanitizerWindowsBuildFactory()},
+
           ## Cortex-A15 check-all full (compiler-rt) with CMake builder; Needs x86 for ASAN tests
           {'name': "clang-cmake-armv7-a15-full",
            'slavenames':["linaro-a15-03"],

Modified: zorg/trunk/buildbot/osuosl/master/config/slaves.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/slaves.py?rev=229537&r1=229536&r2=229537&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/slaves.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/slaves.py Tue Feb 17 14:36:54 2015
@@ -164,6 +164,8 @@ def get_build_slaves():
 
         # Windows Server 2008 R2, Quad 2.6GHz Intel Xeon(R) 4GB RAM
         create_slave("zturner-win2008", properties={'jobs': 4}, max_builds=1),
+        # Windows Server 2008 R2, Quad 2.6GHz Intel Xeon(R) 8GB RAM
+        create_slave("sanitizer-windows", properties={'jobs': 4}, max_builds=1),
 
         # Ubuntu x86-64, 51GiB System memory Intel(R) Xeon(R) CPU @ 2.60GHz
         create_slave("lldb-build1-ubuntu-1404", properties={'jobs': 16, 'loadaverage':

Modified: zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py?rev=229537&r1=229536&r2=229537&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py Tue Feb 17 14:36:54 2015
@@ -9,14 +9,8 @@ from buildbot.steps.slave import RemoveD
 from buildbot.process.properties import WithProperties, Property
 import zorg.buildbot.commands.BatchFileDownload as batch_file_download
 from zorg.buildbot.commands.LitTestCommand import LitTestCommand
-
-def slave_env_glob2list(rc, stdout, stderr):
-    '''Extract function for SetPropertyCommand. Loads Slave Environment
-    into a dictionary, and returns slave_env property for ShellCommands.'''
-    if not rc:
-        slave_env_dict = dict(l.strip().split('=',1)
-            for l in stdout.split('\n') if len(l.split('=',1))==2)
-        return {'slave_env': slave_env_dict}
+from zorg.buildbot.builders.Util import getVisualStudioEnvironment
+from zorg.buildbot.builders.Util import extractSlaveEnvironment
 
 # We *must* checkout at least Clang, LLVM, and LLDB.  Once we add a step to run
 # tests (e.g. ninja check-lldb), we will also need to add a step for LLD, since
@@ -36,13 +30,6 @@ def getLLDBSource(f,llvmTopDir='llvm'):
                   workdir='%s/tools/lldb' % llvmTopDir))
     return f
 
-def generateVisualStudioEnvironment(vs=r"""%VS120COMNTOOLS%""", target_arch=None):
-    arch_arg = {'x86': 'x86', 'x64': 'amd64', 'amd64': 'amd64'}.get(target_arch, '%PROCESSOR_ARCHITECTURE%')
-
-    vcvars_command = "\"" + "\\".join((vs, '..','..','VC', 'vcvarsall.bat')) + "\""
-    vcvars_command = "%s %s && set" % (vcvars_command, arch_arg)
-    return vcvars_command
-
 # CMake Windows builds
 def getLLDBWindowsCMakeBuildFactory(
             clean=False,
@@ -64,11 +51,10 @@ def getLLDBWindowsCMakeBuildFactory(
     ############# PREPARING
     f = buildbot.process.factory.BuildFactory()
 
-    vcvars_command = generateVisualStudioEnvironment(vs,target_arch)
     # Determine Slave Environment and Set MSVC environment.
     f.addStep(SetProperty(
-        command=vcvars_command,
-        extract_fn=slave_env_glob2list))
+        command=getVisualStudioEnvironment(vs, target_arch),
+        extract_fn=extractSlaveEnvironment))
 
     f = getLLDBSource(f,'llvm')
 

Added: zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py?rev=229537&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py (added)
+++ zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py Tue Feb 17 14:36:54 2015
@@ -0,0 +1,102 @@
+import os
+
+import buildbot
+import buildbot.process.factory
+from buildbot.steps.shell import SetProperty
+from buildbot.steps.shell import ShellCommand
+from buildbot.steps.slave import RemoveDirectory
+from buildbot.steps.source import SVN
+from buildbot.process.properties import Property
+import zorg.buildbot.commands.BatchFileDownload as batch_file_download
+from zorg.buildbot.builders.Util import getVisualStudioEnvironment
+from zorg.buildbot.builders.Util import extractSlaveEnvironment
+
+def getSource(f,llvmTopDir='llvm'):
+    f.addStep(SVN(name='svn-llvm',
+                  mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
+                  defaultBranch='trunk',
+                  workdir=llvmTopDir))
+    f.addStep(SVN(name='svn-clang',
+                  mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/',
+                  defaultBranch='trunk',
+                  workdir='%s/tools/clang' % llvmTopDir))
+    f.addStep(SVN(name='svn-compiler-rt',
+                  mode='update',
+                  baseURL='http://llvm.org/svn/llvm-project/compiler-rt/',
+                  defaultBranch='trunk',
+                  workdir='%s/tools/compiler-rt' % llvmTopDir))
+    return f
+
+def getSanitizerWindowsBuildFactory(
+            clean=False,
+            cmake='cmake',
+
+            # Default values for VS devenv and build configuration
+            vs=r"""%VS120COMNTOOLS%""",
+            config='Release',
+            target_arch='x86',
+
+            extra_cmake_args=[],
+            test=False):
+
+    ############# PREPARING
+    f = buildbot.process.factory.BuildFactory()
+
+    # Determine Slave Environment and Set MSVC environment.
+    f.addStep(SetProperty(
+        command=getVisualStudioEnvironment(vs, target_arch),
+        extract_fn=extractSlaveEnvironment))
+
+    f = getSource(f,'llvm')
+
+    # Global configurations
+    build_dir='build'
+
+    ############# CLEANING
+    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
+    f.addStep(RemoveDirectory(name='clean '+build_dir,
+                dir=build_dir,
+                haltOnFailure=False,
+                flunkOnFailure=False,
+                doStepIf=cleanBuildRequested
+                ))
+
+    f.addStep(ShellCommand(name='cmakegen',
+                           command=[cmake, "-G", "Ninja", "../llvm",
+                                    "-DCMAKE_BUILD_TYPE="+config,
+                                    "-DLLVM_ENABLE_ASSERTIONS=ON"]
+                                   + extra_cmake_args,
+                           workdir=build_dir))
+
+    f.addStep(ShellCommand(name='cmake',
+                           command=['cmakegen.bat'],
+                           haltOnFailure=True,
+                           description='cmake gen',
+                           workdir=build_dir,
+
+    # Build compiler-rt first to speed up detection of Windows-specific
+    # compiler-time errors in the sanitizers runtime.
+    f.addStep(NinjaCommand(name='build compiler-rt',
+                           targets=['compiler-rt'],
+                           haltOnFailure=True,
+                           description='ninja compiler-rt',
+                           workdir=build_dir,
+                           env=Property('slave_env')))
+
+    f.addStep(NinjaCommand(name='build',
+                           haltOnFailure=True,
+                           description='ninja build',
+                           workdir=build_dir,
+                           env=Property('slave_env')))
+
+    test_targets = ['check-asan','check-asan-dynamic','check-sanitizer']
+    ignoreTestFail = bool(test != 'ignoreFail')
+    f.addStep(NinjaCommand(name='run tests',
+                           targets=test_cmd,
+                           flunkOnFailure=ignoreTestFail,
+                           description='ninja test',
+                           workdir=build_dir,
+                           doStepIf=bool(test),
+                           env=Property('slave_env')))
+    
+    return f

Modified: zorg/trunk/zorg/buildbot/builders/Util.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/Util.py?rev=229537&r1=229536&r2=229537&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/Util.py (original)
+++ zorg/trunk/zorg/buildbot/builders/Util.py Tue Feb 17 14:36:54 2015
@@ -1,6 +1,20 @@
-
 import buildbot.status.results
 
+def getVisualStudioEnvironment(vs=r"""%VS120COMNTOOLS%""", target_arch=None):
+    arch_arg = {'x86': 'x86', 'x64': 'amd64', 'amd64': 'amd64'}.get(target_arch, '%PROCESSOR_ARCHITECTURE%')
+    vcvars_command = "\"" + "\\".join((vs, '..','..','VC', 'vcvarsall.bat')) + "\""
+    vcvars_command = "%s %s && set" % (vcvars_command, arch_arg)
+    return vcvars_command
+
+def extractSlaveEnvironment(exit_status, stdout, stderr):
+    '''Helper function for SetPropertyCommand. Loads Slave Environment
+    into a dictionary, and returns slave_env property for ShellCommands.'''
+    if exit_status:
+        return {}
+    slave_env_dict = dict(l.strip().split('=',1)
+        for l in stdout.split('\n') if len(l.split('=', 1)) == 2)
+    return {'slave_env': slave_env_dict}
+
 def getConfigArgs(origname):
   name = origname
   args = []





More information about the llvm-commits mailing list