Index: buildbot/osuosl/master/config/builders.py =================================================================== --- buildbot/osuosl/master/config/builders.py +++ buildbot/osuosl/master/config/builders.py @@ -38,6 +38,10 @@ 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 @@ -772,6 +776,11 @@ '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"], Index: buildbot/osuosl/master/config/slaves.py =================================================================== --- buildbot/osuosl/master/config/slaves.py +++ buildbot/osuosl/master/config/slaves.py @@ -164,6 +164,8 @@ # 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': Index: zorg/buildbot/builders/LLDBBuilder.py =================================================================== --- zorg/buildbot/builders/LLDBBuilder.py +++ zorg/buildbot/builders/LLDBBuilder.py @@ -9,14 +9,8 @@ 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 @@ 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 @@ ############# 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') Index: zorg/buildbot/builders/SanitizerBuilderWindows.py =================================================================== --- zorg/buildbot/builders/SanitizerBuilderWindows.py +++ zorg/buildbot/builders/SanitizerBuilderWindows.py @@ -0,0 +1,108 @@ +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', + + # Source directory containing a built python + python_source_dir=r'C:/src/python', + + # 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 = getLLDBSource(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 + )) + + # Use batch files instead of ShellCommand directly, Windows quoting is + # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377. + f.addStep(batch_file_download.BatchFileDownload(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 Index: zorg/buildbot/builders/Util.py =================================================================== --- zorg/buildbot/builders/Util.py +++ zorg/buildbot/builders/Util.py @@ -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 = []