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, |
Galina Kistanova | 2ab1e2d | 2016-11-22 00:23:43 +0000 | [diff] [blame] | 43 | checkout_lld=False, |
David Blaikie | a76da84 | 2012-08-13 22:24:46 +0000 | [diff] [blame] | 44 | run_gdb=False, |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 45 | run_modern_gdb=False, |
Vassil Vassilev | 0c647ef | 2016-06-30 21:16:45 +0000 | [diff] [blame] | 46 | run_gcc=False): |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 47 | # Prepare environmental variables. Set here all env we want everywhere. |
| 48 | merged_env = { |
| 49 | 'TERM' : 'dumb' # Make sure Clang doesn't use color escape sequences. |
| 50 | } |
| 51 | if env is not None: |
| 52 | # Overwrite pre-set items with the given ones, so user can set anything. |
| 53 | merged_env.update(env) |
David Blaikie | 2f7eb28 | 2012-08-24 18:37:00 +0000 | [diff] [blame] | 54 | |
Jonathan Roelofs | 62415e5 | 2015-02-28 00:03:17 +0000 | [diff] [blame] | 55 | llvm_srcdir = "llvm.src" |
| 56 | llvm_1_objdir = "llvm.obj" |
| 57 | llvm_1_installdir = "llvm.install.1" |
| 58 | llvm_2_objdir = "llvm.obj.2" |
| 59 | llvm_2_installdir = "llvm.install" |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 60 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 61 | f = buildbot.process.factory.BuildFactory() |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 62 | |
| 63 | # Determine the build directory. |
| 64 | f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir", |
| 65 | command=["pwd"], |
| 66 | property="builddir", |
| 67 | description="set build dir", |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 68 | workdir=".", |
| 69 | env=merged_env)) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 70 | |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 71 | # Blow away completely, if requested. |
| 72 | if completely_clean: |
| 73 | f.addStep(ShellCommand(name="rm-llvm.src", |
| 74 | command=["rm", "-rf", llvm_srcdir], |
| 75 | haltOnFailure=True, |
| 76 | description=["rm src dir", "llvm"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 77 | workdir=".", |
| 78 | env=merged_env)) |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 79 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 80 | # Checkout sources. |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 81 | if trunk_revision: |
| 82 | # The SVN build step provides no mechanism to check out a specific revision |
| 83 | # based on a property, so just run the commands directly here. |
| 84 | svn_co = ['svn', 'checkout'] |
| 85 | if force_checkout: |
| 86 | svn_co += ['--force'] |
| 87 | svn_co += ['--revision', WithProperties(trunk_revision)] |
| 88 | |
| 89 | svn_co_llvm = svn_co + \ |
| 90 | [WithProperties('http://llvm.org/svn/llvm-project/llvm/trunk@%s' % |
| 91 | trunk_revision), |
| 92 | llvm_srcdir] |
| 93 | svn_co_clang = svn_co + \ |
| 94 | [WithProperties('http://llvm.org/svn/llvm-project/cfe/trunk@%s' % |
| 95 | trunk_revision), |
| 96 | '%s/tools/clang' % llvm_srcdir] |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 97 | svn_co_clang_tools_extra = svn_co + \ |
| 98 | [WithProperties('http://llvm.org/svn/llvm-project/clang-tools-extra/trunk@%s' % |
| 99 | trunk_revision), |
| 100 | '%s/tools/clang/tools/extra' % llvm_srcdir] |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 101 | |
| 102 | f.addStep(ShellCommand(name='svn-llvm', |
| 103 | command=svn_co_llvm, |
| 104 | haltOnFailure=True, |
| 105 | workdir='.')) |
| 106 | f.addStep(ShellCommand(name='svn-clang', |
| 107 | command=svn_co_clang, |
| 108 | haltOnFailure=True, |
| 109 | workdir='.')) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 110 | f.addStep(ShellCommand(name='svn-clang-tools-extra', |
| 111 | command=svn_co_clang_tools_extra, |
| 112 | haltOnFailure=True, |
| 113 | workdir='.')) |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 114 | else: |
| 115 | f.addStep(SVN(name='svn-llvm', |
Daniel Dunbar | f4e23eb | 2010-09-20 21:13:02 +0000 | [diff] [blame] | 116 | mode='update', |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 117 | baseURL='http://llvm.org/svn/llvm-project/llvm/', |
Daniel Dunbar | f4e23eb | 2010-09-20 21:13:02 +0000 | [diff] [blame] | 118 | defaultBranch='trunk', |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 119 | workdir=llvm_srcdir)) |
| 120 | f.addStep(SVN(name='svn-clang', |
| 121 | mode='update', |
| 122 | baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 123 | defaultBranch='trunk', |
| 124 | workdir='%s/tools/clang' % llvm_srcdir)) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 125 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 126 | mode='update', |
| 127 | baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 128 | defaultBranch='trunk', |
| 129 | workdir='%s/tools/clang/tools/extra' % llvm_srcdir)) |
Peter Collingbourne | d49ac28 | 2011-10-25 14:38:45 +0000 | [diff] [blame] | 130 | if checkout_compiler_rt: |
| 131 | f.addStep(SVN(name='svn-compiler-rt', |
| 132 | mode='update', |
| 133 | baseURL='http://llvm.org/svn/llvm-project/compiler-rt/', |
| 134 | defaultBranch='trunk', |
| 135 | workdir='%s/projects/compiler-rt' % llvm_srcdir)) |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 136 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 137 | # Clean up llvm (stage 1); unless in-dir. |
| 138 | if clean and llvm_srcdir != llvm_1_objdir: |
| 139 | f.addStep(ShellCommand(name="rm-llvm.obj.stage1", |
| 140 | command=["rm", "-rf", llvm_1_objdir], |
| 141 | haltOnFailure=True, |
| 142 | description=["rm build dir", "llvm"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 143 | workdir=".", |
| 144 | env=merged_env)) |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 145 | |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 146 | if not clean: |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 147 | expected_makefile = 'Makefile' |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 148 | f.addStep(SetProperty(name="Makefile_isready", |
| 149 | workdir=llvm_1_objdir, |
| 150 | command=["sh", "-c", |
Richard Smith | 0238916 | 2014-09-26 23:53:06 +0000 | [diff] [blame] | 151 | "test -e %s && echo OK || echo Missing" % expected_makefile], |
David Blaikie | 8cbf62f | 2013-01-12 21:32:31 +0000 | [diff] [blame] | 152 | flunkOnFailure=False, |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 153 | property="exists_Makefile")) |
Richard Smith | 0238916 | 2014-09-26 23:53:06 +0000 | [diff] [blame] | 154 | |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 155 | cmake_triple_arg = [] |
| 156 | if triple: |
| 157 | cmake_triple_arg = ['-DLLVM_HOST_TRIPLE=%s' % triple] |
| 158 | f.addStep(ShellCommand(name='cmake', |
| 159 | command=['cmake', |
| 160 | '-DLLVM_BUILD_TESTS=ON', |
| 161 | '-DCMAKE_BUILD_TYPE=%s' % stage1_config] + |
| 162 | cmake_triple_arg + |
| 163 | extra_configure_args + |
| 164 | ["../" + llvm_srcdir], |
| 165 | description='cmake stage1', |
| 166 | workdir=llvm_1_objdir, |
| 167 | env=merged_env, |
| 168 | doStepIf=lambda step: step.build.getProperty("exists_Makefile") != "OK")) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 169 | |
| 170 | # Make clean if using in-dir builds. |
| 171 | if clean and llvm_srcdir == llvm_1_objdir: |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 172 | f.addStep(WarningCountingShellCommand(name="clean-llvm", |
Daniel Dunbar | d20468a | 2009-11-24 18:27:23 +0000 | [diff] [blame] | 173 | command=[make, "clean"], |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 174 | haltOnFailure=True, |
| 175 | description="cleaning llvm", |
| 176 | descriptionDone="clean llvm", |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 177 | workdir=llvm_1_objdir, |
Peter Collingbourne | 7a95b0c | 2011-10-26 16:40:17 +0000 | [diff] [blame] | 178 | doStepIf=clean, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 179 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 180 | |
Peter Collingbourne | 7a95b0c | 2011-10-26 16:40:17 +0000 | [diff] [blame] | 181 | if extra_clean_step: |
| 182 | f.addStep(extra_clean_step) |
| 183 | |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 184 | f.addStep(WarningCountingShellCommand(name="compile", |
Daniel Dunbar | d20468a | 2009-11-24 18:27:23 +0000 | [diff] [blame] | 185 | command=['nice', '-n', '10', |
| 186 | make, WithProperties("-j%s" % jobs)], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 187 | haltOnFailure=True, |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 188 | flunkOnFailure=not run_gdb, |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 189 | description=["compiling", stage1_config], |
| 190 | descriptionDone=["compile", stage1_config], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 191 | workdir=llvm_1_objdir, |
| 192 | env=merged_env)) |
Daniel Dunbar | 256fed4 | 2009-11-25 21:11:08 +0000 | [diff] [blame] | 193 | |
| 194 | if examples: |
| 195 | f.addStep(WarningCountingShellCommand(name="compile.examples", |
| 196 | command=['nice', '-n', '10', |
| 197 | make, WithProperties("-j%s" % jobs), |
| 198 | "BUILD_EXAMPLES=1"], |
| 199 | haltOnFailure=True, |
Richard Smith | 65e6f5d | 2014-09-25 18:18:35 +0000 | [diff] [blame] | 200 | description=["compiling", stage1_config, "examples"], |
Daniel Dunbar | 256fed4 | 2009-11-25 21:11:08 +0000 | [diff] [blame] | 201 | descriptionDone=["compile", stage1_config, "examples"], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 202 | workdir=llvm_1_objdir, |
| 203 | env=merged_env)) |
Daniel Dunbar | 256fed4 | 2009-11-25 21:11:08 +0000 | [diff] [blame] | 204 | |
NAKAMURA Takumi | 1a4666b | 2013-01-19 03:39:07 +0000 | [diff] [blame] | 205 | clangTestArgs = '-v -j %s' % jobs |
Daniel Dunbar | fa0e022 | 2009-11-09 06:08:28 +0000 | [diff] [blame] | 206 | if valgrind: |
Daniel Dunbar | 89184b9 | 2010-04-18 19:09:32 +0000 | [diff] [blame] | 207 | clangTestArgs += ' --vg' |
Daniel Dunbar | a1bebce | 2010-03-21 01:24:00 +0000 | [diff] [blame] | 208 | if valgrindLeakCheck: |
| 209 | clangTestArgs += ' --vg-leak' |
Nick Lewycky | 8d26e47 | 2011-08-27 21:18:56 +0000 | [diff] [blame] | 210 | 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] | 211 | extraTestDirs = '' |
| 212 | if run_cxx_tests: |
| 213 | extraTestDirs += '%(builddir)s/llvm/tools/clang/utils/C++Tests' |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 214 | if test: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 215 | f.addStep(lit_test_command.LitTestCommand(name='check-all', |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 216 | command=[make, "check-all", "VERBOSE=1", |
NAKAMURA Takumi | 1a4666b | 2013-01-19 03:39:07 +0000 | [diff] [blame] | 217 | WithProperties("LIT_ARGS=%s" % clangTestArgs), |
David Blaikie | bc68401 | 2012-12-27 20:44:19 +0000 | [diff] [blame] | 218 | WithProperties("EXTRA_TESTDIRS=%s" % extraTestDirs)], |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 219 | flunkOnFailure=not run_gdb, |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 220 | description=["checking"], |
| 221 | descriptionDone=["checked"], |
Daniel Dunbar | 469e8ca | 2010-05-19 21:26:48 +0000 | [diff] [blame] | 222 | workdir=llvm_1_objdir, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 223 | usePTY=use_pty_in_tests, |
| 224 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 225 | |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 226 | # TODO: Install llvm and clang for stage1. |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 227 | |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 228 | if run_gdb or run_gcc or run_modern_gdb: |
David Blaikie | a76da84 | 2012-08-13 22:24:46 +0000 | [diff] [blame] | 229 | ignores = getClangTestsIgnoresFromPath(os.path.expanduser('~/public/clang-tests'), 'clang-x86_64-darwin10') |
| 230 | install_prefix = "%%(builddir)s/%s" % llvm_1_installdir |
| 231 | if run_gdb: |
| 232 | addClangGDBTests(f, ignores, install_prefix) |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 233 | if run_modern_gdb: |
David Blaikie | 41d09c3 | 2013-01-02 21:11:09 +0000 | [diff] [blame] | 234 | addModernClangGDBTests(f, jobs, install_prefix) |
David Blaikie | a76da84 | 2012-08-13 22:24:46 +0000 | [diff] [blame] | 235 | if run_gcc: |
| 236 | addClangGCCTests(f, ignores, install_prefix) |
| 237 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 238 | if not useTwoStage: |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 239 | if package_dst: |
| 240 | name = WithProperties( |
| 241 | "%(builddir)s/" + llvm_1_objdir + |
| 242 | "/clang-r%(got_revision)s-b%(buildnumber)s.tgz") |
| 243 | f.addStep(ShellCommand(name='pkg.tar', |
| 244 | description="tar root", |
| 245 | command=["tar", "zcvf", name, "./"], |
| 246 | workdir=llvm_1_installdir, |
| 247 | warnOnFailure=True, |
| 248 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 249 | haltOnFailure=False, |
| 250 | env=merged_env)) |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 251 | f.addStep(ShellCommand(name='pkg.upload', |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 252 | description="upload root", |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 253 | command=["scp", name, |
| 254 | WithProperties( |
| 255 | package_dst + "/%(buildername)s")], |
| 256 | workdir=".", |
| 257 | warnOnFailure=True, |
| 258 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 259 | haltOnFailure=False, |
| 260 | env=merged_env)) |
Daniel Dunbar | dedf657 | 2010-11-13 00:23:34 +0000 | [diff] [blame] | 261 | |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 262 | return f |
| 263 | |
| 264 | # Clean up llvm (stage 2). |
Richard Smith | 0238916 | 2014-09-26 23:53:06 +0000 | [diff] [blame] | 265 | # |
Galina Kistanova | 7990097 | 2015-11-16 17:30:42 +0000 | [diff] [blame] | 266 | # We always cleanly build the stage 2. If the compiler has been |
| 267 | # changed on the stage 1, we cannot trust any of the intermediate file |
| 268 | # from the old compiler. And if the stage 1 compiler is the same, we should |
| 269 | # not build in the first place. |
| 270 | f.addStep(ShellCommand(name="rm-llvm.obj.stage2", |
| 271 | command=["rm", "-rf", llvm_2_objdir], |
| 272 | haltOnFailure=True, |
| 273 | description=["rm build dir", "llvm", "(stage 2)"], |
| 274 | workdir=".", |
| 275 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 276 | |
| 277 | # Configure llvm (stage 2). |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 278 | f.addStep(ShellCommand(name='cmake', |
Vassil Vassilev | 5a9b9ed | 2016-05-25 17:10:03 +0000 | [diff] [blame] | 279 | command=['cmake'] + stage2_extra_configure_args + [ |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 280 | '-DLLVM_BUILD_TESTS=ON', |
| 281 | WithProperties('-DCMAKE_C_COMPILER=%%(builddir)s/%s/bin/clang' % llvm_1_objdir), # FIXME use installdir |
| 282 | WithProperties('-DCMAKE_CXX_COMPILER=%%(builddir)s/%s/bin/clang++' % llvm_1_objdir), |
| 283 | '-DCMAKE_BUILD_TYPE=%s' % stage2_config, |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 284 | "../" + llvm_srcdir], |
| 285 | description='cmake stage2', |
| 286 | workdir=llvm_2_objdir, |
| 287 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 288 | |
| 289 | # Build llvm (stage 2). |
| 290 | f.addStep(WarningCountingShellCommand(name="compile.llvm.stage2", |
| 291 | command=['nice', '-n', '10', |
| 292 | make, WithProperties("-j%s" % jobs)], |
| 293 | haltOnFailure=True, |
| 294 | description=["compiling", "(stage 2)", |
| 295 | stage2_config], |
| 296 | descriptionDone=["compile", "(stage 2)", |
| 297 | stage2_config], |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 298 | workdir=llvm_2_objdir, |
| 299 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 300 | |
| 301 | if test: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 302 | f.addStep(lit_test_command.LitTestCommand(name='check-all', |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 303 | command=[make, "check-all", "VERBOSE=1", |
NAKAMURA Takumi | 1a4666b | 2013-01-19 03:39:07 +0000 | [diff] [blame] | 304 | WithProperties("LIT_ARGS=%s" % clangTestArgs), |
David Blaikie | bc68401 | 2012-12-27 20:44:19 +0000 | [diff] [blame] | 305 | WithProperties("EXTRA_TESTDIRS=%s" % extraTestDirs)], |
David Blaikie | 7e6f8a1 | 2012-08-31 20:46:27 +0000 | [diff] [blame] | 306 | description=["checking"], |
| 307 | descriptionDone=["checked"], |
Daniel Dunbar | 469e8ca | 2010-05-19 21:26:48 +0000 | [diff] [blame] | 308 | workdir=llvm_2_objdir, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 309 | usePTY=use_pty_in_tests, |
| 310 | env=merged_env)) |
Daniel Dunbar | 8a89a6f | 2009-11-25 04:27:32 +0000 | [diff] [blame] | 311 | |
Galina Kistanova | a06e4c8 | 2016-04-14 21:41:30 +0000 | [diff] [blame] | 312 | # TODO: Install llvm and clang for stage2. |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 313 | |
| 314 | if package_dst: |
| 315 | name = WithProperties( |
| 316 | "%(builddir)s/" + llvm_2_objdir + |
| 317 | "/clang-r%(got_revision)s-b%(buildnumber)s.tgz") |
| 318 | f.addStep(ShellCommand(name='pkg.tar', |
| 319 | description="tar root", |
| 320 | command=["tar", "zcvf", name, "./"], |
| 321 | workdir=llvm_2_installdir, |
| 322 | warnOnFailure=True, |
| 323 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 324 | haltOnFailure=False, |
| 325 | env=merged_env)) |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 326 | f.addStep(ShellCommand(name='pkg.upload', |
Andrew Trick | 70fa9d2 | 2011-08-25 23:38:51 +0000 | [diff] [blame] | 327 | description="upload root", |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 328 | command=["scp", name, |
| 329 | WithProperties( |
| 330 | package_dst + "/%(buildername)s")], |
| 331 | workdir=".", |
| 332 | warnOnFailure=True, |
| 333 | flunkOnFailure=False, |
Galina Kistanova | f4d7935 | 2011-10-20 20:46:52 +0000 | [diff] [blame] | 334 | haltOnFailure=False, |
| 335 | env=merged_env)) |
Daniel Dunbar | 3efb782 | 2010-02-26 19:20:00 +0000 | [diff] [blame] | 336 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 337 | return f |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 338 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 339 | def addSVNUpdateSteps(f, |
| 340 | checkout_clang_tools_extra, |
| 341 | checkout_compiler_rt, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 342 | checkout_test_suite, |
Artem Belevich | 16fcd0e | 2016-12-21 21:15:56 +0000 | [diff] [blame^] | 343 | checkout_lld, |
| 344 | checkout_libcxx): |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 345 | # We *must* checkout at least Clang+LLVM |
| 346 | f.addStep(SVN(name='svn-llvm', |
| 347 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 348 | defaultBranch='trunk', |
| 349 | workdir='llvm')) |
| 350 | f.addStep(SVN(name='svn-clang', |
| 351 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 352 | defaultBranch='trunk', |
| 353 | workdir='llvm/tools/clang')) |
| 354 | |
| 355 | # Extra stuff that will be built/tested |
| 356 | if checkout_clang_tools_extra: |
| 357 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 358 | mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 359 | defaultBranch='trunk', |
| 360 | workdir='llvm/tools/clang/tools/extra')) |
| 361 | if checkout_compiler_rt: |
| 362 | f.addStep(SVN(name='svn-compiler-rt', |
| 363 | mode='update', baseURL='http://llvm.org/svn/llvm-project/compiler-rt/', |
| 364 | defaultBranch='trunk', |
| 365 | workdir='llvm/projects/compiler-rt')) |
| 366 | if checkout_test_suite: |
| 367 | f.addStep(SVN(name='svn-lnt', |
| 368 | mode='update', baseURL='http://llvm.org/svn/llvm-project/lnt/', |
| 369 | defaultBranch='trunk', |
| 370 | workdir='test/lnt')) |
| 371 | f.addStep(SVN(name='svn-test-suite', |
| 372 | mode='update', baseURL='http://llvm.org/svn/llvm-project/test-suite/', |
| 373 | defaultBranch='trunk', |
| 374 | workdir='test/test-suite')) |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 375 | if checkout_lld: |
| 376 | f.addStep(SVN(name='svn-lld', |
| 377 | mode='update', baseURL='http://llvm.org/svn/llvm-project/lld/', |
| 378 | defaultBranch='trunk', |
| 379 | workdir='llvm/tools/lld')) |
Artem Belevich | 16fcd0e | 2016-12-21 21:15:56 +0000 | [diff] [blame^] | 380 | if checkout_libcxx: |
| 381 | f.addStep(SVN(name='svn-libcxx', |
| 382 | mode='update', |
| 383 | baseURL='http://llvm.org/svn/llvm-project/libcxx/', |
| 384 | defaultBranch='trunk', |
| 385 | workdir='llvm/projects/libcxx')) |
| 386 | f.addStep(SVN(name='svn-libcxxabi', |
| 387 | mode='update', |
| 388 | baseURL='http://llvm.org/svn/llvm-project/libcxxabi/', |
| 389 | defaultBranch='trunk', |
| 390 | workdir='llvm/projects/libcxxabi')) |
| 391 | f.addStep(SVN(name='svn-libunwind', |
| 392 | mode='update', |
| 393 | baseURL='http://llvm.org/svn/llvm-project/libunwind/', |
| 394 | defaultBranch='trunk', |
| 395 | workdir='llvm/projects/libunwind')) |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 396 | |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 397 | def addGCSUploadSteps(f, package_name, install_prefix, gcs_directory, env, |
| 398 | gcs_url_property=None): |
| 399 | """ |
| 400 | Add steps to upload to the Google Cloud Storage bucket. |
| 401 | |
| 402 | f - The BuildFactory to modify. |
| 403 | package_name - The name of this package for the descriptions (e.g. |
| 404 | 'stage 1') |
| 405 | install_prefix - The directory the build has been installed to. |
| 406 | gcs_directory - The subdirectory of the bucket root to upload to. This |
| 407 | should match the builder name. |
| 408 | env - The environment to use. Set BOTO_CONFIG to use a configuration file |
| 409 | in a non-standard location, and BUCKET to use a different GCS bucket. |
| 410 | gcs_url_property - Property to assign the GCS url to. |
| 411 | """ |
| 412 | |
| 413 | gcs_url_fmt = ('gs://%(gcs_bucket)s/%(gcs_directory)s/' |
| 414 | 'clang-r%(got_revision)s-t%(now)s-b%(buildnumber)s.tar.xz') |
| 415 | time_fmt = '%Y-%m-%d_%H-%M-%S' |
| 416 | gcs_url = \ |
| 417 | WithProperties( |
| 418 | gcs_url_fmt, |
| 419 | gcs_bucket=lambda _: env.get('BUCKET', 'llvm-build-artifacts'), |
| 420 | gcs_directory=lambda _: gcs_directory, |
| 421 | now=lambda _: datetime.utcnow().strftime(time_fmt)) |
| 422 | |
| 423 | if gcs_url_property: |
| 424 | f.addStep(SetProperty( |
| 425 | name="record GCS url for " + package_name, |
| 426 | command=['echo', gcs_url], |
| 427 | property=gcs_url_property)) |
| 428 | |
| 429 | f.addStep(ShellCommand(name='package ' + package_name, |
| 430 | command=['tar', 'cvfJ', '../install.tar.xz', '.'], |
| 431 | description='packaging ' + package_name + '...', |
| 432 | workdir=install_prefix, |
| 433 | env=env)) |
| 434 | |
| 435 | f.addStep(ShellCommand( |
| 436 | name='upload ' + package_name + ' to storage bucket', |
| 437 | command=['gsutil', 'cp', '../install.tar.xz', gcs_url], |
| 438 | description=('uploading ' + package_name + |
| 439 | 'to storage bucket ...'), |
| 440 | workdir=install_prefix, |
| 441 | env=env)) |
| 442 | |
| 443 | def getClangCMakeGCSBuildFactory( |
| 444 | clean=True, |
| 445 | test=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 446 | cmake='cmake', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 447 | jobs=None, |
| 448 | |
| 449 | # VS tools environment variable if using MSVC. For example, |
| 450 | # %VS120COMNTOOLS% selects the 2013 toolchain. |
| 451 | vs=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 452 | vs_target_arch='x86', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 453 | |
| 454 | # Multi-stage compilation |
| 455 | useTwoStage=False, |
| 456 | testStage1=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 457 | stage1_config='Release', |
| 458 | stage2_config='Release', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 459 | |
| 460 | # Test-suite |
| 461 | runTestSuite=False, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 462 | nt_flags=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 463 | submitURL=None, |
| 464 | testerName=None, |
| 465 | |
| 466 | # Environmental variables for all steps. |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 467 | env={}, |
| 468 | extra_cmake_args=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 469 | |
| 470 | # Extra repositories |
| 471 | checkout_clang_tools_extra=True, |
| 472 | checkout_compiler_rt=True, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 473 | checkout_lld=True, |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 474 | |
| 475 | # Upload artifacts to Google Cloud Storage (for the llvmbisect tool) |
| 476 | stage1_upload_directory=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 477 | |
| 478 | # Triggers |
| 479 | trigger_after_stage1=[]): |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 480 | return _getClangCMakeBuildFactory( |
| 481 | clean=clean, test=test, cmake=cmake, jobs=jobs, vs=vs, |
| 482 | vs_target_arch=vs_target_arch, useTwoStage=useTwoStage, |
| 483 | testStage1=testStage1, stage1_config=stage1_config, |
| 484 | stage2_config=stage2_config, runTestSuite=runTestSuite, |
| 485 | nt_flags=nt_flags, submitURL=submitURL, testerName=testerName, |
| 486 | env=env, extra_cmake_args=extra_cmake_args, |
| 487 | checkout_clang_tools_extra=checkout_clang_tools_extra, |
| 488 | checkout_compiler_rt=checkout_compiler_rt, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 489 | checkout_lld=checkout_lld, |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 490 | stage1_upload_directory=stage1_upload_directory, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 491 | trigger_after_stage1=trigger_after_stage1) |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 492 | |
| 493 | def getClangCMakeBuildFactory( |
| 494 | clean=True, |
| 495 | test=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 496 | cmake='cmake', |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 497 | jobs=None, |
| 498 | |
| 499 | # VS tools environment variable if using MSVC. For example, |
| 500 | # %VS120COMNTOOLS% selects the 2013 toolchain. |
| 501 | vs=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 502 | vs_target_arch='x86', |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 503 | |
| 504 | # Multi-stage compilation |
| 505 | useTwoStage=False, |
| 506 | testStage1=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 507 | stage1_config='Release', |
| 508 | stage2_config='Release', |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 509 | |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 510 | # Test-suite |
| 511 | runTestSuite=False, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 512 | nt_flags=[], |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 513 | submitURL=None, |
| 514 | testerName=None, |
| 515 | |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 516 | # Environmental variables for all steps. |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 517 | env={}, |
| 518 | extra_cmake_args=[], |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 519 | |
| 520 | # Extra repositories |
| 521 | checkout_clang_tools_extra=True, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 522 | checkout_compiler_rt=True, |
Artem Belevich | 16fcd0e | 2016-12-21 21:15:56 +0000 | [diff] [blame^] | 523 | checkout_lld=True, |
| 524 | checkout_libcxx=False, |
| 525 | checkout_test_suite=False): |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 526 | return _getClangCMakeBuildFactory( |
| 527 | clean=clean, test=test, cmake=cmake, jobs=jobs, vs=vs, |
| 528 | vs_target_arch=vs_target_arch, useTwoStage=useTwoStage, |
| 529 | testStage1=testStage1, stage1_config=stage1_config, |
| 530 | stage2_config=stage2_config, runTestSuite=runTestSuite, |
| 531 | nt_flags=nt_flags, submitURL=submitURL, testerName=testerName, |
| 532 | env=env, extra_cmake_args=extra_cmake_args, |
| 533 | checkout_clang_tools_extra=checkout_clang_tools_extra, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 534 | checkout_lld=checkout_lld, |
Artem Belevich | 16fcd0e | 2016-12-21 21:15:56 +0000 | [diff] [blame^] | 535 | checkout_compiler_rt=checkout_compiler_rt, |
| 536 | checkout_libcxx=checkout_libcxx, |
| 537 | checkout_test_suite=checkout_test_suite) |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 538 | |
| 539 | def _getClangCMakeBuildFactory( |
| 540 | clean=True, |
| 541 | test=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 542 | cmake='cmake', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 543 | jobs=None, |
| 544 | |
| 545 | # VS tools environment variable if using MSVC. For example, |
| 546 | # %VS120COMNTOOLS% selects the 2013 toolchain. |
| 547 | vs=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 548 | vs_target_arch='x86', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 549 | |
| 550 | # Multi-stage compilation |
| 551 | useTwoStage=False, |
| 552 | testStage1=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 553 | stage1_config='Release', |
| 554 | stage2_config='Release', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 555 | |
| 556 | # Test-suite |
| 557 | runTestSuite=False, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 558 | nt_flags=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 559 | submitURL=None, |
| 560 | testerName=None, |
| 561 | |
| 562 | # Environmental variables for all steps. |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 563 | env={}, |
| 564 | extra_cmake_args=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 565 | |
| 566 | # Extra repositories |
| 567 | checkout_clang_tools_extra=True, |
| 568 | checkout_compiler_rt=True, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 569 | checkout_lld=True, |
Artem Belevich | 16fcd0e | 2016-12-21 21:15:56 +0000 | [diff] [blame^] | 570 | checkout_libcxx=False, |
| 571 | checkout_test_suite=False, |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 572 | |
| 573 | # Upload artifacts to Google Cloud Storage (for the llvmbisect tool) |
| 574 | stage1_upload_directory=None, |
| 575 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 576 | # Triggers |
| 577 | trigger_after_stage1=[]): |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 578 | |
| 579 | ############# PREPARING |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 580 | f = buildbot.process.factory.BuildFactory() |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 581 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 582 | addSVNUpdateSteps(f, |
| 583 | checkout_clang_tools_extra=checkout_clang_tools_extra, |
| 584 | checkout_compiler_rt=checkout_compiler_rt, |
Renato Golin | 0bd2a53 | 2016-11-20 16:14:35 +0000 | [diff] [blame] | 585 | checkout_lld=checkout_lld, |
Artem Belevich | 16fcd0e | 2016-12-21 21:15:56 +0000 | [diff] [blame^] | 586 | checkout_test_suite=runTestSuite or checkout_test_suite, |
| 587 | checkout_libcxx=checkout_libcxx) |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 588 | |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 589 | # If jobs not defined, Ninja will choose a suitable value |
Renato Golin | cc83db3 | 2015-06-17 19:23:40 +0000 | [diff] [blame] | 590 | jobs_cmd = [] |
| 591 | lit_args = "'-v" |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 592 | if jobs is not None: |
Renato Golin | cc83db3 | 2015-06-17 19:23:40 +0000 | [diff] [blame] | 593 | jobs_cmd = ["-j"+str(jobs)] |
| 594 | lit_args += " -j"+str(jobs)+"'" |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 595 | else: |
Renato Golin | cc83db3 | 2015-06-17 19:23:40 +0000 | [diff] [blame] | 596 | lit_args += "'" |
| 597 | ninja_cmd = ['ninja'] + jobs_cmd |
| 598 | ninja_install_cmd = ['ninja', 'install'] + jobs_cmd |
| 599 | ninja_check_cmd = ['ninja', 'check-all'] + jobs_cmd |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 600 | check_build_cmd = ["sh", "-c", |
| 601 | "test -e build.ninja && echo OK || echo Missing"] |
| 602 | if vs: |
| 603 | check_build_cmd = ["cmd", "/c", "if exist build.ninja (echo OK) " + |
| 604 | " else (echo Missing & exit 1)"] |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 605 | |
| 606 | # Global configurations |
Renato Golin | cc83db3 | 2015-06-17 19:23:40 +0000 | [diff] [blame] | 607 | stage1_build = 'stage1' |
| 608 | stage1_install = 'stage1.install' |
| 609 | stage2_build = 'stage2' |
| 610 | stage2_install = 'stage2.install' |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 611 | |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 612 | # Set up VS environment, if appropriate. |
| 613 | if vs: |
| 614 | f.addStep(SetProperty( |
| 615 | command=builders_util.getVisualStudioEnvironment(vs, vs_target_arch), |
| 616 | extract_fn=builders_util.extractSlaveEnvironment)) |
| 617 | assert not env, "Can't have custom builder env vars with VS" |
| 618 | env = Property('slave_env') |
| 619 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 620 | |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 621 | ############# CLEANING |
| 622 | if clean: |
| 623 | f.addStep(ShellCommand(name='clean stage 1', |
| 624 | command=['rm','-rf',stage1_build], |
| 625 | warnOnFailure=True, |
| 626 | description='cleaning stage 1', |
| 627 | descriptionDone='clean', |
| 628 | workdir='.', |
| 629 | env=env)) |
| 630 | else: |
| 631 | f.addStep(SetProperty(name="check ninja files 1", |
| 632 | workdir=stage1_build, |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 633 | command=check_build_cmd, |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 634 | flunkOnFailure=False, |
| 635 | property="exists_ninja_1")) |
| 636 | |
| 637 | |
| 638 | ############# STAGE 1 |
| 639 | f.addStep(ShellCommand(name='cmake stage 1', |
| 640 | command=[cmake, "-G", "Ninja", "../llvm", |
| 641 | "-DCMAKE_BUILD_TYPE="+stage1_config, |
| 642 | "-DLLVM_ENABLE_ASSERTIONS=True", |
| 643 | "-DLLVM_LIT_ARGS="+lit_args, |
| 644 | "-DCMAKE_INSTALL_PREFIX=../"+stage1_install] |
| 645 | + extra_cmake_args, |
| 646 | haltOnFailure=True, |
| 647 | description='cmake stage 1', |
| 648 | workdir=stage1_build, |
| 649 | doStepIf=lambda step: step.build.getProperty("exists_ninja_1") != "OK", |
| 650 | env=env)) |
| 651 | |
| 652 | f.addStep(WarningCountingShellCommand(name='build stage 1', |
| 653 | command=ninja_cmd, |
| 654 | haltOnFailure=True, |
| 655 | description='ninja all', |
| 656 | workdir=stage1_build, |
| 657 | env=env)) |
| 658 | |
| 659 | if test and testStage1: |
Renato Golin | d1c4674 | 2015-08-06 18:05:34 +0000 | [diff] [blame] | 660 | haltOnStage1Check = not useTwoStage and not runTestSuite |
Renato Golin | cfbd570 | 2014-09-06 19:09:16 +0000 | [diff] [blame] | 661 | f.addStep(lit_test_command.LitTestCommand(name='ninja check 1', |
| 662 | command=ninja_check_cmd, |
Renato Golin | d1c4674 | 2015-08-06 18:05:34 +0000 | [diff] [blame] | 663 | haltOnFailure=haltOnStage1Check, |
Renato Golin | cfbd570 | 2014-09-06 19:09:16 +0000 | [diff] [blame] | 664 | description=["checking stage 1"], |
| 665 | descriptionDone=["stage 1 checked"], |
| 666 | workdir=stage1_build, |
| 667 | env=env)) |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 668 | |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 669 | if useTwoStage or runTestSuite or stage1_upload_directory: |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 670 | f.addStep(ShellCommand(name='install stage 1', |
| 671 | command=ninja_install_cmd, |
| 672 | description='ninja install', |
| 673 | workdir=stage1_build, |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 674 | env=env)) |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 675 | |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 676 | if stage1_upload_directory: |
| 677 | addGCSUploadSteps(f, 'stage 1', stage1_install, stage1_upload_directory, |
| 678 | env, gcs_url_property='stage1_package_gcs_url') |
| 679 | |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 680 | # Compute the cmake define flag to set the C and C++ compiler to clang. Use |
| 681 | # clang-cl if we used MSVC for stage1. |
| 682 | if not vs: |
| 683 | cc = 'clang' |
| 684 | cxx = 'clang++' |
| 685 | else: |
| 686 | cc = 'clang-cl.exe' |
| 687 | cxx = 'clang-cl.exe' |
| 688 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 689 | |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 690 | ############# STAGE 2 |
| 691 | if useTwoStage: |
Galina Kistanova | 7990097 | 2015-11-16 17:30:42 +0000 | [diff] [blame] | 692 | # We always cleanly build the stage 2. If the compiler has been |
| 693 | # changed on the stage 1, we cannot trust any of the intermediate file |
| 694 | # from the old compiler. And if the stage 1 compiler is the same, we |
| 695 | # should not build in the first place. |
| 696 | f.addStep(ShellCommand(name='clean stage 2', |
| 697 | command=['rm','-rf',stage2_build], |
| 698 | warnOnFailure=True, |
| 699 | description='cleaning stage 2', |
| 700 | descriptionDone='clean', |
| 701 | workdir='.', |
| 702 | env=env)) |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 703 | |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 704 | # Set the compiler using the CC and CXX environment variables to work around |
| 705 | # backslash string escaping bugs somewhere between buildbot and cmake. The |
| 706 | # env.exe helper is required to run the tests, so hopefully it's already on |
| 707 | # PATH. |
| 708 | cmake_cmd2 = ['env', |
| 709 | WithProperties('CC=%(workdir)s/'+stage1_install+'/bin/'+cc), |
| 710 | WithProperties('CXX=%(workdir)s/'+stage1_install+'/bin/'+cxx), |
| 711 | cmake, "-G", "Ninja", "../llvm", |
| 712 | "-DCMAKE_BUILD_TYPE="+stage2_config, |
| 713 | "-DLLVM_ENABLE_ASSERTIONS=True", |
| 714 | "-DLLVM_LIT_ARGS="+lit_args, |
| 715 | "-DCMAKE_INSTALL_PREFIX=../"+stage2_install] + extra_cmake_args |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 716 | |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 717 | f.addStep(ShellCommand(name='cmake stage 2', |
| 718 | command=cmake_cmd2, |
| 719 | haltOnFailure=True, |
| 720 | description='cmake stage 2', |
| 721 | workdir=stage2_build, |
| 722 | doStepIf=lambda step: step.build.getProperty("exists_ninja_2") != "OK", |
| 723 | env=env)) |
| 724 | |
| 725 | f.addStep(WarningCountingShellCommand(name='build stage 2', |
| 726 | command=ninja_cmd, |
| 727 | haltOnFailure=True, |
| 728 | description='ninja all', |
| 729 | workdir=stage2_build, |
| 730 | env=env)) |
| 731 | |
| 732 | if test: |
| 733 | f.addStep(lit_test_command.LitTestCommand(name='ninja check 2', |
| 734 | command=ninja_check_cmd, |
| 735 | haltOnFailure=not runTestSuite, |
| 736 | description=["checking stage 2"], |
| 737 | descriptionDone=["stage 2 checked"], |
| 738 | workdir=stage2_build, |
| 739 | env=env)) |
| 740 | |
| 741 | ############# TEST SUITE |
| 742 | ## Test-Suite (stage 2 if built, stage 1 otherwise) |
| 743 | if runTestSuite: |
| 744 | compiler_path = stage1_install |
| 745 | if useTwoStage: |
| 746 | compiler_path=stage2_install |
| 747 | f.addStep(ShellCommand(name='install stage 2', |
| 748 | command=ninja_install_cmd, |
| 749 | description='ninja install 2', |
Renato Golin | cfbd570 | 2014-09-06 19:09:16 +0000 | [diff] [blame] | 750 | workdir=stage2_build, |
| 751 | env=env)) |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 752 | |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 753 | # Get generated python, lnt |
| 754 | python = WithProperties('%(workdir)s/test/sandbox/bin/python') |
| 755 | lnt = WithProperties('%(workdir)s/test/sandbox/bin/lnt') |
| 756 | lnt_setup = WithProperties('%(workdir)s/test/lnt/setup.py') |
| 757 | |
| 758 | # Paths |
| 759 | sandbox = WithProperties('%(workdir)s/test/sandbox') |
| 760 | test_suite_dir = WithProperties('%(workdir)s/test/test-suite') |
| 761 | |
| 762 | # Get latest built Clang (stage1 or stage2) |
| 763 | cc = WithProperties('%(workdir)s/'+compiler_path+'/bin/'+cc) |
| 764 | cxx = WithProperties('%(workdir)s/'+compiler_path+'/bin/'+cxx) |
| 765 | |
Renato Golin | 593e0d6 | 2016-09-21 17:24:56 +0000 | [diff] [blame] | 766 | # LNT Command line (don't pass -jN. Users need to pass both --threads |
| 767 | # and --build-threads in nt_flags to get the same effect) |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 768 | test_suite_cmd = [python, lnt, 'runtest', 'nt', |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 769 | '--no-timestamp', |
| 770 | '--sandbox', sandbox, |
| 771 | '--test-suite', test_suite_dir, |
| 772 | '--cc', cc, |
| 773 | '--cxx', cxx] |
| 774 | # Append any option provided by the user |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 775 | test_suite_cmd.extend(nt_flags) |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 776 | # Only submit if a URL has been specified |
| 777 | if submitURL is not None: |
| 778 | if not isinstance(submitURL, list): |
| 779 | submitURL = [submitURL] |
| 780 | for url in submitURL: |
| 781 | test_suite_cmd.extend(['--submit', url]) |
| 782 | if testerName: |
| 783 | test_suite_cmd.extend(['--no-machdep-info', testerName]) |
| 784 | # CC and CXX are needed as env for build-tools |
Renato Golin | e6c1b3b | 2015-07-01 15:52:22 +0000 | [diff] [blame] | 785 | test_suite_env = copy.deepcopy(env) |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 786 | test_suite_env['CC'] = cc |
| 787 | test_suite_env['CXX'] = cxx |
| 788 | |
| 789 | # Steps to prepare, build and run LNT |
| 790 | f.addStep(ShellCommand(name='clean sandbox', |
| 791 | command=['rm', '-rf', 'sandbox'], |
| 792 | haltOnFailure=True, |
| 793 | description='removing sandbox directory', |
| 794 | workdir='test', |
| 795 | env=env)) |
| 796 | f.addStep(ShellCommand(name='recreate sandbox', |
| 797 | command=['virtualenv', 'sandbox'], |
| 798 | haltOnFailure=True, |
| 799 | description='recreating sandbox', |
| 800 | workdir='test', |
| 801 | env=env)) |
| 802 | f.addStep(ShellCommand(name='setup lit', |
| 803 | command=[python, lnt_setup, 'develop'], |
| 804 | haltOnFailure=True, |
| 805 | description='setting up LNT in sandbox', |
| 806 | workdir='test/sandbox', |
| 807 | env=env)) |
| 808 | f.addStep(commands.LitTestCommand.LitTestCommand( |
| 809 | name='test-suite', |
| 810 | command=test_suite_cmd, |
| 811 | haltOnFailure=True, |
| 812 | description=['running the test suite'], |
| 813 | workdir='test/sandbox', |
| 814 | logfiles={'configure.log' : 'build/configure.log', |
| 815 | 'build-tools.log' : 'build/build-tools.log', |
| 816 | 'test.log' : 'build/test.log', |
| 817 | 'report.json' : 'build/report.json'}, |
| 818 | env=test_suite_env)) |
| 819 | |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 820 | return f |
| 821 | |
Daniel Dunbar | c51a59e | 2010-09-23 14:57:45 +0000 | [diff] [blame] | 822 | 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] | 823 | f = buildbot.process.factory.BuildFactory() |
| 824 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 825 | if update: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 826 | f.addStep(SVN(name='svn-llvm', |
| 827 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 828 | defaultBranch='trunk', |
| 829 | workdir='llvm')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 830 | f.addStep(SVN(name='svn-clang', |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 831 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 832 | defaultBranch='trunk', |
| 833 | workdir='llvm/tools/clang')) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 834 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 835 | mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 836 | defaultBranch='trunk', |
| 837 | workdir='llvm/tools/clang/tools/extra')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 838 | |
| 839 | # Full & fast clean. |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 840 | if clean: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 841 | f.addStep(ShellCommand(name='clean-1', |
| 842 | command=['del','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 843 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 844 | description='cleaning', |
| 845 | descriptionDone='clean', |
| 846 | workdir='llvm')) |
| 847 | f.addStep(ShellCommand(name='clean-2', |
| 848 | command=['rmdir','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 849 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 850 | description='cleaning', |
| 851 | descriptionDone='clean', |
| 852 | workdir='llvm')) |
| 853 | |
| 854 | # Create the project files. |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 855 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 856 | # Use batch files instead of ShellCommand directly, Windows quoting is |
| 857 | # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 858 | f.addStep(batch_file_download.BatchFileDownload(name='cmakegen', |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 859 | command=[cmake, |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 860 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
Daniel Dunbar | 1ddedce | 2010-09-24 19:57:34 +0000 | [diff] [blame] | 861 | "-DLLVM_INCLUDE_EXAMPLES:=OFF", |
| 862 | "-DLLVM_INCLUDE_TESTS:=OFF", |
| 863 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 864 | "-G", |
| 865 | "Visual Studio 9 2008", |
| 866 | ".."], |
| 867 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 868 | f.addStep(ShellCommand(name='cmake', |
| 869 | command=['cmakegen.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 870 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 871 | description='cmake gen', |
| 872 | workdir='llvm\\build')) |
| 873 | |
| 874 | # Build it. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 875 | f.addStep(batch_file_download.BatchFileDownload(name='vcbuild', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 876 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 877 | "/M%d" % jobs, |
| 878 | "LLVM.sln", |
| 879 | "Debug|Win32"], |
| 880 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 881 | f.addStep(WarningCountingShellCommand(name='vcbuild', |
| 882 | command=['vcbuild.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 883 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 884 | description='vcbuild', |
| 885 | workdir='llvm\\build', |
| 886 | warningPattern=" warning C.*:")) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 887 | |
| 888 | # Build clang-test project. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 889 | f.addStep(batch_file_download.BatchFileDownload(name='vcbuild_test', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 890 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 891 | "clang-test.vcproj", |
| 892 | "Debug|Win32"], |
| 893 | workdir="llvm\\build\\tools\\clang\\test")) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 894 | f.addStep(lit_test_command.LitTestCommand(name='test-clang', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 895 | command=["vcbuild_test.bat"], |
| 896 | workdir="llvm\\build\\tools\\clang\\test")) |
| 897 | |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 898 | return f |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 899 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 900 | def addClangGCCTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install", |
| 901 | languages = ('gcc', 'g++', 'objc', 'obj-c++')): |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 902 | make_vars = [WithProperties( |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 903 | 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 904 | WithProperties( |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 905 | 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 906 | f.addStep(SVN(name='svn-clang-gcc-tests', mode='update', |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 907 | baseURL='http://llvm.org/svn/llvm-project/clang-tests/', |
| 908 | defaultBranch='trunk', workdir='clang-tests')) |
| 909 | gcc_dg_ignores = ignores.get('gcc-4_2-testsuite', {}) |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 910 | for lang in languages: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 911 | f.addStep(commands.SuppressionDejaGNUCommand.SuppressionDejaGNUCommand( |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 912 | name='test-gcc-4_2-testsuite-%s' % lang, |
| 913 | command=["make", "-k", "check-%s" % lang] + make_vars, |
| 914 | description="gcc-4_2-testsuite (%s)" % lang, |
| 915 | workdir='clang-tests/gcc-4_2-testsuite', |
David Dean | 2bd0c3a | 2011-10-18 16:36:28 +0000 | [diff] [blame] | 916 | logfiles={ 'dg.sum' : 'obj/%s/%s.sum' % (lang, lang), |
| 917 | '%s.log' % lang : 'obj/%s/%s.log' % (lang, lang)}, |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 918 | ignore=gcc_dg_ignores.get(lang, []))) |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 919 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 920 | def addClangGDBTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install"): |
| 921 | make_vars = [WithProperties( |
| 922 | 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), |
| 923 | WithProperties( |
| 924 | 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 925 | f.addStep(SVN(name='svn-clang-gdb-tests', mode='update', |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 926 | baseURL='http://llvm.org/svn/llvm-project/clang-tests/', |
| 927 | defaultBranch='trunk', workdir='clang-tests')) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 928 | f.addStep(commands.SuppressionDejaGNUCommand.SuppressionDejaGNUCommand( |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 929 | name='test-gdb-1472-testsuite', |
| 930 | command=["make", "-k", "check"] + make_vars, |
| 931 | description="gdb-1472-testsuite", |
| 932 | workdir='clang-tests/gdb-1472-testsuite', |
David Blaikie | 7ec695f | 2012-10-09 22:17:09 +0000 | [diff] [blame] | 933 | logfiles={ 'dg.sum' : 'obj/filtered.gdb.sum', |
David Blaikie | 624f439 | 2012-11-05 22:34:35 +0000 | [diff] [blame] | 934 | 'gdb.log' : 'obj/gdb.log' })) |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 935 | |
David Blaikie | 41d09c3 | 2013-01-02 21:11:09 +0000 | [diff] [blame] | 936 | def addModernClangGDBTests(f, jobs, install_prefix): |
David Blaikie | 1bc5c37 | 2012-12-05 05:29:12 +0000 | [diff] [blame] | 937 | make_vars = [WithProperties('RUNTESTFLAGS=CC_FOR_TARGET=\'{0}/bin/clang\' ' |
| 938 | 'CXX_FOR_TARGET=\'{0}/bin/clang++\' ' |
David Blaikie | 759bb75 | 2013-04-18 23:13:11 +0000 | [diff] [blame] | 939 | 'CFLAGS_FOR_TARGET=\'-w -fno-limit-debug-info\'' |
David Blaikie | f89877b | 2013-01-29 23:46:26 +0000 | [diff] [blame] | 940 | .format(install_prefix))] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 941 | f.addStep(SVN(name='svn-clang-modern-gdb-tests', mode='update', |
David Blaikie | f3f300b | 2012-11-17 01:13:41 +0000 | [diff] [blame] | 942 | 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] | 943 | workdir='clang-tests/src')) |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 944 | f.addStep(Configure(command='../src/configure', |
David Blaikie | f3f300b | 2012-11-17 01:13:41 +0000 | [diff] [blame] | 945 | workdir='clang-tests/build/')) |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 946 | f.addStep(WarningCountingShellCommand(name='gdb-75-build', |
| 947 | command=['make', WithProperties('-j%s' % jobs)], |
| 948 | haltOnFailure=True, |
| 949 | workdir='clang-tests/build')) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 950 | f.addStep(commands.DejaGNUCommand.DejaGNUCommand( |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 951 | name='gdb-75-check', |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 952 | command=['make', '-k', WithProperties('-j%s' % jobs), 'check'] + make_vars, |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 953 | workdir='clang-tests/build', |
David Blaikie | 1bc5c37 | 2012-12-05 05:29:12 +0000 | [diff] [blame] | 954 | logfiles={'dg.sum':'gdb/testsuite/gdb.sum', |
| 955 | 'gdb.log':'gdb/testsuite/gdb.log'})) |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 956 | |
| 957 | |
| 958 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 959 | # FIXME: Deprecated. |
| 960 | addClangTests = addClangGCCTests |
| 961 | |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 962 | def getClangTestsIgnoresFromPath(path, key): |
| 963 | def readList(path): |
| 964 | if not os.path.exists(path): |
| 965 | return [] |
| 966 | |
| 967 | f = open(path) |
| 968 | lines = [ln.strip() for ln in f] |
| 969 | f.close() |
| 970 | return lines |
| 971 | |
| 972 | ignores = {} |
| 973 | |
| 974 | gcc_dg_ignores = {} |
| 975 | for lang in ('gcc', 'g++', 'objc', 'obj-c++'): |
| 976 | lang_path = os.path.join(path, 'gcc-4_2-testsuite', 'expected_results', |
| 977 | key, lang) |
| 978 | gcc_dg_ignores[lang] = ( |
| 979 | readList(os.path.join(lang_path, 'FAIL.txt')) + |
| 980 | readList(os.path.join(lang_path, 'UNRESOLVED.txt')) + |
| 981 | readList(os.path.join(lang_path, 'XPASS.txt'))) |
| 982 | ignores['gcc-4_2-testsuite' ] = gcc_dg_ignores |
| 983 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 984 | ignores_path = os.path.join(path, 'gdb-1472-testsuite', 'expected_results', |
| 985 | key) |
| 986 | gdb_dg_ignores = ( |
| 987 | readList(os.path.join(ignores_path, 'FAIL.txt')) + |
| 988 | readList(os.path.join(ignores_path, 'UNRESOLVED.txt')) + |
| 989 | readList(os.path.join(ignores_path, 'XPASS.txt'))) |
| 990 | ignores['gdb-1472-testsuite' ] = gdb_dg_ignores |
| 991 | |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 992 | return ignores |