llvm.org GIT mirror llvm / 1416dc2
Overhaul the 'test-release' script. This removes support for building llvm-gcc. It will eventually add support for building other projects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142165 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
1 changed file(s) with 97 addition(s) and 159 deletion(s). Raw diff Collapse all Expand all
1212 #===------------------------------------------------------------------------===#
1313
1414 set -e # Exit if any command fails
15
16 projects="llvm cfe dragonegg test-suite compiler-rt libcxx libcxxabi"
17
18 # Base SVN URL for the sources.
19 Base_url="http://llvm.org/svn/llvm-project"
1520
1621 Release=""
1722 Release_no_dot=""
1924 do_checkout="yes"
2025 do_ada="no"
2126 do_objc="yes"
22 do_fortran="yes"
27 do_fortran="no"
2328 do_64bit="yes"
29 do_debug="no"
2430 BuildDir="`pwd`"
2531
2632 function usage() {
3339 echo " -no-checkout Don't checkout the sources from SVN."
3440 echo " -no-64bit Don't test the 64-bit version. [default: yes]"
3541 echo " -enable-ada Build Ada. [default: disable]"
42 echo " -enable-fortran Enable Fortran build. [default: disable]"
3643 echo " -disable-objc Disable ObjC build. [default: enable]"
37 echo " -disable-fortran Disable Fortran build. [default: enable]"
44 echo " -test-debug Test the debug build. [default: no]"
3845 }
3946
4047 while [ $# -gt 0 ]; do
6875 -enable-ada | --enable-ada )
6976 do_ada="yes"
7077 ;;
78 -enable-fortran | --enable-fortran )
79 do_fortran="yes"
80 ;;
7181 -disable-objc | --disable-objc )
7282 do_objc="no"
7383 ;;
74 -disable-fortran | --disable-fortran )
75 echo "WARNING: Do you *really* need to disable Fortran?"
76 sleep 5
77 do_fortran="no"
84 -test-debug | --test-debug )
85 do_debug="yes"
7886 ;;
7987 -help | --help | -h | --h | -\? )
8088 usage
9199
92100 # Check required arguments.
93101 if [ -z "$Release" ]; then
94 echo "No release number specified!"
102 echo "error: no release number specified"
95103 exit 1
96104 fi
97105 if [ -z "$RC" ]; then
98 echo "No release candidate number specified!"
106 echo "error: no release candidate number specified"
99107 exit 1
100108 fi
101109
113121 NumJobs=3
114122 fi
115123
116 # Location of sources.
117 llvmCore_srcdir=$BuildDir/llvmCore-$Release-rc$RC.src
118 llvmgcc42_srcdir=$BuildDir/llvmgcc42-$Release-rc$RC.src
124 # Go to the build directory (may be different from CWD)
125 BuildDir=$BuildDir/rc$RC
126 mkdir -p $BuildDir
127 cd $BuildDir
119128
120129 # Location of log files.
121 LogDirName="$Release-rc$RC.logs"
122 LogDir=$BuildDir/$LogDirName
130 LogDir=$BuildDir/logs
123131 mkdir -p $LogDir
124132
125 # SVN URLs for the sources.
126 Base_url="http://llvm.org/svn/llvm-project"
127 llvmCore_RC_url="$Base_url/llvm/tags/RELEASE_$Release_no_dot/rc$RC"
128 llvmgcc42_RC_url="$Base_url/llvm-gcc-4.2/tags/RELEASE_$Release_no_dot/rc$RC"
129 clang_RC_url="$Base_url/cfe/tags/RELEASE_$Release_no_dot/rc$RC"
130 test_suite_RC_url="$Base_url/test-suite/tags/RELEASE_$Release_no_dot/rc$RC"
133 # Find a compilers.
134 c_compiler="`which clang`"
135 if [ -z "$c_compiler" ]; then
136 c_compiler="`which gcc`"
137 if [ -z "$c_compiler" ]; then
138 c_compiler="`which cc`"
139 if [ -z "$c_compiler" ]; then
140 echo "error: cannot find a working C compiler"
141 fi
142 fi
143 fi
144 cxx_compiler="`which clang++`"
145 if [ -z "$cxx_compiler" ]; then
146 cxx_compiler="`which g++`"
147 if [ -z "$cxx_compiler" ]; then
148 cxx_compiler="`which c++`"
149 if [ -z "$cxx_compiler" ]; then
150 echo "error: cannot find a working C++ compiler"
151 fi
152 fi
153 fi
131154
132155 # Make sure that the URLs are valid.
133156 function check_valid_urls() {
134 echo "# Validating SVN URLs"
135 if ! svn ls $llvmCore_RC_url > /dev/null 2>&1 ; then
136 echo "llvm $Release release candidate $RC doesn't exist!"
137 exit 1
138 fi
139 if ! svn ls $llvmgcc42_RC_url > /dev/null 2>&1 ; then
140 echo "llvm-gcc-4.2 $Release release candidate $RC doesn't exist!"
141 exit 1
142 fi
143 if ! svn ls $clang_RC_url > /dev/null 2>&1 ; then
144 echo "clang $Release release candidate $RC doesn't exist!"
145 exit 1
146 fi
147 if ! svn ls $test_suite_RC_url > /dev/null 2>&1 ; then
148 echo "test-suite $Release release candidate $RC doesn't exist!"
149 exit 1
150 fi
157 for proj in $projects ; do
158 echo "# Validating $proj SVN URL"
159
160 if ! svn ls $Base_url/tags/RELEASE_$Release_no_dot/rc$RC > /dev/null 2>&1 ; then
161 echo "llvm $Release release candidate $RC doesn't exist!"
162 exit 1
163 fi
164 done
151165 }
152166
153167 # Export sources to the the build directory.
154168 function export_sources() {
155169 check_valid_urls
156170
157 echo "# Exporting llvm $Release-RC$RC sources"
158 svn export -q $llvmCore_RC_url $llvmCore_srcdir
159 echo "# Exporting llvm-gcc-4.2 $Release-rc$RC sources"
160 svn export -q $llvmgcc42_RC_url $llvmgcc42_srcdir
161 echo "# Exporting clang $Release-rc$RC sources"
162 svn export -q $clang_RC_url $llvmCore_srcdir/tools/clang
163 echo "# Exporting llvm test suite $Release-rc$RC sources"
164 svn export -q $test_suite_RC_url $llvmCore_srcdir/projects/llvm-test
171 for proj in $projects ; do
172 echo "# Exporting $proj $Release-RC$RC sources"
173 if ! svn export -q $Base_url/$proj/tags/RELEASE_$Release_no_dot/rc$RC $proj.src ; then
174 echo "error: failed to export $proj project"
175 exit 1
176 fi
177 done
178
179 echo "# Creating symlinks"
180 cd $BuildDir/llvm.src/tools
181 if [ ! -h clang ]; then
182 ln -s $BuildDir/cfe.src clang
183 fi
184 cd $BuildDir/llvm.src/projects
185 if [ ! -h llvm-test ]; then
186 ln -s $BuildDir/test-suite.src llvm-test
187 fi
188 cd $BuildDir
165189 }
166190
167191 function configure_llvmCore() {
169193 Flavor="$2"
170194 ObjDir="$3"
171195 InstallDir="$4"
172 llvmgccDir="$5"
173196
174197 case $Flavor in
175198 Release | Release-64 )
185208 Assertions="yes"
186209 ;;
187210 * )
188 echo "# Invalid flavor $Flavor!"
211 echo "# Invalid flavor '$Flavor'"
189212 echo ""
190213 return
191214 ;;
192215 esac
193216
217 echo "# Using C compiler: $c_compiler"
218 echo "# Using C++ compiler: $cxx_compiler"
219
194220 cd $ObjDir
195221 echo "# Configuring llvm $Release-rc$RC $Flavor"
196 echo "# $llvmCore_srcdir/configure --prefix=$InstallDir \
222 echo "# $BuildDir/llvm.src/configure --prefix=$InstallDir \
223 --enable-optimized=$Optimized \
224 --enable-assertions=$Assertions"
225 env CC=$c_compiler CXX=$cxx_compiler \
226 $BuildDir/llvm.src/configure --prefix=$InstallDir \
197227 --enable-optimized=$Optimized \
198228 --enable-assertions=$Assertions \
199 --with-llvmgccdir=$llvmgccDir"
200 $llvmCore_srcdir/configure --prefix=$InstallDir \
201 --enable-optimized=$Optimized \
202 --enable-assertions=$Assertions \
203 --with-llvmgccdir=$llvmgccDir \
204 > $LogDir/llvm.configure.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
205 cd -
229 2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
230 cd $BuildDir
206231 }
207232
208233 function build_llvmCore() {
211236 ObjDir="$3"
212237 ExtraOpts=""
213238
214 CompilerFlags=""
215 if [ "$Phase" = "2" ]; then
216 CompilerFlags="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++"
217 fi
218239 if [ "$Flavor" = "Release-64" ]; then
219240 ExtraOpts="EXTRA_OPTIONS=-m64"
220241 fi
222243 cd $ObjDir
223244 echo "# Compiling llvm $Release-rc$RC $Flavor"
224245 echo "# make -j $NumJobs VERBOSE=1 $ExtraOpts"
225 make -j $NumJobs VERBOSE=1 $ExtraOpts $CompilerFlags \
226 > $LogDir/llvm.make.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
246 make -j $NumJobs VERBOSE=1 $ExtraOpts \
247 2>&1 | tee $LogDir/llvm.make-Phase$Phase-$Flavor.log
227248
228249 echo "# Installing llvm $Release-rc$RC $Flavor"
229250 echo "# make install"
230251 make install \
231 > $LogDir/llvm.install.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
232 cd -
252 2>&1 | tee $LogDir/llvm.install-Phase$Phase-$Flavor.log
253 cd $BuildDir
233254 }
234255
235256 function test_llvmCore() {
238259 ObjDir="$3"
239260
240261 cd $ObjDir
241 make check \
242 > $LogDir/llvm.check.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
243 make -C tools/clang test \
244 > $LogDir/clang.check.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
262 make check-all \
263 2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log
245264 make unittests \
246 > $LogDir/llvm.unittests.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
247 cd -
248 }
249
250 function configure_llvm_gcc() {
251 Phase="$1"
252 Flavor="$2"
253 ObjDir="$3"
254 InstallDir="$4"
255 llvmObjDir="$5"
256
257 languages="c,c++"
258 if [ "$do_objc" = "yes" ]; then
259 languages="$languages,objc,obj-c++"
260 fi
261 if [ "$do_fortran" = "yes" ]; then
262 languages="$languages,fortran"
263 fi
264 if [ "$do_ada" = "yes" ]; then
265 languages="$languages,ada"
266 fi
267
268 cd $ObjDir
269 echo "# Configuring llvm-gcc $Release-rc$RC $Flavor"
270 echo "# $llvmgcc42_srcdir/configure --prefix=$InstallDir \
271 --program-prefix=llvm- --enable-llvm=$llvmObjDir \
272 --enable-languages=$languages"
273 $llvmgcc42_srcdir/configure --prefix=$InstallDir \
274 --program-prefix=llvm- --enable-llvm=$llvmObjDir \
275 --enable-languages=$languages \
276 > $LogDir/llvm-gcc.configure.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
277 cd -
278 }
279
280 function build_llvm_gcc() {
281 Phase="$1"
282 Flavor="$2"
283 ObjDir="$3"
284 llvmgccDir="$4"
285
286 CompilerFlags=""
287 if [ "$Phase" = "2" ]; then
288 CompilerFlags="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++"
289 fi
290
291 cd $ObjDir
292 echo "# Compiling llvm-gcc $Release-rc$RC $Flavor"
293 echo "# make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release"
294 make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release $CompilerFlags \
295 > $LogDir/llvm-gcc.make.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
296
297 echo "# Installing llvm-gcc $Release-rc$RC $Flavor"
298 echo "# make install"
299 make install \
300 > $LogDir/llvm-gcc.install.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
301 cd -
265 2>&1 | tee $LogDir/llvm.unittests--Phase$Phase-$Flavor.log
266 cd $BuildDir
302267 }
303268
304269 if [ "$do_checkout" = "yes" ]; then
306271 fi
307272
308273 (
309 Flavors="Debug Release Release+Asserts"
274 Flavors="Release Release+Asserts"
275 if [ "$do_debug" = "yes" ]; then
276 Flavors="Debug $Flavors"
277 fi
310278 if [ "$do_64bit" = "yes" ]; then
311279 Flavors="$Flavors Release-64"
312280 fi
338306 mkdir -p $llvmCore_phase2_objdir
339307 mkdir -p $llvmCore_phase2_installdir
340308
341 llvmgcc42_phase1_objdir=$BuildDir/Phase1/$Flavor/llvmgcc42-$Release-rc$RC.obj
342 llvmgcc42_phase1_installdir=$BuildDir/Phase1/$Flavor/llvmgcc42-$Release-rc$RC.install
343
344 llvmgcc42_phase2_objdir=$BuildDir/Phase2/$Flavor/llvmgcc42-$Release-rc$RC.obj
345 llvmgcc42_phase2_installdir=$BuildDir/Phase2/$Flavor/llvmgcc42-$Release-rc$RC.install
346
347 rm -rf $llvmgcc42_phase1_objdir
348 rm -rf $llvmgcc42_phase1_installdir
349 rm -rf $llvmgcc42_phase2_objdir
350 rm -rf $llvmgcc42_phase2_installdir
351
352 mkdir -p $llvmgcc42_phase1_objdir
353 mkdir -p $llvmgcc42_phase1_installdir
354 mkdir -p $llvmgcc42_phase2_objdir
355 mkdir -p $llvmgcc42_phase2_installdir
356
357309 ############################################################################
358310 # Phase 1: Build llvmCore and llvmgcc42
359311 echo "# Phase 1: Building llvmCore"
360312 configure_llvmCore 1 $Flavor \
361 $llvmCore_phase1_objdir $llvmCore_phase1_installdir \
362 $llvmgcc42_phase1_installdir
313 $llvmCore_phase1_objdir $llvmCore_phase1_installdir
363314 build_llvmCore 1 $Flavor \
364315 $llvmCore_phase1_objdir
365316
366 echo "# Phase 1: Building llvmgcc42"
367 configure_llvm_gcc 1 $Flavor \
368 $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir \
369 $llvmCore_phase1_objdir
370 build_llvm_gcc 1 $Flavor \
371 $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir
372
373317 ############################################################################
374 # Phase 2: Build llvmCore with newly built llvmgcc42 from phase 1.
318 # Phase 2: Build llvmCore with newly built clang from phase 1.
319 c_compiler=$llvmCore_phase1_installdir/bin/clang
320 cxx_compiler=$llvmCore_phase1_installdir/bin/clang++
375321 echo "# Phase 2: Building llvmCore"
376322 configure_llvmCore 2 $Flavor \
377 $llvmCore_phase2_objdir $llvmCore_phase2_installdir \
378 $llvmgcc42_phase1_installdir
323 $llvmCore_phase2_objdir $llvmCore_phase2_installdir
379324 build_llvmCore 2 $Flavor \
380325 $llvmCore_phase2_objdir
381326
382 echo "# Phase 2: Building llvmgcc42"
383 configure_llvm_gcc 2 $Flavor \
384 $llvmgcc42_phase2_objdir $llvmgcc42_phase2_installdir \
385 $llvmCore_phase2_objdir
386 build_llvm_gcc 2 $Flavor \
387 $llvmgcc42_phase2_objdir $llvmgcc42_phase1_installdir
388
389 echo "# Testing - built with llvmgcc42"
327 echo "# Testing - built with clang"
390328 test_llvmCore 2 $Flavor $llvmCore_phase2_objdir
391329 done
392330 ) 2>&1 | tee $LogDir/testing.$Release-rc$RC.log