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