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 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 338 | def addSVNUpdateSteps(f, |
| 339 | checkout_clang_tools_extra, |
| 340 | checkout_compiler_rt, |
| 341 | checkout_test_suite): |
| 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')) |
| 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, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 422 | cmake='cmake', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 423 | jobs=None, |
| 424 | |
| 425 | # VS tools environment variable if using MSVC. For example, |
| 426 | # %VS120COMNTOOLS% selects the 2013 toolchain. |
| 427 | vs=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 428 | vs_target_arch='x86', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 429 | |
| 430 | # Multi-stage compilation |
| 431 | useTwoStage=False, |
| 432 | testStage1=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 433 | stage1_config='Release', |
| 434 | stage2_config='Release', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 435 | |
| 436 | # Test-suite |
| 437 | runTestSuite=False, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 438 | nt_flags=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 439 | submitURL=None, |
| 440 | testerName=None, |
| 441 | |
| 442 | # Environmental variables for all steps. |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 443 | env={}, |
| 444 | extra_cmake_args=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 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, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 452 | |
| 453 | # Triggers |
| 454 | trigger_after_stage1=[]): |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 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, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 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, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 470 | cmake='cmake', |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 471 | jobs=None, |
| 472 | |
| 473 | # VS tools environment variable if using MSVC. For example, |
| 474 | # %VS120COMNTOOLS% selects the 2013 toolchain. |
| 475 | vs=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 476 | vs_target_arch='x86', |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 477 | |
| 478 | # Multi-stage compilation |
| 479 | useTwoStage=False, |
| 480 | testStage1=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 481 | stage1_config='Release', |
| 482 | stage2_config='Release', |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 483 | |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 484 | # Test-suite |
| 485 | runTestSuite=False, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 486 | nt_flags=[], |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 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. |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 491 | env={}, |
| 492 | extra_cmake_args=[], |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 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, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 510 | cmake='cmake', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 511 | jobs=None, |
| 512 | |
| 513 | # VS tools environment variable if using MSVC. For example, |
| 514 | # %VS120COMNTOOLS% selects the 2013 toolchain. |
| 515 | vs=None, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 516 | vs_target_arch='x86', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 517 | |
| 518 | # Multi-stage compilation |
| 519 | useTwoStage=False, |
| 520 | testStage1=True, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 521 | stage1_config='Release', |
| 522 | stage2_config='Release', |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 523 | |
| 524 | # Test-suite |
| 525 | runTestSuite=False, |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 526 | nt_flags=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 527 | submitURL=None, |
| 528 | testerName=None, |
| 529 | |
| 530 | # Environmental variables for all steps. |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 531 | env={}, |
| 532 | extra_cmake_args=[], |
Daniel Sanders | fa22233 | 2015-12-04 14:30:39 +0000 | [diff] [blame] | 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 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 541 | # Triggers |
| 542 | trigger_after_stage1=[]): |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 543 | |
| 544 | ############# PREPARING |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 545 | f = buildbot.process.factory.BuildFactory() |
Reid Kleckner | 25a26b0 | 2015-03-09 22:30:25 +0000 | [diff] [blame] | 546 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +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 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 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 | |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +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 | |
Renato Golin | 593e0d6 | 2016-09-21 17:24:56 +0000 | [diff] [blame^] | 729 | # LNT Command line (don't pass -jN. Users need to pass both --threads |
| 730 | # and --build-threads in nt_flags to get the same effect) |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 731 | test_suite_cmd = [python, lnt, 'runtest', 'nt', |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 732 | '--no-timestamp', |
| 733 | '--sandbox', sandbox, |
| 734 | '--test-suite', test_suite_dir, |
| 735 | '--cc', cc, |
| 736 | '--cxx', cxx] |
| 737 | # Append any option provided by the user |
Galina Kistanova | ff5e78a | 2016-09-06 17:44:53 +0000 | [diff] [blame] | 738 | test_suite_cmd.extend(nt_flags) |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 739 | # Only submit if a URL has been specified |
| 740 | if submitURL is not None: |
| 741 | if not isinstance(submitURL, list): |
| 742 | submitURL = [submitURL] |
| 743 | for url in submitURL: |
| 744 | test_suite_cmd.extend(['--submit', url]) |
| 745 | if testerName: |
| 746 | test_suite_cmd.extend(['--no-machdep-info', testerName]) |
| 747 | # CC and CXX are needed as env for build-tools |
Renato Golin | e6c1b3b | 2015-07-01 15:52:22 +0000 | [diff] [blame] | 748 | test_suite_env = copy.deepcopy(env) |
Renato Golin | 61aed7f | 2015-06-17 19:12:50 +0000 | [diff] [blame] | 749 | test_suite_env['CC'] = cc |
| 750 | test_suite_env['CXX'] = cxx |
| 751 | |
| 752 | # Steps to prepare, build and run LNT |
| 753 | f.addStep(ShellCommand(name='clean sandbox', |
| 754 | command=['rm', '-rf', 'sandbox'], |
| 755 | haltOnFailure=True, |
| 756 | description='removing sandbox directory', |
| 757 | workdir='test', |
| 758 | env=env)) |
| 759 | f.addStep(ShellCommand(name='recreate sandbox', |
| 760 | command=['virtualenv', 'sandbox'], |
| 761 | haltOnFailure=True, |
| 762 | description='recreating sandbox', |
| 763 | workdir='test', |
| 764 | env=env)) |
| 765 | f.addStep(ShellCommand(name='setup lit', |
| 766 | command=[python, lnt_setup, 'develop'], |
| 767 | haltOnFailure=True, |
| 768 | description='setting up LNT in sandbox', |
| 769 | workdir='test/sandbox', |
| 770 | env=env)) |
| 771 | f.addStep(commands.LitTestCommand.LitTestCommand( |
| 772 | name='test-suite', |
| 773 | command=test_suite_cmd, |
| 774 | haltOnFailure=True, |
| 775 | description=['running the test suite'], |
| 776 | workdir='test/sandbox', |
| 777 | logfiles={'configure.log' : 'build/configure.log', |
| 778 | 'build-tools.log' : 'build/build-tools.log', |
| 779 | 'test.log' : 'build/test.log', |
| 780 | 'report.json' : 'build/report.json'}, |
| 781 | env=test_suite_env)) |
| 782 | |
Renato Golin | e402f58 | 2014-09-04 19:25:24 +0000 | [diff] [blame] | 783 | return f |
| 784 | |
Daniel Dunbar | c51a59e | 2010-09-23 14:57:45 +0000 | [diff] [blame] | 785 | 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] | 786 | f = buildbot.process.factory.BuildFactory() |
| 787 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 788 | if update: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 789 | f.addStep(SVN(name='svn-llvm', |
| 790 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 791 | defaultBranch='trunk', |
| 792 | workdir='llvm')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 793 | f.addStep(SVN(name='svn-clang', |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 794 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 795 | defaultBranch='trunk', |
| 796 | workdir='llvm/tools/clang')) |
David Blaikie | 845ae0d | 2012-08-10 00:51:38 +0000 | [diff] [blame] | 797 | f.addStep(SVN(name='svn-clang-tools-extra', |
| 798 | mode='update', baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/', |
| 799 | defaultBranch='trunk', |
| 800 | workdir='llvm/tools/clang/tools/extra')) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 801 | |
| 802 | # Full & fast clean. |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 803 | if clean: |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 804 | f.addStep(ShellCommand(name='clean-1', |
| 805 | command=['del','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 806 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 807 | description='cleaning', |
| 808 | descriptionDone='clean', |
| 809 | workdir='llvm')) |
| 810 | f.addStep(ShellCommand(name='clean-2', |
| 811 | command=['rmdir','/s/q','build'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 812 | warnOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 813 | description='cleaning', |
| 814 | descriptionDone='clean', |
| 815 | workdir='llvm')) |
| 816 | |
| 817 | # Create the project files. |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 818 | |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 819 | # Use batch files instead of ShellCommand directly, Windows quoting is |
| 820 | # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 821 | f.addStep(batch_file_download.BatchFileDownload(name='cmakegen', |
Daniel Dunbar | 06b20f1 | 2010-04-08 18:29:38 +0000 | [diff] [blame] | 822 | command=[cmake, |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 823 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
Daniel Dunbar | 1ddedce | 2010-09-24 19:57:34 +0000 | [diff] [blame] | 824 | "-DLLVM_INCLUDE_EXAMPLES:=OFF", |
| 825 | "-DLLVM_INCLUDE_TESTS:=OFF", |
| 826 | "-DLLVM_TARGETS_TO_BUILD:=X86", |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 827 | "-G", |
| 828 | "Visual Studio 9 2008", |
| 829 | ".."], |
| 830 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 831 | f.addStep(ShellCommand(name='cmake', |
| 832 | command=['cmakegen.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 833 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 834 | description='cmake gen', |
| 835 | workdir='llvm\\build')) |
| 836 | |
| 837 | # Build it. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 838 | f.addStep(batch_file_download.BatchFileDownload(name='vcbuild', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 839 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 840 | "/M%d" % jobs, |
| 841 | "LLVM.sln", |
| 842 | "Debug|Win32"], |
| 843 | workdir="llvm\\build")) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 844 | f.addStep(WarningCountingShellCommand(name='vcbuild', |
| 845 | command=['vcbuild.bat'], |
Daniel Dunbar | 7e959c8 | 2009-09-28 04:01:19 +0000 | [diff] [blame] | 846 | haltOnFailure=True, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 847 | description='vcbuild', |
| 848 | workdir='llvm\\build', |
| 849 | warningPattern=" warning C.*:")) |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 850 | |
| 851 | # Build clang-test project. |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 852 | f.addStep(batch_file_download.BatchFileDownload(name='vcbuild_test', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 853 | command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""", |
| 854 | "clang-test.vcproj", |
| 855 | "Debug|Win32"], |
| 856 | workdir="llvm\\build\\tools\\clang\\test")) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 857 | f.addStep(lit_test_command.LitTestCommand(name='test-clang', |
Daniel Dunbar | b51f6ab | 2009-11-09 03:09:23 +0000 | [diff] [blame] | 858 | command=["vcbuild_test.bat"], |
| 859 | workdir="llvm\\build\\tools\\clang\\test")) |
| 860 | |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame] | 861 | return f |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 862 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 863 | def addClangGCCTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install", |
| 864 | languages = ('gcc', 'g++', 'objc', 'obj-c++')): |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 865 | make_vars = [WithProperties( |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 866 | 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 867 | WithProperties( |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 868 | 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 869 | f.addStep(SVN(name='svn-clang-gcc-tests', mode='update', |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 870 | baseURL='http://llvm.org/svn/llvm-project/clang-tests/', |
| 871 | defaultBranch='trunk', workdir='clang-tests')) |
| 872 | gcc_dg_ignores = ignores.get('gcc-4_2-testsuite', {}) |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 873 | for lang in languages: |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 874 | f.addStep(commands.SuppressionDejaGNUCommand.SuppressionDejaGNUCommand( |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 875 | name='test-gcc-4_2-testsuite-%s' % lang, |
| 876 | command=["make", "-k", "check-%s" % lang] + make_vars, |
| 877 | description="gcc-4_2-testsuite (%s)" % lang, |
| 878 | workdir='clang-tests/gcc-4_2-testsuite', |
David Dean | 2bd0c3a | 2011-10-18 16:36:28 +0000 | [diff] [blame] | 879 | logfiles={ 'dg.sum' : 'obj/%s/%s.sum' % (lang, lang), |
| 880 | '%s.log' % lang : 'obj/%s/%s.log' % (lang, lang)}, |
Daniel Dunbar | 22d594a | 2010-07-31 05:29:16 +0000 | [diff] [blame] | 881 | ignore=gcc_dg_ignores.get(lang, []))) |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 882 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 883 | def addClangGDBTests(f, ignores={}, install_prefix="%(builddir)s/llvm.install"): |
| 884 | make_vars = [WithProperties( |
| 885 | 'CC_UNDER_TEST=%s/bin/clang' % install_prefix), |
| 886 | WithProperties( |
| 887 | 'CXX_UNDER_TEST=%s/bin/clang++' % install_prefix)] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 888 | f.addStep(SVN(name='svn-clang-gdb-tests', mode='update', |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 889 | baseURL='http://llvm.org/svn/llvm-project/clang-tests/', |
| 890 | defaultBranch='trunk', workdir='clang-tests')) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 891 | f.addStep(commands.SuppressionDejaGNUCommand.SuppressionDejaGNUCommand( |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 892 | name='test-gdb-1472-testsuite', |
| 893 | command=["make", "-k", "check"] + make_vars, |
| 894 | description="gdb-1472-testsuite", |
| 895 | workdir='clang-tests/gdb-1472-testsuite', |
David Blaikie | 7ec695f | 2012-10-09 22:17:09 +0000 | [diff] [blame] | 896 | logfiles={ 'dg.sum' : 'obj/filtered.gdb.sum', |
David Blaikie | 624f439 | 2012-11-05 22:34:35 +0000 | [diff] [blame] | 897 | 'gdb.log' : 'obj/gdb.log' })) |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 898 | |
David Blaikie | 41d09c3 | 2013-01-02 21:11:09 +0000 | [diff] [blame] | 899 | def addModernClangGDBTests(f, jobs, install_prefix): |
David Blaikie | 1bc5c37 | 2012-12-05 05:29:12 +0000 | [diff] [blame] | 900 | make_vars = [WithProperties('RUNTESTFLAGS=CC_FOR_TARGET=\'{0}/bin/clang\' ' |
| 901 | 'CXX_FOR_TARGET=\'{0}/bin/clang++\' ' |
David Blaikie | 759bb75 | 2013-04-18 23:13:11 +0000 | [diff] [blame] | 902 | 'CFLAGS_FOR_TARGET=\'-w -fno-limit-debug-info\'' |
David Blaikie | f89877b | 2013-01-29 23:46:26 +0000 | [diff] [blame] | 903 | .format(install_prefix))] |
David Blaikie | 0551733 | 2013-12-19 23:29:12 +0000 | [diff] [blame] | 904 | f.addStep(SVN(name='svn-clang-modern-gdb-tests', mode='update', |
David Blaikie | f3f300b | 2012-11-17 01:13:41 +0000 | [diff] [blame] | 905 | 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] | 906 | workdir='clang-tests/src')) |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 907 | f.addStep(Configure(command='../src/configure', |
David Blaikie | f3f300b | 2012-11-17 01:13:41 +0000 | [diff] [blame] | 908 | workdir='clang-tests/build/')) |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 909 | f.addStep(WarningCountingShellCommand(name='gdb-75-build', |
| 910 | command=['make', WithProperties('-j%s' % jobs)], |
| 911 | haltOnFailure=True, |
| 912 | workdir='clang-tests/build')) |
Michael Gottesman | a6b5be8 | 2013-06-28 21:57:20 +0000 | [diff] [blame] | 913 | f.addStep(commands.DejaGNUCommand.DejaGNUCommand( |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 914 | name='gdb-75-check', |
David Blaikie | b83bfdf | 2012-12-05 04:33:42 +0000 | [diff] [blame] | 915 | command=['make', '-k', WithProperties('-j%s' % jobs), 'check'] + make_vars, |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 916 | workdir='clang-tests/build', |
David Blaikie | 1bc5c37 | 2012-12-05 05:29:12 +0000 | [diff] [blame] | 917 | logfiles={'dg.sum':'gdb/testsuite/gdb.sum', |
| 918 | 'gdb.log':'gdb/testsuite/gdb.log'})) |
David Blaikie | dad03d5 | 2012-11-16 22:37:12 +0000 | [diff] [blame] | 919 | |
| 920 | |
| 921 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 922 | # FIXME: Deprecated. |
| 923 | addClangTests = addClangGCCTests |
| 924 | |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 925 | def getClangTestsIgnoresFromPath(path, key): |
| 926 | def readList(path): |
| 927 | if not os.path.exists(path): |
| 928 | return [] |
| 929 | |
| 930 | f = open(path) |
| 931 | lines = [ln.strip() for ln in f] |
| 932 | f.close() |
| 933 | return lines |
| 934 | |
| 935 | ignores = {} |
| 936 | |
| 937 | gcc_dg_ignores = {} |
| 938 | for lang in ('gcc', 'g++', 'objc', 'obj-c++'): |
| 939 | lang_path = os.path.join(path, 'gcc-4_2-testsuite', 'expected_results', |
| 940 | key, lang) |
| 941 | gcc_dg_ignores[lang] = ( |
| 942 | readList(os.path.join(lang_path, 'FAIL.txt')) + |
| 943 | readList(os.path.join(lang_path, 'UNRESOLVED.txt')) + |
| 944 | readList(os.path.join(lang_path, 'XPASS.txt'))) |
| 945 | ignores['gcc-4_2-testsuite' ] = gcc_dg_ignores |
| 946 | |
Daniel Dunbar | 7363d03 | 2011-02-27 03:22:35 +0000 | [diff] [blame] | 947 | ignores_path = os.path.join(path, 'gdb-1472-testsuite', 'expected_results', |
| 948 | key) |
| 949 | gdb_dg_ignores = ( |
| 950 | readList(os.path.join(ignores_path, 'FAIL.txt')) + |
| 951 | readList(os.path.join(ignores_path, 'UNRESOLVED.txt')) + |
| 952 | readList(os.path.join(ignores_path, 'XPASS.txt'))) |
| 953 | ignores['gdb-1472-testsuite' ] = gdb_dg_ignores |
| 954 | |
Daniel Dunbar | 2b67e8f | 2011-02-11 21:03:41 +0000 | [diff] [blame] | 955 | return ignores |
David Dean | f8b3544 | 2012-12-11 00:35:12 +0000 | [diff] [blame] | 956 | |