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