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