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