Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 1 | import buildbot |
| 2 | import buildbot.process.factory |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 3 | import os |
| 4 | |
| 5 | from buildbot.process.properties import WithProperties |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 6 | from buildbot.steps.shell import Configure, ShellCommand, SetProperty |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 7 | from buildbot.steps.shell import WarningCountingShellCommand |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 8 | from buildbot.steps.source import SVN |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 9 | from buildbot.steps.transfer import FileDownload |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 10 | |
Michael Gottesman | 960bcfa | 2013-08-30 05:46:15 +0000 | [diff] [blame] | 11 | import zorg.buildbot.util.artifacts as artifacts |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 12 | import zorg.buildbot.builders.Util as builders_util |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 13 | import zorg.buildbot.util.phasedbuilderutils as phasedbuilderutils |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 14 | import zorg.buildbot.commands as commands |
| 15 | import zorg.buildbot.commands.BatchFileDownload as batch_file_download |
| 16 | import zorg.buildbot.commands.LitTestCommand as lit_test_command |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 17 | |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 18 | def getClangBuildFactory( |
| 19 | triple=None, |
| 20 | clean=True, |
| 21 | test=True, |
| 22 | package_dst=None, |
| 23 | run_cxx_tests=False, |
| 24 | examples=False, |
| 25 | valgrind=False, |
| 26 | valgrindLeakCheck=False, |
| 27 | outOfDir=False, |
| 28 | useTwoStage=False, |
| 29 | completely_clean=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 30 | make='make', |
| 31 | jobs="%(jobs)s", |
| 32 | stage1_config='Debug+Asserts', |
| 33 | stage2_config='Release+Asserts', |
| 34 | env={}, # Environmental variables for all steps. |
| 35 | extra_configure_args=[], |
| 36 | use_pty_in_tests=False, |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 37 | trunk_revision=None, |
| 38 | force_checkout=False, |
Peter Collingbourne | 7a95b0c | 2011-10-26 16:40:17 +0000 | [diff] [blame] | 39 | extra_clean_step=None, |
David Blaikie | a76da84 | 2012-08-13 22:24:46 +0000 | [diff] [blame] | 40 | checkout_compiler_rt=False, |
| 41 | run_gdb=False, |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 42 | run_modern_gdb=False, |
Galina Kistanova | 1083640 | 2013-09-26 20:42:52 +0000 | [diff] [blame] | 43 | run_gcc=False, |
| 44 | merge_functions=False): |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 45 | # Prepare environmental variables. Set here all env we want everywhere. |
| 46 | merged_env = { |
| 47 | 'TERM' : 'dumb' # Make sure Clang doesn't use color escape sequences. |
| 48 | } |
| 49 | if env is not None: |
| 50 | # Overwrite pre-set items with the given ones, so user can set anything. |
| 51 | merged_env.update(env) |
David Blaikie | 2f7eb28 | 2012-08-24 18:37:00 +0000 | [diff] [blame] | 52 | |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 53 | if run_gdb or run_gcc or run_modern_gdb: |
David Blaikie | 88511c7 | 2012-08-24 23:14:06 +0000 | [diff] [blame] | 54 | outOfDir = True |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 55 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 56 | # Don't use in-dir builds with a two stage build process. |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 57 | inDir = not outOfDir and not useTwoStage |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 58 | if inDir: |
| 59 | llvm_srcdir = "llvm" |
| 60 | llvm_1_objdir = "llvm" |
David Blaikie | 88511c7 | 2012-08-24 23:14:06 +0000 | [diff] [blame] | 61 | llvm_1_installdir = None |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 62 | else: |
| 63 | llvm_srcdir = "llvm.src" |
| 64 | llvm_1_objdir = "llvm.obj" |
| 65 | llvm_1_installdir = "llvm.install.1" |
| 66 | llvm_2_objdir = "llvm.obj.2" |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 67 | llvm_2_installdir = "llvm.install" |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 68 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 69 | f = buildbot.process.factory.BuildFactory() |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 70 | |
| 71 | # Determine the build directory. |
| 72 | f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir", |
| 73 | command=["pwd"], |
| 74 | property="builddir", |
| 75 | description="set build dir", |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 76 | workdir=".", |
| 77 | env=merged_env)) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 78 | |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 79 | # Blow away completely, if requested. |
| 80 | if completely_clean: |
| 81 | f.addStep(ShellCommand(name="rm-llvm.src", |
| 82 | command=["rm", "-rf", llvm_srcdir], |
| 83 | haltOnFailure=True, |
| 84 | description=["rm src dir", "llvm"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 85 | workdir=".", |
| 86 | env=merged_env)) |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 87 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 88 | # Checkout sources. |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 89 | if trunk_revision: |
| 90 | # The SVN build step provides no mechanism to check out a specific revision |
| 91 | # based on a property, so just run the commands directly here. |
| 92 | svn_co = ['svn', 'checkout'] |
| 93 | if force_checkout: |
| 94 | svn_co += ['--force'] |
| 95 | svn_co += ['--revision', WithProperties(trunk_revision)] |
| 96 | |
| 97 | svn_co_llvm = svn_co + \ |
| 98 | [WithProperties('http://llvm.org/svn/llvm-project/llvm/trunk@%s' % |
| 99 | trunk_revision), |
| 100 | llvm_srcdir] |
| 101 | svn_co_clang = svn_co + \ |
| 102 | [WithProperties('http://llvm.org/svn/llvm-project/cfe/trunk@%s' % |
| 103 | trunk_revision), |
| 104 | '%s/tools/clang' % llvm_srcdir] |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 105 | svn_co_clang_tools_extra = svn_co + \ |
| 106 | [WithProperties('http://llvm.org/svn/llvm-project/clang-tools-extra/trunk@%s' % |
| 107 | trunk_revision), |
| 108 | '%s/tools/clang/tools/extra' % llvm_srcdir] |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 109 | |
| 110 | f.addStep(ShellCommand(name='svn-llvm', |
| 111 | command=svn_co_llvm, |
| 112 | haltOnFailure=True, |
| 113 | workdir='.')) |
| 114 | f.addStep(ShellCommand(name='svn-clang', |
| 115 | command=svn_co_clang, |
| 116 | haltOnFailure=True, |
| 117 | workdir='.')) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 118 | f.addStep(ShellCommand(name='svn-clang-tools-extra', |
| 119 | command=svn_co_clang_tools_extra, |
| 120 | haltOnFailure=True, |
| 121 | workdir='.')) |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 122 | else: |
| 123 | f.addStep(SVN(name='svn-llvm', |
Daniel Dunbar | f4e23eb | 2010-09-20 21:13:02 +0000 | [diff] [blame] | 124 | mode='update', |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 125 | baseURL='http://llvm.org/svn/llvm-project/llvm/', |
Daniel Dunbar | f4e23eb | 2010-09-20 21:13:02 +0000 | [diff] [blame] | 126 | defaultBranch='trunk', |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 127 | workdir=llvm_srcdir)) |
| 128 | f.addStep(SVN(name='svn-clang', |
| 129 | mode='update', |
| 130 | baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 131 | defaultBranch='trunk', |
| 132 | workdir='%s/tools/clang' % llvm_srcdir)) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 133 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 134 | mode='update', |
| 135 | baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 136 | defaultBranch='trunk', |
| 137 | workdir='%s/tools/clang/tools/extra' % llvm_srcdir)) |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 138 | if checkout_compiler_rt: |
| 139 | f.addStep(SVN(name='svn-compiler-rt', |
| 140 | mode='update', |
| 141 | baseURL='http://llvm.org/svn/llvm-project/compiler-rt/', |
| 142 | defaultBranch='trunk', |
| 143 | workdir='%s/projects/compiler-rt' % llvm_srcdir)) |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 144 | |
Galina Kistanova | 1083640 | 2013-09-26 20:42:52 +0000 | [diff] [blame] | 145 | # Revert and apply patch mergeFunctions in required |
| 146 | if merge_functions: |
| 147 | f.addStep(ShellCommand(name="revert_patch_MergeFunctions", |
| 148 | command=["svn", "-R", "revert", '.'], |
| 149 | haltOnFailure=True, |
| 150 | description=["revert patch MergeFunctions"], |
| 151 | workdir='%s/tools/clang' % llvm_srcdir, |
| 152 | env=merged_env)) |
| 153 | |
| 154 | if merge_functions: |
| 155 | f.addStep(ShellCommand(name="patch_MergeFunctions", |
| 156 | command=["patch", "-Np0", "-i", '../../utils/Misc/mergefunctions.clang.svn.patch'], |
| 157 | haltOnFailure=True, |
| 158 | description=["patch MergeFunctions"], |
| 159 | workdir='%s/tools/clang' % llvm_srcdir, |
| 160 | env=merged_env)) |
| 161 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 162 | # Clean up llvm (stage 1); unless in-dir. |
| 163 | if clean and llvm_srcdir != llvm_1_objdir: |
| 164 | f.addStep(ShellCommand(name="rm-llvm.obj.stage1", |
| 165 | command=["rm", "-rf", llvm_1_objdir], |
| 166 | haltOnFailure=True, |
| 167 | description=["rm build dir", "llvm"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 168 | workdir=".", |
| 169 | env=merged_env)) |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 170 | |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 171 | # Force without llvm-gcc so we don't run afoul of Frontend test failures. |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 172 | base_configure_args = [WithProperties("%%(builddir)s/%s/configure" % llvm_srcdir), |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 173 | '--disable-bindings'] |
| 174 | base_configure_args += extra_configure_args |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 175 | if triple: |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 176 | base_configure_args += ['--build=%s' % triple, |
Michael Gottesman | 6f85f93 | 2014-06-27 23:49:58 +0000 | [diff] [blame] | 177 | '--host=%s' % triple] |
Galina Kistanova | 702eccb | 2013-08-22 00:09:17 +0000 | [diff] [blame] | 178 | args = base_configure_args + [WithProperties("--prefix=%%(builddir)s/%s" % llvm_1_installdir)] |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 179 | args += builders_util.getConfigArgs(stage1_config) |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 180 | if not clean: |
| 181 | f.addStep(SetProperty(name="Makefile_isready", |
| 182 | workdir=llvm_1_objdir, |
| 183 | command=["sh", "-c", |
Galina Kistanova | f7275a4 | 2013-03-22 21:42:55 +0000 | [diff] [blame] | 184 | "test -e Makefile.config && echo OK || echo Missing"], |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 185 | flunkOnFailure=False, |
| 186 | property="exists_Makefile")) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 187 | f.addStep(Configure(command=args, |
| 188 | workdir=llvm_1_objdir, |
| 189 | description=['configuring',stage1_config], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 190 | descriptionDone=['configure',stage1_config], |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 191 | env=merged_env, |
| 192 | doStepIf=lambda step: step.build.getProperty("exists_Makefile") != "OK")) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 193 | |
| 194 | # Make clean if using in-dir builds. |
| 195 | if clean and llvm_srcdir == llvm_1_objdir: |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 196 | f.addStep(WarningCountingShellCommand(name="clean-llvm", |
Daniel Dunbar | d20468a | 2009-11-24 18:27:23 +0000 | [diff] [blame] | 197 | command=[make, "clean"], |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 198 | haltOnFailure=True, |
| 199 | description="cleaning llvm", |
| 200 | descriptionDone="clean llvm", |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 201 | workdir=llvm_1_objdir, |
Peter Collingbourne | 7a95b0c | 2011-10-26 16:40:17 +0000 | [diff] [blame] | 202 | doStepIf=clean, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 203 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 204 | |
Peter Collingbourne | 7a95b0c | 2011-10-26 16:40:17 +0000 | [diff] [blame] | 205 | if extra_clean_step: |
| 206 | f.addStep(extra_clean_step) |
| 207 | |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 208 | f.addStep(WarningCountingShellCommand(name="compile", |
Daniel Dunbar | d20468a | 2009-11-24 18:27:23 +0000 | [diff] [blame] | 209 | command=['nice', '-n', '10', |
| 210 | make, WithProperties("-j%s" % jobs)], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 211 | haltOnFailure=True, |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 212 | flunkOnFailure=not run_gdb, |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 213 | description=["compiling", stage1_config], |
| 214 | descriptionDone=["compile", stage1_config], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 215 | workdir=llvm_1_objdir, |
| 216 | env=merged_env)) |
Daniel Dunbar | 256fed4 | 2009-11-25 21:11:08 +0000 | [diff] [blame] | 217 | |
| 218 | if examples: |
| 219 | f.addStep(WarningCountingShellCommand(name="compile.examples", |
| 220 | command=['nice', '-n', '10', |
| 221 | make, WithProperties("-j%s" % jobs), |
| 222 | "BUILD_EXAMPLES=1"], |
| 223 | haltOnFailure=True, |
Richard Smith | 65e6f5d | 2014-09-25 18:18:35 +0000 | [diff] [blame^] | 224 | description=["compiling", stage1_config, "examples"], |
Daniel Dunbar | 256fed4 | 2009-11-25 21:11:08 +0000 | [diff] [blame] | 225 | descriptionDone=["compile", stage1_config, "examples"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 226 | workdir=llvm_1_objdir, |
| 227 | env=merged_env)) |
Daniel Dunbar | 256fed4 | 2009-11-25 21:11:08 +0000 | [diff] [blame] | 228 | |
NAKAMURA Takumi | 1a4666b | 2013-01-19 03:39:07 +0000 | [diff] [blame] | 229 | clangTestArgs = '-v -j %s' % jobs |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 230 | if valgrind: |
Daniel Dunbar | 89184b9 | 2010-04-18 19:09:32 +0000 | [diff] [blame] | 231 | clangTestArgs += ' --vg' |
Daniel Dunbar | a1bebce | 2010-03-21 01:24:00 +0000 | [diff] [blame] | 232 | if valgrindLeakCheck: |
| 233 | clangTestArgs += ' --vg-leak' |
Nick Lewycky | 8d26e47 | 2011-08-27 21:18:56 +0000 | [diff] [blame] | 234 | clangTestArgs += ' --vg-arg --suppressions=%(builddir)s/llvm/tools/clang/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp --vg-arg --suppressions=%(builddir)s/llvm/utils/valgrind/x86_64-pc-linux-gnu.supp' |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 235 | extraTestDirs = '' |
| 236 | if run_cxx_tests: |
| 237 | extraTestDirs += '%(builddir)s/llvm/tools/clang/utils/C++Tests' |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 238 | if test: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 239 | f.addStep(lit_test_command.LitTestCommand(name='check-all', |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 240 | command=[make, "check-all", "VERBOSE=1", |
NAKAMURA Takumi | 1a4666b | 2013-01-19 03:39:07 +0000 | [diff] [blame] | 241 | WithProperties("LIT_ARGS=%s" % clangTestArgs), |
David Blaikie | bc68401 | 2012-12-27 20:44:19 +0000 | [diff] [blame] | 242 | WithProperties("EXTRA_TESTDIRS=%s" % extraTestDirs)], |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 243 | flunkOnFailure=not run_gdb, |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 244 | description=["checking"], |
| 245 | descriptionDone=["checked"], |
Daniel Dunbar | 469e8ca | 2010-05-19 21:26:48 +0000 | [diff] [blame] | 246 | workdir=llvm_1_objdir, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 247 | usePTY=use_pty_in_tests, |
| 248 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 249 | |
| 250 | # Install llvm and clang. |
| 251 | if llvm_1_installdir: |
Daniel Dunbar | 9870de3 | 2010-03-28 22:25:31 +0000 | [diff] [blame] | 252 | f.addStep(ShellCommand(name="rm-install.clang.stage1", |
| 253 | command=["rm", "-rf", llvm_1_installdir], |
| 254 | haltOnFailure=True, |
| 255 | description=["rm install dir", "clang"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 256 | workdir=".", |
| 257 | env=merged_env)) |
Daniel Dunbar | 9870de3 | 2010-03-28 22:25:31 +0000 | [diff] [blame] | 258 | f.addStep(WarningCountingShellCommand(name="install.clang.stage1", |
| 259 | command = ['nice', '-n', '10', |
| 260 | make, 'install-clang'], |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 261 | haltOnFailure=True, |
Daniel Dunbar | 9870de3 | 2010-03-28 22:25:31 +0000 | [diff] [blame] | 262 | description=["install", "clang", |
| 263 | stage1_config], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 264 | workdir=llvm_1_objdir, |
| 265 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 266 | |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 267 | if run_gdb or run_gcc or run_modern_gdb: |
David Blaikie | a76da84 | 2012-08-13 22:24:46 +0000 | [diff] [blame] | 268 | ignores = getClangTestsIgnoresFromPath(os.path.expanduser('~/public/clang-tests'), 'clang-x86_64-darwin10') |
| 269 | install_prefix = "%%(builddir)s/%s" % llvm_1_installdir |
| 270 | if run_gdb: |
| 271 | addClangGDBTests(f, ignores, install_prefix) |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 272 | if run_modern_gdb: |
David Blaikie | 41d09c3 | 2013-01-02 21:11:09 +0000 | [diff] [blame] | 273 | addModernClangGDBTests(f, jobs, install_prefix) |
David Blaikie | a76da84 | 2012-08-13 22:24:46 +0000 | [diff] [blame] | 274 | if run_gcc: |
| 275 | addClangGCCTests(f, ignores, install_prefix) |
| 276 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 277 | if not useTwoStage: |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 278 | if package_dst: |
| 279 | name = WithProperties( |
| 280 | "%(builddir)s/" + llvm_1_objdir + |
| 281 | "/clang-r%(got_revision)s-b%(buildnumber)s.tgz") |
| 282 | f.addStep(ShellCommand(name='pkg.tar', |
| 283 | description="tar root", |
| 284 | command=["tar", "zcvf", name, "./"], |
| 285 | workdir=llvm_1_installdir, |
| 286 | warnOnFailure=True, |
| 287 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 288 | haltOnFailure=False, |
| 289 | env=merged_env)) |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 290 | f.addStep(ShellCommand(name='pkg.upload', |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 291 | description="upload root", |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 292 | command=["scp", name, |
| 293 | WithProperties( |
| 294 | package_dst + "/%(buildername)s")], |
| 295 | workdir=".", |
| 296 | warnOnFailure=True, |
| 297 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 298 | haltOnFailure=False, |
| 299 | env=merged_env)) |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 300 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 301 | return f |
| 302 | |
| 303 | # Clean up llvm (stage 2). |
| 304 | if clean: |
| 305 | f.addStep(ShellCommand(name="rm-llvm.obj.stage2", |
| 306 | command=["rm", "-rf", llvm_2_objdir], |
| 307 | haltOnFailure=True, |
| 308 | description=["rm build dir", "llvm", "(stage 2)"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 309 | workdir=".", |
| 310 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 311 | |
| 312 | # Configure llvm (stage 2). |
Galina Kistanova | 702eccb | 2013-08-22 00:09:17 +0000 | [diff] [blame] | 313 | args = base_configure_args + [WithProperties("--prefix=%(builddir)s/" + llvm_2_installdir)] |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 314 | args += builders_util.getConfigArgs(stage2_config) |
Benjamin Kramer | 9c6fed7 | 2012-07-20 10:18:32 +0000 | [diff] [blame] | 315 | local_env = dict(merged_env) |
| 316 | local_env.update({ |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 317 | 'CC' : WithProperties("%%(builddir)s/%s/bin/clang" % llvm_1_installdir), |
| 318 | 'CXX' : WithProperties("%%(builddir)s/%s/bin/clang++" % llvm_1_installdir)}) |
| 319 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 320 | f.addStep(Configure(name="configure.llvm.stage2", |
| 321 | command=args, |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 322 | haltOnFailure=True, |
| 323 | workdir=llvm_2_objdir, |
| 324 | description=["configure", "llvm", "(stage 2)", |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 325 | stage2_config], |
| 326 | env=local_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 327 | |
| 328 | # Build llvm (stage 2). |
| 329 | f.addStep(WarningCountingShellCommand(name="compile.llvm.stage2", |
| 330 | command=['nice', '-n', '10', |
| 331 | make, WithProperties("-j%s" % jobs)], |
| 332 | haltOnFailure=True, |
| 333 | description=["compiling", "(stage 2)", |
| 334 | stage2_config], |
| 335 | descriptionDone=["compile", "(stage 2)", |
| 336 | stage2_config], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 337 | workdir=llvm_2_objdir, |
| 338 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 339 | |
| 340 | if test: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 341 | f.addStep(lit_test_command.LitTestCommand(name='check-all', |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 342 | command=[make, "check-all", "VERBOSE=1", |
NAKAMURA Takumi | 1a4666b | 2013-01-19 03:39:07 +0000 | [diff] [blame] | 343 | WithProperties("LIT_ARGS=%s" % clangTestArgs), |
David Blaikie | bc68401 | 2012-12-27 20:44:19 +0000 | [diff] [blame] | 344 | WithProperties("EXTRA_TESTDIRS=%s" % extraTestDirs)], |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 345 | description=["checking"], |
| 346 | descriptionDone=["checked"], |
Daniel Dunbar | 469e8ca | 2010-05-19 21:26:48 +0000 | [diff] [blame] | 347 | workdir=llvm_2_objdir, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 348 | usePTY=use_pty_in_tests, |
| 349 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 350 | |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 351 | # Install clang (stage 2). |
Daniel Dunbar | 9870de3 | 2010-03-28 22:25:31 +0000 | [diff] [blame] | 352 | f.addStep(ShellCommand(name="rm-install.clang.stage2", |
| 353 | command=["rm", "-rf", llvm_2_installdir], |
| 354 | haltOnFailure=True, |
| 355 | description=["rm install dir", "clang"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 356 | workdir=".", |
| 357 | env=merged_env)) |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 358 | f.addStep(WarningCountingShellCommand(name="install.clang.stage2", |
| 359 | command = ['nice', '-n', '10', |
| 360 | make, 'install-clang'], |
| 361 | haltOnFailure=True, |
| 362 | description=["install", "clang", |
| 363 | "(stage 2)"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 364 | workdir=llvm_2_objdir, |
| 365 | env=merged_env)) |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 366 | |
| 367 | if package_dst: |
| 368 | name = WithProperties( |
| 369 | "%(builddir)s/" + llvm_2_objdir + |
| 370 | "/clang-r%(got_revision)s-b%(buildnumber)s.tgz") |
| 371 | f.addStep(ShellCommand(name='pkg.tar', |
| 372 | description="tar root", |
| 373 | command=["tar", "zcvf", name, "./"], |
| 374 | workdir=llvm_2_installdir, |
| 375 | warnOnFailure=True, |
| 376 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 377 | haltOnFailure=False, |
| 378 | env=merged_env)) |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 379 | f.addStep(ShellCommand(name='pkg.upload', |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 380 | description="upload root", |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 381 | command=["scp", name, |
| 382 | WithProperties( |
| 383 | package_dst + "/%(buildername)s")], |
| 384 | workdir=".", |
| 385 | warnOnFailure=True, |
| 386 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 387 | haltOnFailure=False, |
| 388 | env=merged_env)) |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 389 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 390 | return f |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 391 | |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 392 | # CMake Linux builds |
| 393 | def getClangCMakeBuildFactory( |
| 394 | clean=True, |
| 395 | test=True, |
| 396 | cmake='cmake', |
| 397 | jobs=None, |
| 398 | |
| 399 | # Multi-stage compilation |
| 400 | useTwoStage=False, |
| 401 | testStage1=True, |
| 402 | stage1_config='Release', |
| 403 | stage2_config='Release', |
| 404 | |
| 405 | # Environmental variables for all steps. |
| 406 | env={}, |
| 407 | extra_cmake_args=[], |
| 408 | |
| 409 | # Extra repositories |
| 410 | checkout_clang_tools_extra=True, |
| 411 | checkout_compiler_rt=True): |
| 412 | |
| 413 | ############# PREPARING |
| 414 | f = buildbot.process.factory.BuildFactory() |
| 415 | |
| 416 | # We *must* checkout at least Clang+LLVM |
| 417 | f.addStep(SVN(name='svn-llvm', |
| 418 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 419 | defaultBranch='trunk', |
| 420 | workdir='llvm')) |
| 421 | f.addStep(SVN(name='svn-clang', |
| 422 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 423 | defaultBranch='trunk', |
| 424 | workdir='llvm/tools/clang')) |
| 425 | |
| 426 | # Extra stuff that will be built/tested |
| 427 | if checkout_clang_tools_extra: |
| 428 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 429 | mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 430 | defaultBranch='trunk', |
| 431 | workdir='llvm/tools/clang/tools/extra')) |
| 432 | if checkout_compiler_rt: |
| 433 | f.addStep(SVN(name='svn-compiler-rt', |
| 434 | mode='update', baseURL='http://llvm.org/svn/llvm-project/compiler-rt/', |
| 435 | defaultBranch='trunk', |
| 436 | workdir='llvm/projects/compiler-rt')) |
| 437 | |
| 438 | # If jobs not defined, Ninja will choose a suitable value |
| 439 | jobs_cmd=[] |
| 440 | lit_args="'-v" |
| 441 | if jobs is not None: |
| 442 | jobs_cmd=["-j"+str(jobs)] |
| 443 | lit_args+=" -j"+str(jobs)+"'" |
| 444 | else: |
| 445 | lit_args+="'" |
| 446 | ninja_cmd=['ninja'] + jobs_cmd |
| 447 | ninja_install_cmd=['ninja', 'install'] + jobs_cmd |
| 448 | ninja_check_cmd=['ninja', 'check-all'] + jobs_cmd |
| 449 | |
| 450 | # Global configurations |
| 451 | stage1_build='stage1' |
| 452 | stage1_install='stage1.install' |
| 453 | stage2_build='stage2' |
| 454 | |
| 455 | ############# CLEANING |
| 456 | if clean: |
| 457 | f.addStep(ShellCommand(name='clean stage 1', |
| 458 | command=['rm','-rf',stage1_build], |
| 459 | warnOnFailure=True, |
| 460 | description='cleaning stage 1', |
| 461 | descriptionDone='clean', |
| 462 | workdir='.', |
| 463 | env=env)) |
| 464 | else: |
| 465 | f.addStep(SetProperty(name="check ninja files 1", |
| 466 | workdir=stage1_build, |
| 467 | command=["sh", "-c", |
| 468 | "test -e build.ninja && echo OK || echo Missing"], |
| 469 | flunkOnFailure=False, |
| 470 | property="exists_ninja_1")) |
| 471 | |
| 472 | |
| 473 | ############# STAGE 1 |
| 474 | f.addStep(ShellCommand(name='cmake stage 1', |
| 475 | command=[cmake, "-G", "Ninja", "../llvm", |
| 476 | "-DCMAKE_BUILD_TYPE="+stage1_config, |
| 477 | "-DLLVM_ENABLE_ASSERTIONS=True", |
| 478 | "-DLLVM_LIT_ARGS="+lit_args, |
| 479 | "-DCMAKE_INSTALL_PREFIX=../"+stage1_install] |
| 480 | + extra_cmake_args, |
| 481 | haltOnFailure=True, |
| 482 | description='cmake stage 1', |
| 483 | workdir=stage1_build, |
| 484 | doStepIf=lambda step: step.build.getProperty("exists_ninja_1") != "OK", |
| 485 | env=env)) |
| 486 | |
| 487 | f.addStep(WarningCountingShellCommand(name='build stage 1', |
| 488 | command=ninja_cmd, |
| 489 | haltOnFailure=True, |
| 490 | description='ninja all', |
| 491 | workdir=stage1_build, |
| 492 | env=env)) |
| 493 | |
| 494 | if test and testStage1: |
Renato Golin | cfbd570 | 2014-09-06 19:09:16 +0000 | [diff] [blame] | 495 | f.addStep(lit_test_command.LitTestCommand(name='ninja check 1', |
| 496 | command=ninja_check_cmd, |
| 497 | description=["checking stage 1"], |
| 498 | descriptionDone=["stage 1 checked"], |
| 499 | workdir=stage1_build, |
| 500 | env=env)) |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 501 | |
| 502 | if not useTwoStage: |
| 503 | return f |
| 504 | |
| 505 | ############# STAGE 2 |
| 506 | f.addStep(ShellCommand(name='install stage 1', |
| 507 | command=ninja_install_cmd, |
| 508 | description='ninja install', |
| 509 | workdir=stage1_build, |
| 510 | env=env)) |
| 511 | |
| 512 | if clean: |
| 513 | f.addStep(ShellCommand(name='clean stage 2', |
| 514 | command=['rm','-rf',stage2_build], |
| 515 | warnOnFailure=True, |
| 516 | description='cleaning stage 2', |
| 517 | descriptionDone='clean', |
| 518 | workdir='.', |
| 519 | env=env)) |
| 520 | else: |
| 521 | f.addStep(SetProperty(name="check ninja files 2", |
| 522 | workdir=stage2_build, |
| 523 | command=["sh", "-c", |
| 524 | "test -e build.ninja && echo OK || echo Missing"], |
| 525 | flunkOnFailure=False, |
| 526 | property="exists_ninja_2")) |
| 527 | |
| 528 | |
| 529 | f.addStep(ShellCommand(name='cmake stage 2', |
| 530 | command=[cmake, "-G", "Ninja", "../llvm", |
| 531 | "-DCMAKE_BUILD_TYPE="+stage2_config, |
| 532 | "-DLLVM_ENABLE_ASSERTIONS=True", |
| 533 | WithProperties("-DCMAKE_C_COMPILER=%(workdir)s/"+stage1_install+"/bin/clang"), |
| 534 | WithProperties("-DCMAKE_CXX_COMPILER=%(workdir)s/"+stage1_install+"/bin/clang++"), |
| 535 | "-DLLVM_LIT_ARGS="+lit_args] |
| 536 | + extra_cmake_args, |
| 537 | haltOnFailure=True, |
| 538 | description='cmake stage 2', |
| 539 | workdir=stage2_build, |
| 540 | doStepIf=lambda step: step.build.getProperty("exists_ninja_2") != "OK", |
| 541 | env=env)) |
| 542 | |
| 543 | f.addStep(WarningCountingShellCommand(name='build stage 2', |
| 544 | command=ninja_cmd, |
| 545 | haltOnFailure=True, |
| 546 | description='ninja all', |
| 547 | workdir=stage2_build, |
| 548 | env=env)) |
| 549 | |
| 550 | if test: |
Renato Golin | cfbd570 | 2014-09-06 19:09:16 +0000 | [diff] [blame] | 551 | f.addStep(lit_test_command.LitTestCommand(name='ninja check 2', |
| 552 | command=ninja_check_cmd, |
| 553 | description=["checking stage 2"], |
| 554 | descriptionDone=["stage 2 checked"], |
| 555 | workdir=stage2_build, |
| 556 | env=env)) |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 557 | |
| 558 | return f |
| 559 | |
Daniel Dunbar | c51a59e | 2010-09-23 14:57:45 +0000 | [diff] [blame] | 560 | def getClangMSVCBuildFactory(update=True, clean=True, vcDrive='c', jobs=1, cmake=r"cmake"): |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 561 | f = buildbot.process.factory.BuildFactory() |
| 562 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 563 | if update: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 564 | f.addStep(SVN(name='svn-llvm', |
| 565 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 566 | defaultBranch='trunk', |
| 567 | workdir='llvm')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 568 | f.addStep(SVN(name='svn-clang', |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 569 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 570 | defaultBranch='trunk', |
| 571 | workdir='llvm/tools/clang')) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 572 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 573 | mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 574 | defaultBranch='trunk', |
| 575 | workdir='llvm/tools/clang/tools/extra')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 576 | |
| 577 | # Full & fast clean. |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 578 | if clean: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 579 | f.addStep(ShellCommand(name='clean-1', |
| 580 | command=['del','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 581 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 582 | description='cleaning', |
| 583 | descriptionDone='clean', |
| 584 | workdir='llvm')) |
| 585 | f.addStep(ShellCommand(name='clean-2', |
| 586 | command=['rmdir','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 587 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 588 | description='cleaning', |
| 589 | descriptionDone='clean', |
| 590 | workdir='llvm')) |
| 591 | |
| 592 | # Create the project files. |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 593 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 594 | # Use batch files instead of ShellCommand directly, Windows quoting is |
| 595 | # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 596 | f.addStep(batch_file_download.BatchFileDownload(name='cmakegen', |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 597 | command=[cmake, |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 598 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
Daniel Dunbar | 1ddedce | 2010-09-24 19:57:34 +0000 | [diff] [blame] | 599 | "-DLLVM_INCLUDE_EXAMPLES:=OFF", |
| 600 | "-DLLVM_INCLUDE_TESTS:=OFF", |
| 601 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 602 | "-G", |
| 603 | "Visual Studio 9 2008", |
| 604 | ".."], |
| 605 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 606 | f.addStep(ShellCommand(name='cmake', |
| 607 | command=['cmakegen.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 608 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 609 | description='cmake gen', |
| 610 | workdir='llvm\\build')) |
| 611 | |
| 612 | # Build it. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 613 | f.addStep(batch_file_download.BatchFileDownload(name='vcbuild', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 614 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 615 | "/M%d" % jobs, |
| 616 | "LLVM.sln", |
| 617 | "Debug|Win32"], |
| 618 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 619 | f.addStep(WarningCountingShellCommand(name='vcbuild', |
| 620 | command=['vcbuild.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 621 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 622 | description='vcbuild', |
| 623 | workdir='llvm\\build', |
| 624 | warningPattern=" warning C.*:")) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 625 | |
| 626 | # Build clang-test project. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 627 | f.addStep(batch_file_download.BatchFileDownload(name='vcbuild_test', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 628 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 629 | "clang-test.vcproj", |
| 630 | "Debug|Win32"], |
| 631 | workdir="llvm\\build\\tools\\clang\\test")) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 632 | f.addStep(lit_test_command.LitTestCommand(name='test-clang', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 633 | command=["vcbuild_test.bat"], |
| 634 | workdir="llvm\\build\\tools\\clang\\test")) |
| 635 | |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 636 | return f |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 637 | |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 638 | # Builds on Windows using CMake, MinGW(32|64), and no Microsoft tools. |
Galina Kistanova | 5e97edf | 2012-06-19 20:10:21 +0000 | [diff] [blame] | 639 | def getClangMinGWBuildFactory(update=True, clean=True, jobs=6, cmake=r"cmake"): |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 640 | f = buildbot.process.factory.BuildFactory() |
| 641 | |
| 642 | if update: |
| 643 | f.addStep(SVN(name='svn-llvm', |
| 644 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 645 | defaultBranch='trunk', |
| 646 | workdir='llvm')) |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 647 | f.addStep(SVN(name='svn-clang', |
| 648 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 649 | defaultBranch='trunk', |
| 650 | workdir='llvm/tools/clang')) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 651 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 652 | mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 653 | defaultBranch='trunk', |
| 654 | workdir='llvm/tools/clang/tools/extra')) |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 655 | |
| 656 | # Full & fast clean. |
| 657 | if clean: |
| 658 | # note: This command is redundant as the next command removes everything |
| 659 | f.addStep(ShellCommand(name='clean-1', |
| 660 | command=['del','/s/q','build'], |
| 661 | warnOnFailure=True, |
| 662 | description='cleaning', |
| 663 | descriptionDone='clean', |
| 664 | workdir='llvm')) |
| 665 | f.addStep(ShellCommand(name='clean-2', |
| 666 | command=['rmdir','/s/q','build'], |
| 667 | warnOnFailure=True, |
| 668 | description='cleaning', |
| 669 | descriptionDone='clean', |
| 670 | workdir='llvm')) |
| 671 | |
| 672 | # Create the Makefiles. |
| 673 | |
| 674 | # Use batch files instead of ShellCommand directly, Windows quoting is |
| 675 | # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 676 | f.addStep(batch_file_download.BatchFileDownload(name='cmakegen', |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 677 | command=[cmake, |
| 678 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
| 679 | "-DLLVM_INCLUDE_EXAMPLES:=OFF", |
| 680 | "-DLLVM_INCLUDE_TESTS:=OFF", |
| 681 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
| 682 | "-G", |
Galina Kistanova | 5e97edf | 2012-06-19 20:10:21 +0000 | [diff] [blame] | 683 | "Ninja", |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 684 | ".."], |
| 685 | workdir="llvm\\build")) |
| 686 | f.addStep(ShellCommand(name='cmake', |
| 687 | command=['cmakegen.bat'], |
| 688 | haltOnFailure=True, |
| 689 | description='cmake gen', |
| 690 | workdir='llvm\\build')) |
| 691 | |
| 692 | # Build it. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 693 | f.addStep(batch_file_download.BatchFileDownload(name='makeall', |
Galina Kistanova | 5e97edf | 2012-06-19 20:10:21 +0000 | [diff] [blame] | 694 | command=["ninja", "-j", "%d" % jobs], |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 695 | haltOnFailure=True, |
| 696 | workdir='llvm\\build')) |
| 697 | |
| 698 | f.addStep(WarningCountingShellCommand(name='makeall', |
| 699 | command=['makeall.bat'], |
| 700 | haltOnFailure=True, |
| 701 | description='makeall', |
| 702 | workdir='llvm\\build')) |
| 703 | |
Galina Kistanova | 5e97edf | 2012-06-19 20:10:21 +0000 | [diff] [blame] | 704 | # Build global check project (make check) (sources not checked out...). |
| 705 | if 0: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 706 | f.addStep(batch_file_download.BatchFileDownload(name='makecheck', |
Galina Kistanova | 5e97edf | 2012-06-19 20:10:21 +0000 | [diff] [blame] | 707 | command=["ninja", "check"], |
| 708 | workdir='llvm\\build')) |
| 709 | f.addStep(WarningCountingShellCommand(name='check', |
| 710 | command=['makecheck.bat'], |
| 711 | description='make check', |
| 712 | workdir='llvm\\build')) |
Galina Kistanova | 049d76c | 2012-06-09 00:56:05 +0000 | [diff] [blame] | 713 | |
| 714 | # Build clang-test project (make clang-test). |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 715 | f.addStep(batch_file_download.BatchFileDownload(name='maketest', |
| 716 | command=["ninja", "clang-test"], |
| 717 | workdir="llvm\\build")) |
| 718 | f.addStep(lit_test_command.LitTestCommand(name='clang-test', |
| 719 | command=["maketest.bat"], |
| 720 | workdir="llvm\\build")) |
Galina Kistanova | 2a97a3b | 2012-06-06 20:50:33 +0000 | [diff] [blame] | 721 | return f |
| 722 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 723 | def addClangGCCTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install", |
| 724 | languages = ('gcc', 'g++', 'objc', 'obj-c++')): |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 725 | make_vars = [WithProperties( |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 726 | 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 727 | WithProperties( |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 728 | 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 729 | f.addStep(SVN(name='svn-clang-gcc-tests', mode='update', |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 730 | baseURL='http://llvm.org/svn/llvm-project/clang-tests/', |
| 731 | defaultBranch='trunk', workdir='clang-tests')) |
| 732 | gcc_dg_ignores = ignores.get('gcc-4_2-testsuite', {}) |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 733 | for lang in languages: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 734 | f.addStep(commands.SuppressionDejaGNUCommand.SuppressionDejaGNUCommand( |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 735 | name='test-gcc-4_2-testsuite-%s' % lang, |
| 736 | command=["make", "-k", "check-%s" % lang] + make_vars, |
| 737 | description="gcc-4_2-testsuite (%s)" % lang, |
| 738 | workdir='clang-tests/gcc-4_2-testsuite', |
David Dean | 2bd0c3a | 2011-10-18 16:36:28 +0000 | [diff] [blame] | 739 | logfiles={ 'dg.sum' : 'obj/%s/%s.sum' % (lang, lang), |
| 740 | '%s.log' % lang : 'obj/%s/%s.log' % (lang, lang)}, |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 741 | ignore=gcc_dg_ignores.get(lang, []))) |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 742 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 743 | def addClangGDBTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install"): |
| 744 | make_vars = [WithProperties( |
| 745 | 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), |
| 746 | WithProperties( |
| 747 | 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 748 | f.addStep(SVN(name='svn-clang-gdb-tests', mode='update', |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 749 | baseURL='http://llvm.org/svn/llvm-project/clang-tests/', |
| 750 | defaultBranch='trunk', workdir='clang-tests')) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 751 | f.addStep(commands.SuppressionDejaGNUCommand.SuppressionDejaGNUCommand( |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 752 | name='test-gdb-1472-testsuite', |
| 753 | command=["make", "-k", "check"] + make_vars, |
| 754 | description="gdb-1472-testsuite", |
| 755 | workdir='clang-tests/gdb-1472-testsuite', |
David Blaikie | 7ec695f | 2012-10-09 22:17:09 +0000 | [diff] [blame] | 756 | logfiles={ 'dg.sum' : 'obj/filtered.gdb.sum', |
David Blaikie | 624f439 | 2012-11-05 22:34:35 +0000 | [diff] [blame] | 757 | 'gdb.log' : 'obj/gdb.log' })) |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 758 | |
David Blaikie | 41d09c3 | 2013-01-02 21:11:09 +0000 | [diff] [blame] | 759 | def addModernClangGDBTests(f, jobs, install_prefix): |
David Blaikie | 1bc5c37 | 2012-12-05 05:29:12 +0000 | [diff] [blame] | 760 | make_vars = [WithProperties('RUNTESTFLAGS=CC_FOR_TARGET=\'{0}/bin/clang\' ' |
| 761 | 'CXX_FOR_TARGET=\'{0}/bin/clang++\' ' |
David Blaikie | 759bb75 | 2013-04-18 23:13:11 +0000 | [diff] [blame] | 762 | 'CFLAGS_FOR_TARGET=\'-w -fno-limit-debug-info\'' |
David Blaikie | f89877b | 2013-01-29 23:46:26 +0000 | [diff] [blame] | 763 | .format(install_prefix))] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 764 | f.addStep(SVN(name='svn-clang-modern-gdb-tests', mode='update', |
David Blaikie | f3f300b | 2012-11-17 01:13:41 +0000 | [diff] [blame] | 765 | svnurl='http://llvm.org/svn/llvm-project/clang-tests-external/trunk/gdb/7.5', |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 766 | workdir='clang-tests/src')) |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 767 | f.addStep(Configure(command='../src/configure', |
David Blaikie | f3f300b | 2012-11-17 01:13:41 +0000 | [diff] [blame] | 768 | workdir='clang-tests/build/')) |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 769 | f.addStep(WarningCountingShellCommand(name='gdb-75-build', |
| 770 | command=['make', WithProperties('-j%s' % jobs)], |
| 771 | haltOnFailure=True, |
| 772 | workdir='clang-tests/build')) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 773 | f.addStep(commands.DejaGNUCommand.DejaGNUCommand( |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 774 | name='gdb-75-check', |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 775 | command=['make', '-k', WithProperties('-j%s' % jobs), 'check'] + make_vars, |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 776 | workdir='clang-tests/build', |
David Blaikie | 1bc5c37 | 2012-12-05 05:29:12 +0000 | [diff] [blame] | 777 | logfiles={'dg.sum':'gdb/testsuite/gdb.sum', |
| 778 | 'gdb.log':'gdb/testsuite/gdb.log'})) |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 779 | |
| 780 | |
| 781 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 782 | # FIXME: Deprecated. |
| 783 | addClangTests = addClangGCCTests |
| 784 | |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 785 | def getClangTestsIgnoresFromPath(path, key): |
| 786 | def readList(path): |
| 787 | if not os.path.exists(path): |
| 788 | return [] |
| 789 | |
| 790 | f = open(path) |
| 791 | lines = [ln.strip() for ln in f] |
| 792 | f.close() |
| 793 | return lines |
| 794 | |
| 795 | ignores = {} |
| 796 | |
| 797 | gcc_dg_ignores = {} |
| 798 | for lang in ('gcc', 'g++', 'objc', 'obj-c++'): |
| 799 | lang_path = os.path.join(path, 'gcc-4_2-testsuite', 'expected_results', |
| 800 | key, lang) |
| 801 | gcc_dg_ignores[lang] = ( |
| 802 | readList(os.path.join(lang_path, 'FAIL.txt')) + |
| 803 | readList(os.path.join(lang_path, 'UNRESOLVED.txt')) + |
| 804 | readList(os.path.join(lang_path, 'XPASS.txt'))) |
| 805 | ignores['gcc-4_2-testsuite' ] = gcc_dg_ignores |
| 806 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 807 | ignores_path = os.path.join(path, 'gdb-1472-testsuite', 'expected_results', |
| 808 | key) |
| 809 | gdb_dg_ignores = ( |
| 810 | readList(os.path.join(ignores_path, 'FAIL.txt')) + |
| 811 | readList(os.path.join(ignores_path, 'UNRESOLVED.txt')) + |
| 812 | readList(os.path.join(ignores_path, 'XPASS.txt'))) |
| 813 | ignores['gdb-1472-testsuite' ] = gdb_dg_ignores |
| 814 | |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 815 | return ignores |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 816 | |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 817 | from zorg.buildbot.util.phasedbuilderutils import getBuildDir, setProperty |
Michael Gottesman | 94e9ee4 | 2013-04-04 06:52:04 +0000 | [diff] [blame] | 818 | from zorg.buildbot.builders.Util import _did_last_build_fail |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 819 | from buildbot.steps.source.svn import SVN as HostSVN |
| 820 | |
Michael Gottesman | 94e9ee4 | 2013-04-04 06:52:04 +0000 | [diff] [blame] | 821 | def phasedClang(config_options, is_bootstrap=True, use_lto=False, |
Justin Bogner | 9605b3f | 2014-05-30 23:25:46 +0000 | [diff] [blame] | 822 | incremental=False): |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 823 | # Create an instance of the Builder. |
| 824 | f = buildbot.process.factory.BuildFactory() |
| 825 | # Determine the build directory. |
| 826 | f = getBuildDir(f) |
| 827 | # get rid of old archives from prior builds |
| 828 | f.addStep(buildbot.steps.shell.ShellCommand( |
Chris Matthews | 92ce8e2 | 2014-01-03 21:28:27 +0000 | [diff] [blame] | 829 | name='rm.archives', command=['sh', '-c', 'sudo rm -rfv *gz'], |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 830 | haltOnFailure=False, description=['rm archives'], |
| 831 | workdir=WithProperties('%(builddir)s'))) |
| 832 | # Clean the build directory. |
| 833 | clang_build_dir = 'clang-build' |
Michael Gottesman | 94e9ee4 | 2013-04-04 06:52:04 +0000 | [diff] [blame] | 834 | if incremental: |
| 835 | f.addStep(buildbot.steps.shell.ShellCommand( |
Michael Gottesman | d0ef776 | 2013-10-01 20:50:35 +0000 | [diff] [blame] | 836 | name='rm.clang-build', command=['sudo', 'rm', '-rfv', |
| 837 | clang_build_dir], |
Michael Gottesman | 94e9ee4 | 2013-04-04 06:52:04 +0000 | [diff] [blame] | 838 | haltOnFailure=False, description=['rm dir', clang_build_dir], |
| 839 | workdir=WithProperties('%(builddir)s'), |
| 840 | doStepIf=_did_last_build_fail)) |
| 841 | else: |
| 842 | f.addStep(buildbot.steps.shell.ShellCommand( |
Michael Gottesman | d0ef776 | 2013-10-01 20:50:35 +0000 | [diff] [blame] | 843 | name='rm.clang-build', command=['sudo', 'rm', '-rfv', |
| 844 | clang_build_dir], |
Michael Gottesman | 94e9ee4 | 2013-04-04 06:52:04 +0000 | [diff] [blame] | 845 | haltOnFailure=False, description=['rm dir', clang_build_dir], |
| 846 | workdir=WithProperties('%(builddir)s'))) |
| 847 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 848 | # Cleanup the clang link, which buildbot's SVN always_purge does not know |
| 849 | # (in 8.5 this changed to method='fresh') |
| 850 | # how to remove correctly. If we don't do this, the LLVM update steps will |
| 851 | # end up doing a clobber every time. |
| 852 | # |
| 853 | # FIXME: Should file a Trac for this, but I am lazy. |
| 854 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 855 | name='rm.clang-sources-link', |
Chris Matthews | 92ce8e2 | 2014-01-03 21:28:27 +0000 | [diff] [blame] | 856 | command=['sudo', 'rm', '-rfv', 'llvm/tools/clang'], |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 857 | haltOnFailure=False, description=['rm', 'clang sources link'], |
| 858 | workdir=WithProperties('%(builddir)s'))) |
| 859 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 860 | name='rm.compiler-rt-sources-link', |
Chris Matthews | 92ce8e2 | 2014-01-03 21:28:27 +0000 | [diff] [blame] | 861 | command=['sudo', 'rm', '-rfv', 'llvm/projects/compiler-rt'], |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 862 | haltOnFailure=False, description=['rm', 'compiler-rt sources link'], |
| 863 | workdir=WithProperties('%(builddir)s'))) |
Michael Gottesman | 2db8314 | 2013-08-05 21:44:45 +0000 | [diff] [blame] | 864 | # TODO: We used to use a symlink here but it seems to not work. I am trying |
| 865 | # to get this builder to work so I am just going to copy it instead. |
| 866 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 867 | name='rm.clang-tools-extra-source', |
Chris Matthews | 92ce8e2 | 2014-01-03 21:28:27 +0000 | [diff] [blame] | 868 | command=['sudo', 'rm', '-rfv', 'clang.src/tools/extra'], |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 869 | haltOnFailure=True, workdir=WithProperties('%(builddir)s'), |
Michael Gottesman | 2db8314 | 2013-08-05 21:44:45 +0000 | [diff] [blame] | 870 | description=['rm', 'clang-tools-extra sources'])) |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 871 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 872 | name='rm.debuginfo-tests', |
Chris Matthews | 92ce8e2 | 2014-01-03 21:28:27 +0000 | [diff] [blame] | 873 | command=['sudo', 'rm', '-rfv', 'clang.src/test/debuginfo-tests'], |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 874 | haltOnFailure=True, workdir=WithProperties('%(builddir)s'), |
Michael Gottesman | e92eb12 | 2013-09-08 01:58:27 +0000 | [diff] [blame] | 875 | description=['rm', 'debuginfo-tests sources'])) |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 876 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 877 | # Pull sources. |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 878 | f = phasedbuilderutils.SVNCleanupStep(f, 'llvm') |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 879 | f.addStep(HostSVN(name='pull.llvm', mode='incremental', method='fresh', |
| 880 | repourl='http://llvm.org/svn/llvm-project/llvm/trunk', |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 881 | retry=(60, 5), workdir='llvm', description='pull.llvm', |
| 882 | alwaysUseLatest=False)) |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 883 | f = phasedbuilderutils.SVNCleanupStep(f, 'clang.src') |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 884 | f.addStep(HostSVN(name='pull.clang', mode='incremental', method='fresh', |
| 885 | repourl='http://llvm.org/svn/llvm-project/cfe/trunk', |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 886 | workdir='clang.src', retry=(60, 5), |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 887 | description='pull.clang', alwaysUseLatest=False)) |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 888 | f = phasedbuilderutils.SVNCleanupStep(f, 'clang-tools-extra.src') |
Michael Gottesman | 1dcf8f8 | 2013-03-28 06:20:57 +0000 | [diff] [blame] | 889 | f.addStep(HostSVN(name='pull.clang-tools-extra', mode='incremental', |
| 890 | method='fresh', |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 891 | repourl='http://llvm.org/svn/llvm-project/' |
| 892 | 'clang-tools-extra/trunk', |
Michael Gottesman | 1dcf8f8 | 2013-03-28 06:20:57 +0000 | [diff] [blame] | 893 | workdir='clang-tools-extra.src', alwaysUseLatest=False, |
| 894 | retry=(60, 5), description='pull.clang-tools-extra')) |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 895 | f = phasedbuilderutils.SVNCleanupStep(f, 'compiler-rt.src') |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 896 | f.addStep(HostSVN(name='pull.compiler-rt', mode='incremental', |
| 897 | method='fresh', |
| 898 | repourl='http://llvm.org/svn/llvm-project/compiler-rt/' |
| 899 | 'trunk', |
| 900 | workdir='compiler-rt.src', alwaysUseLatest=False, |
| 901 | retry=(60, 5), description='pull.compiler-rt')) |
Michael Gottesman | 13f8259 | 2013-09-08 01:54:43 +0000 | [diff] [blame] | 902 | f = phasedbuilderutils.SVNCleanupStep(f, 'libcxx.src') |
| 903 | f.addStep(HostSVN(name='pull.libcxx', mode='incremental', |
| 904 | method='fresh', |
| 905 | repourl='http://llvm.org/svn/llvm-project/libcxx/' |
| 906 | 'trunk', |
| 907 | workdir='libcxx.src', alwaysUseLatest=False, |
| 908 | retry=(60, 5), description='pull.libcxx')) |
Michael Gottesman | e92eb12 | 2013-09-08 01:58:27 +0000 | [diff] [blame] | 909 | f = phasedbuilderutils.SVNCleanupStep(f, 'debuginfo-tests.src') |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 910 | f.addStep(HostSVN(name='pull.debuginfo-tests', mode='incremental', |
| 911 | method='fresh', |
| 912 | repourl='http://llvm.org/svn/llvm-project/debuginfo-tests/' |
| 913 | 'trunk', |
| 914 | workdir='debuginfo-tests.src', alwaysUseLatest=False, |
| 915 | retry=(60, 5), description='pull.debuginfo-tests')) |
| 916 | |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 917 | # Create symlinks to the clang compiler-rt sources inside the LLVM tree. |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 918 | # We don't actually check out the sources there, because the SVN purge |
| 919 | # would always remove them then. |
| 920 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 921 | name='ln.clang-sources', haltOnFailure=True, |
| 922 | command=['ln', '-sfv', '../../clang.src', 'clang'], |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 923 | workdir='llvm/tools', description=['ln', 'clang sources'])) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 924 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 925 | name='ln.compiler-rt-sources', |
| 926 | command=['ln', '-sfv', '../../compiler-rt.src', 'compiler-rt'], |
| 927 | haltOnFailure=True, workdir='llvm/projects', |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 928 | description=['ln', 'compiler-rt sources'])) |
Michael Gottesman | 4a68b87 | 2013-03-28 19:03:52 +0000 | [diff] [blame] | 929 | f.addStep(buildbot.steps.shell.ShellCommand( |
Michael Gottesman | 13f8259 | 2013-09-08 01:54:43 +0000 | [diff] [blame] | 930 | name='ln.libcxx.sources', |
| 931 | command=['ln', '-sfv', '../../libcxx.src', 'libcxx'], |
| 932 | haltOnFailure=True, workdir='llvm/projects', |
| 933 | description=['ln', 'libcxx sources'])) |
| 934 | f.addStep(buildbot.steps.shell.ShellCommand( |
Michael Gottesman | bcab199 | 2013-03-28 18:37:21 +0000 | [diff] [blame] | 935 | name='cp.clang-tools-extra-sources', |
Michael Gottesman | 0349592 | 2013-03-28 18:40:44 +0000 | [diff] [blame] | 936 | command=['cp', '-Rfv', '../../clang-tools-extra.src', 'extra'], |
Michael Gottesman | 1dcf8f8 | 2013-03-28 06:20:57 +0000 | [diff] [blame] | 937 | haltOnFailure=True, workdir='clang.src/tools', |
Chris Matthews | ecc0f44 | 2014-03-12 00:04:23 +0000 | [diff] [blame] | 938 | description=['cp', 'clang-tools-extra sources'])) |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 939 | f.addStep(buildbot.steps.shell.ShellCommand( |
Michael Gottesman | e92eb12 | 2013-09-08 01:58:27 +0000 | [diff] [blame] | 940 | name='cp.debuginfo-tests.sources', |
| 941 | command=['cp', '-Rfv', 'debuginfo-tests.src', |
| 942 | 'clang.src/test/debuginfo-tests'], |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 943 | haltOnFailure=True, workdir=WithProperties('%(builddir)s'), |
Michael Gottesman | e92eb12 | 2013-09-08 01:58:27 +0000 | [diff] [blame] | 944 | description=['cp', 'debuginfo-tests sources'])) |
Michael Gottesman | 6ba2d2a | 2013-09-08 01:54:45 +0000 | [diff] [blame] | 945 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 946 | # Clean the install directory. |
| 947 | f.addStep(buildbot.steps.shell.ShellCommand( |
Chris Matthews | 92ce8e2 | 2014-01-03 21:28:27 +0000 | [diff] [blame] | 948 | name='rm.clang-install', command=['sudo', 'rm', '-rfv', 'clang-install'], |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 949 | haltOnFailure=False, description=['rm dir', 'clang-install'], |
| 950 | workdir=WithProperties('%(builddir)s'))) |
| 951 | # Construct the configure arguments. |
| 952 | configure_args = ['../llvm/configure'] |
| 953 | configure_args.extend(config_options) |
Galina Kistanova | 702eccb | 2013-08-22 00:09:17 +0000 | [diff] [blame] | 954 | configure_args.extend(['--disable-bindings', |
Michael Gottesman | 6f85f93 | 2014-06-27 23:49:58 +0000 | [diff] [blame] | 955 | '--enable-keep-symbols', |
Michael Gottesman | 0fd485a | 2014-08-02 01:42:51 +0000 | [diff] [blame] | 956 | '--enable-targets=x86,x86_64,arm,aarch64']) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 957 | configure_args.append( |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 958 | WithProperties('--prefix=%(builddir)s/clang-install')) |
Michael Gottesman | ca56e8f | 2013-03-06 22:27:38 +0000 | [diff] [blame] | 959 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 960 | # If we are using a previously built compiler, download it and override CC |
| 961 | # and CXX. |
| 962 | if is_bootstrap: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 963 | f = artifacts.GetCompilerArtifacts(f) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 964 | else: |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 965 | f = phasedbuilderutils.GetLatestValidated(f) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 966 | cc_command = ['find', 'host-compiler', '-name', 'clang'] |
| 967 | f.addStep(buildbot.steps.shell.SetProperty( |
| 968 | name='find.cc', |
| 969 | command=cc_command, |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 970 | extract_fn=phasedbuilderutils.find_cc, |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 971 | workdir=WithProperties('%(builddir)s'))) |
| 972 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 973 | name='sanity.test', haltOnFailure=True, |
| 974 | command=[WithProperties('%(builddir)s/%(cc_path)s'), '-v'], |
| 975 | description=['sanity test'])) |
| 976 | configure_args.extend([ |
| 977 | WithProperties('CC=%(builddir)s/%(cc_path)s'), |
| 978 | WithProperties('CXX=%(builddir)s/%(cc_path)s++')]) |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 979 | |
| 980 | # If we need to use lto, find liblto, add in proper flags here, etc. |
| 981 | if use_lto: |
Michael Gottesman | 01f0a62 | 2013-03-13 22:38:38 +0000 | [diff] [blame] | 982 | liblto_command = ['find', WithProperties('%(builddir)s/host-compiler'), |
| 983 | '-name', 'libLTO.dylib'] |
Michael Gottesman | 1da57ae | 2013-03-13 21:54:23 +0000 | [diff] [blame] | 984 | f.addStep(buildbot.steps.shell.SetProperty( |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 985 | name='find.liblto', |
| 986 | command=liblto_command, |
Michael Gottesman | dc771a0 | 2013-08-30 05:46:22 +0000 | [diff] [blame] | 987 | extract_fn=phasedbuilderutils.find_liblto, |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 988 | workdir=WithProperties('%(builddir)s'))) |
| 989 | configure_args.append( |
| 990 | '--with-extra-options=-flto -gline-tables-only') |
| 991 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 992 | # Configure the LLVM build. |
Michael Gottesman | d97d850 | 2013-04-04 07:57:31 +0000 | [diff] [blame] | 993 | if incremental: |
| 994 | # *NOTE* This is a temporary work around. I am eventually going to just |
| 995 | # set up cmake/ninja but for now I am sticking with the make => I need |
| 996 | # configure to run only after a failure so on success I have incremental |
| 997 | # builds. |
| 998 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 999 | name='configure.with.host', command=configure_args, |
| 1000 | haltOnFailure=True, description=['configure'], |
| 1001 | workdir=clang_build_dir, |
| 1002 | doStepIf=_did_last_build_fail)) |
| 1003 | else: |
| 1004 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 1005 | name='configure.with.host', command=configure_args, |
| 1006 | haltOnFailure=True, description=['configure'], |
| 1007 | workdir=clang_build_dir)) |
| 1008 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 1009 | # Build the compiler. |
Michael Gottesman | 3677883 | 2013-09-08 01:37:35 +0000 | [diff] [blame] | 1010 | make_command = ['make', '-j', WithProperties('%(jobs)s'), 'VERBOSE=1'] |
Galina Kistanova | bfb29d2 | 2013-05-09 23:53:24 +0000 | [diff] [blame] | 1011 | timeout = 40*60 # Normal timeout is 20 minutes. |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 1012 | if use_lto: |
| 1013 | make_command.append(WithProperties('DYLD_LIBRARY_PATH=%(liblto_path)s')) |
Michael Gottesman | 2e7385c | 2013-08-12 17:57:27 +0000 | [diff] [blame] | 1014 | timeout = 240*60 # LTO timeout is 240 minutes. |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 1015 | |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 1016 | f.addStep(buildbot.steps.shell.ShellCommand( |
Michael Gottesman | 65d940f | 2013-03-13 21:51:16 +0000 | [diff] [blame] | 1017 | name='make', command=make_command, |
Michael Gottesman | bab77ac | 2013-03-14 05:36:53 +0000 | [diff] [blame] | 1018 | haltOnFailure=True, description=['make'], workdir=clang_build_dir, |
| 1019 | timeout=timeout)) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 1020 | # Use make install-clang to produce minimal archive for use by downstream |
| 1021 | # builders. |
| 1022 | f.addStep(buildbot.steps.shell.ShellCommand( |
| 1023 | name='make.install-clang', haltOnFailure=True, |
Michael Gottesman | f8748fb | 2013-03-28 06:21:03 +0000 | [diff] [blame] | 1024 | command=['make', 'install-clang', '-j', |
| 1025 | WithProperties('%(jobs)s'), |
| 1026 | 'RC_SUPPORTED_ARCHS=armv7 i386 x86_64'], |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 1027 | description=['make install'], workdir=clang_build_dir)) |
| 1028 | # Save artifacts of this build for use by other builders. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 1029 | f = artifacts.uploadArtifacts(f) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 1030 | # Run the LLVM and Clang regression tests. |
Michael Gottesman | a9c32be | 2013-09-06 17:47:24 +0000 | [diff] [blame] | 1031 | cmd_str = r"""make VERBOSE=1 LIT_ARGS="-v --param run_long_tests=true --filter='^(?!.*debuginfo-tests)'" check-all""" |
| 1032 | f.addStep(lit_test_command.LitTestCommand(name='run.llvm.tests', haltOnFailure=True, |
| 1033 | command=cmd_str, |
| 1034 | description=['all', 'tests'], |
| 1035 | workdir=clang_build_dir)) |
| 1036 | # Work around for lldb issue rdar://14929651 |
Chris Matthews | ecc0f44 | 2014-03-12 00:04:23 +0000 | [diff] [blame] | 1037 | # The crazy filter regex is to remove static-member[2].cpp, which requires xcode5 or later. |
| 1038 | # radar://16295455 tracks the removal of this regex. |
| 1039 | cmd_str = r"""make VERBOSE=1 LIT_ARGS="-j 1 -v --param run_long_tests=true --filter='debuginfo-tests.(?!static-member)'" check-all""" |
Michael Gottesman | 7538231 | 2013-09-08 02:15:08 +0000 | [diff] [blame] | 1040 | f.addStep(lit_test_command.LitTestCommand(name='run.llvm.debuginfo-tests', haltOnFailure=True, |
Michael Gottesman | e7dc31e | 2013-08-30 05:57:35 +0000 | [diff] [blame] | 1041 | command=cmd_str, |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 1042 | description=['all', 'tests'], |
| 1043 | workdir=clang_build_dir)) |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 1044 | return f |