Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 1 | import os |
| 2 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 3 | import buildbot |
| 4 | import buildbot.process.factory |
| 5 | from buildbot.steps.source import SVN |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 6 | from buildbot.steps.shell import Configure, ShellCommand |
| 7 | from buildbot.steps.shell import WarningCountingShellCommand |
| 8 | from buildbot.steps.transfer import FileDownload |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 9 | from buildbot.process.properties import WithProperties |
| 10 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 11 | from zorg.buildbot.commands.ClangTestCommand import ClangTestCommand |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 12 | from zorg.buildbot.commands.BatchFileDownload import BatchFileDownload |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 13 | |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame^] | 14 | def getClangBuildFactory(triple=None, clean=True, test=True, |
| 15 | expensive_checks=False, run_cxx_tests=False, valgrind=False): |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 16 | f = buildbot.process.factory.BuildFactory() |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 17 | |
| 18 | # Determine the build directory. |
| 19 | f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir", |
| 20 | command=["pwd"], |
| 21 | property="builddir", |
| 22 | description="set build dir", |
| 23 | workdir=".")) |
| 24 | |
| 25 | # Checkout sources. |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 26 | f.addStep(SVN(name='svn-llvm', |
| 27 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 28 | defaultBranch='trunk', |
| 29 | workdir='llvm')) |
| 30 | f.addStep(SVN(name='svn-clang', |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 31 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 32 | defaultBranch='trunk', |
| 33 | workdir='llvm/tools/clang')) |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame^] | 34 | |
| 35 | # Force without llvm-gcc so we don't run afoul of Frontend test failures. |
| 36 | configure_args = ["./configure", "--without-llvmgcc", "--without-llvmgxx"] |
| 37 | config_name = 'Debug' |
| 38 | if expensive_checks: |
| 39 | configure_args.append('--enable-expensive-checks') |
| 40 | config_name += '+Checks' |
| 41 | if triple: |
| 42 | configure_args += ['--build=%s' % triple, |
| 43 | '--host=%s' % triple, |
| 44 | '--target=%s' % triple] |
| 45 | f.addStep(Configure(command=configure_args, |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 46 | workdir='llvm', |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame^] | 47 | description=['configuring',config_name], |
| 48 | descriptionDone=['configure',config_name])) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 49 | if clean: |
| 50 | f.addStep(WarningCountingShellCommand(name="clean-llvm", |
| 51 | command="make clean", |
| 52 | haltOnFailure=True, |
| 53 | description="cleaning llvm", |
| 54 | descriptionDone="clean llvm", |
| 55 | workdir='llvm')) |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 56 | f.addStep(WarningCountingShellCommand(name="compile", |
| 57 | command=WithProperties("nice -n 10 make -j%(jobs)d"), |
| 58 | haltOnFailure=True, |
| 59 | description="compiling llvm & clang", |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 60 | descriptionDone="compile llvm & clang", |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 61 | workdir='llvm')) |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame^] | 62 | clangTestArgs = '-v' |
| 63 | if valgrind: |
| 64 | clangTestArgs += ' --vg ' |
| 65 | clangTestArgs += ' --vg-arg --leak-check=no' |
| 66 | clangTestArgs += ' --vg-arg --suppressions=%(builddir)s/llvm/tools/clang/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp' |
| 67 | extraTestDirs = '' |
| 68 | if run_cxx_tests: |
| 69 | extraTestDirs += '%(builddir)s/llvm/tools/clang/utils/C++Tests' |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 70 | if test: |
| 71 | f.addStep(ClangTestCommand(name='test-llvm', |
| 72 | command=["make", "check-lit", "VERBOSE=1"], |
| 73 | description=["testing", "llvm"], |
| 74 | descriptionDone=["test", "llvm"], |
| 75 | workdir='llvm')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 76 | f.addStep(ClangTestCommand(name='test-clang', |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame^] | 77 | command=['make', 'test', WithProperties('TESTARGS=%s' % clangTestArgs), |
| 78 | WithProperties('EXTRA_TESTDIRS=%s' % extraTestDirs)], |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 79 | workdir='llvm/tools/clang')) |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 80 | return f |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 81 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 82 | def getClangMSVCBuildFactory(update=True, clean=True, vcDrive='c', jobs=1): |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 83 | f = buildbot.process.factory.BuildFactory() |
| 84 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 85 | if update: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 86 | f.addStep(SVN(name='svn-llvm', |
| 87 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 88 | defaultBranch='trunk', |
| 89 | workdir='llvm')) |
| 90 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 91 | if update: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 92 | f.addStep(SVN(name='svn-clang', |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 93 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 94 | defaultBranch='trunk', |
| 95 | workdir='llvm/tools/clang')) |
| 96 | |
| 97 | # Full & fast clean. |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 98 | if clean: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 99 | f.addStep(ShellCommand(name='clean-1', |
| 100 | command=['del','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 101 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 102 | description='cleaning', |
| 103 | descriptionDone='clean', |
| 104 | workdir='llvm')) |
| 105 | f.addStep(ShellCommand(name='clean-2', |
| 106 | command=['rmdir','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 107 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 108 | description='cleaning', |
| 109 | descriptionDone='clean', |
| 110 | workdir='llvm')) |
| 111 | |
| 112 | # Create the project files. |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 113 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 114 | # Use batch files instead of ShellCommand directly, Windows quoting is |
| 115 | # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377. |
| 116 | f.addStep(BatchFileDownload(name='cmakegen', |
| 117 | command=[r"c:\Program Files\CMake 2.6\bin\cmake", |
| 118 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
| 119 | "-G", |
| 120 | "Visual Studio 9 2008", |
| 121 | ".."], |
| 122 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 123 | f.addStep(ShellCommand(name='cmake', |
| 124 | command=['cmakegen.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 125 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 126 | description='cmake gen', |
| 127 | workdir='llvm\\build')) |
| 128 | |
| 129 | # Build it. |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 130 | f.addStep(BatchFileDownload(name='vcbuild', |
| 131 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 132 | "/M%d" % jobs, |
| 133 | "LLVM.sln", |
| 134 | "Debug|Win32"], |
| 135 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 136 | f.addStep(WarningCountingShellCommand(name='vcbuild', |
| 137 | command=['vcbuild.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 138 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 139 | description='vcbuild', |
| 140 | workdir='llvm\\build', |
| 141 | warningPattern=" warning C.*:")) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 142 | |
| 143 | # Build clang-test project. |
| 144 | f.addStep(BatchFileDownload(name='vcbuild_test', |
| 145 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 146 | "clang-test.vcproj", |
| 147 | "Debug|Win32"], |
| 148 | workdir="llvm\\build\\tools\\clang\\test")) |
| 149 | f.addStep(ClangTestCommand(name='test-clang', |
| 150 | command=["vcbuild_test.bat"], |
| 151 | workdir="llvm\\build\\tools\\clang\\test")) |
| 152 | |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 153 | return f |