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