[zorg] r294638 - Add check-fuzzer to Asan buildbot on Windows.
Marcos Pividori via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 14:13:56 PST 2017
Author: mpividori
Date: Thu Feb 9 16:13:55 2017
New Revision: 294638
URL: http://llvm.org/viewvc/llvm-project?rev=294638&view=rev
Log:
Add check-fuzzer to Asan buildbot on Windows.
I add some steps to build and run libFuzzer tests for MD on Windows.
Differential revision: https://reviews.llvm.org/D29677
Modified:
zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py
zorg/trunk/zorg/buildbot/builders/Util.py
Modified: zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py?rev=294638&r1=294637&r2=294638&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py (original)
+++ zorg/trunk/zorg/buildbot/builders/SanitizerBuilderWindows.py Thu Feb 9 16:13:55 2017
@@ -7,8 +7,10 @@ from buildbot.steps.shell import ShellCo
from buildbot.steps.slave import RemoveDirectory
from buildbot.steps.source import SVN
from buildbot.process.properties import Property
+from buildbot.process.properties import WithProperties
from zorg.buildbot.builders.Util import getVisualStudioEnvironment
from zorg.buildbot.builders.Util import extractSlaveEnvironment
+from zorg.buildbot.builders.Util import extractClangVersion
from zorg.buildbot.commands.NinjaCommand import NinjaCommand
def getSource(f,llvmTopDir='llvm'):
@@ -64,6 +66,7 @@ def getSanitizerWindowsBuildFactory(
# Global configurations
build_dir='build'
+ build_fuzzer_dir='build-fuzzer'
############# CLEANING
cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
@@ -112,4 +115,61 @@ def getSanitizerWindowsBuildFactory(
workdir=build_dir,
env=Property('slave_env')))
+ # Clean fuzzer build dir.
+ f.addStep(RemoveDirectory(name='clean '+build_fuzzer_dir,
+ dir=build_fuzzer_dir,
+ haltOnFailure=False,
+ flunkOnFailure=False,
+ doStepIf=cleanBuildRequested
+ ))
+
+ # Build path.
+ build_path = "%(workdir)s\\" + build_dir
+ # Get binary dir.
+ bin_path = build_path + "\\bin"
+
+ # Get clang version.
+ f.addStep(SetProperty(command=WithProperties(bin_path+"\\clang --version"),
+ extract_fn=extractClangVersion))
+
+ # Get compiler-rt's libraries dir.
+ dll_path = build_path + "\\lib\\clang\\%(clang_version)s\\lib\\windows"
+
+ # Update slave_env to add fresh clang, tools and compiler-rt dlls to path.
+ update_path_cmd = "set Path=\""+bin_path+";"+dll_path+";%Path%\" && set"
+ f.addStep(SetProperty(command=WithProperties(update_path_cmd),
+ extract_fn=extractSlaveEnvironment,
+ env=Property('slave_env')))
+
+ # Get absolute path to clang-cl.
+ clang_cl = "%(workdir)s/" + build_dir + "/bin/clang-cl"
+ f.addStep(ShellCommand(name='cmake',
+ command=[cmake, "-G", "Ninja", "../llvm",
+ "-DCMAKE_BUILD_TYPE="+config,
+ "-DLLVM_ENABLE_ASSERTIONS=ON",
+ WithProperties("-DCMAKE_C_COMPILER="+clang_cl),
+ WithProperties("-DCMAKE_CXX_COMPILER="+clang_cl),
+ "-DLLVM_USE_SANITIZER=Address",
+ "-DLLVM_USE_SANITIZE_COVERAGE=YES"]
+ + extra_cmake_args,
+ haltOnFailure=False,
+ workdir=build_fuzzer_dir,
+ env=Property('slave_env')))
+
+ # Build libFuzzer.
+ f.addStep(NinjaCommand(name='build LLVMFuzzer',
+ targets=['LLVMFuzzer'],
+ haltOnFailure=False,
+ description='ninja LLVMFuzzer',
+ workdir=build_fuzzer_dir,
+ env=Property('slave_env')))
+
+ # Run libFuzzer's tests.
+ f.addStep(NinjaCommand(name='run fuzzer tests',
+ targets=['check-fuzzer'],
+ haltOnFailure=False,
+ description='ninja check-fuzzer',
+ workdir=build_fuzzer_dir,
+ 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=294638&r1=294637&r2=294638&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/Util.py (original)
+++ zorg/trunk/zorg/buildbot/builders/Util.py Thu Feb 9 16:13:55 2017
@@ -1,4 +1,5 @@
import buildbot.status.results
+import re
def getVisualStudioEnvironment(vs=r"""%VS120COMNTOOLS%""", target_arch=None):
# x86 builds should use the 64 bit -> x86 cross compilation toolchain to avoid
@@ -17,6 +18,16 @@ def extractSlaveEnvironment(exit_status,
for l in stdout.split('\n') if len(l.split('=', 1)) == 2)
return {'slave_env': slave_env_dict}
+def extractClangVersion(exit_status, stdout, stderr):
+ '''Helper function for SetPropertyCommand. Receives "clang --version" output
+ and returns clang_version property for ShellCommands.'''
+ if exit_status:
+ return {}
+ res = re.search(r"version\s*(\S+)", stdout)
+ if res:
+ return {'clang_version': res.group(1)}
+ return {}
+
def getConfigArgs(origname):
name = origname
args = []
More information about the llvm-commits
mailing list