2 #===-- test-release.sh - Test the LLVM release candidates ------------------===#
4 # The LLVM Compiler Infrastructure
6 # This file is distributed under the University of Illinois Open Source
9 #===------------------------------------------------------------------------===#
11 # Download, build, and test the release candidate for an LLVM release.
13 #===------------------------------------------------------------------------===#
28 echo "usage: `basename $0` -release X.Y -rc NUM [OPTIONS]"
30 echo " -release X.Y The release number to test."
31 echo " -rc NUM The pre-release candidate number."
32 echo " -j NUM Number of compile jobs to run. [default: 3]"
33 echo " -build-dir DIR Directory to perform testing in. [default: pwd]"
34 echo " -no-checkout Don't checkout the sources from SVN."
35 echo " -no-64bit Don't test the 64-bit version. [default: yes]"
36 echo " -ada Build Ada. [default: no]"
37 echo " -disable-objc Disable ObjC build. [default: build]"
38 echo " -disable-fortran Disable Fortran build. [default: build]"
41 while [ $# -gt 0 ]; do
43 -release |
--release )
46 Release_no_dot
="`echo $1 | sed -e 's,\.,,'`"
48 -rc |
--rc |
-RC |
--RC )
53 NumJobs
="`echo $1 | sed -e 's,-j\([0-9]*\),\1,g'`"
54 if [ -z "$NumJobs" ]; then
59 -build-dir |
--build-dir |
-builddir |
--builddir )
63 -no-checkout |
--no-checkout )
66 -no-64bit |
--no-64bit )
72 -disable-objc |
--disable-objc )
75 -disable-fortran |
--disable-fortran )
76 echo "WARNING: Do you *really* need to disable Fortran?"
80 -help |
--help |
-h |
--h |
-\? )
85 echo "unknown option: $1"
93 # Check required arguments.
94 if [ -z "$Release" ]; then
95 echo "No release number specified!"
99 echo "No release candidate number specified!"
103 # Figure out how many make processes to run.
104 if [ -z "$NumJobs" ]; then
105 NumJobs
=`sysctl -n hw.activecpu 2> /dev/null || true`
107 if [ -z "$NumJobs" ]; then
108 NumJobs
=`sysctl -n hw.ncpu 2> /dev/null || true`
110 if [ -z "$NumJobs" ]; then
111 NumJobs
=`grep -c processor /proc/cpuinfo 2> /dev/null || true`
113 if [ -z "$NumJobs" ]; then
117 # Location of sources.
118 llvmCore_srcdir
=$BuildDir/llvmCore-
$Release-rc$RC.src
119 llvmgcc42_srcdir
=$BuildDir/llvmgcc42-
$Release-rc$RC.src
121 # Location of log files.
122 LogDirName
="$Release-rc$RC.logs"
123 LogDir
=$BuildDir/$LogDirName
126 # SVN URLs for the sources.
127 Base_url
="http://llvm.org/svn/llvm-project"
128 llvmCore_RC_url
="$Base_url/llvm/tags/RELEASE_$Release_no_dot/rc$RC"
129 llvmgcc42_RC_url
="$Base_url/llvm-gcc-4.2/tags/RELEASE_$Release_no_dot/rc$RC"
130 clang_RC_url
="$Base_url/cfe/tags/RELEASE_$Release_no_dot/rc$RC"
131 test_suite_RC_url
="$Base_url/test-suite/tags/RELEASE_$Release_no_dot/rc$RC"
133 # Make sure that the URLs are valid.
134 function check_valid_urls
() {
135 echo "# Validating SVN URLs"
136 if ! svn
ls $llvmCore_RC_url > /dev
/null
2>&1 ; then
137 echo "llvm $Release release candidate $RC doesn't exist!"
140 if ! svn
ls $llvmgcc42_RC_url > /dev
/null
2>&1 ; then
141 echo "llvm-gcc-4.2 $Release release candidate $RC doesn't exist!"
144 if ! svn
ls $clang_RC_url > /dev
/null
2>&1 ; then
145 echo "clang $Release release candidate $RC doesn't exist!"
148 if ! svn
ls $test_suite_RC_url > /dev
/null
2>&1 ; then
149 echo "test-suite $Release release candidate $RC doesn't exist!"
154 # Export sources to the the build directory.
155 function export_sources
() {
158 echo "# Exporting llvm $Release-RC$RC sources"
159 svn
export -q $llvmCore_RC_url $llvmCore_srcdir
160 echo "# Exporting llvm-gcc-4.2 $Release-rc$RC sources"
161 svn
export -q $llvmgcc42_RC_url $llvmgcc42_srcdir
162 echo "# Exporting clang $Release-rc$RC sources"
163 svn
export -q $clang_RC_url $llvmCore_srcdir/tools
/clang
164 echo "# Exporting llvm test suite $Release-rc$RC sources"
165 svn
export -q $test_suite_RC_url $llvmCore_srcdir/projects
/llvm-test
168 function configure_llvmCore
() {
176 Release | Release-64
)
189 echo "# Invalid flavor $Flavor!"
196 echo "# Configuring llvm $Release-rc$RC $Flavor"
197 echo "# $llvmCore_srcdir/configure --prefix=$InstallDir \
198 --enable-optimized=$Optimized \
199 --enable-assertions=$Assertions \
200 --with-llvmgccdir=$llvmgccDir"
201 $llvmCore_srcdir/configure
--prefix=$InstallDir \
202 --enable-optimized=$Optimized \
203 --enable-assertions=$Assertions \
204 --with-llvmgccdir=$llvmgccDir \
205 > $LogDir/llvm.configure.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
209 function build_llvmCore
() {
216 if [ "$Phase" = "2" ]; then
217 CompilerFlags
="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++"
219 if [ "$Flavor" = "Release-64" ]; then
220 ExtraOpts
="EXTRA_OPTIONS=-m64"
224 echo "# Compiling llvm $Release-rc$RC $Flavor"
225 echo "# make -j $NumJobs VERBOSE=1 $ExtraOpts"
226 make -j $NumJobs VERBOSE
=1 $ExtraOpts $CompilerFlags \
227 > $LogDir/llvm.
make.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
229 echo "# Installing llvm $Release-rc$RC $Flavor"
230 echo "# make install"
232 > $LogDir/llvm.
install.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
236 function test_llvmCore
() {
243 > $LogDir/llvm.check.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
244 make -C tools
/clang
test \
245 > $LogDir/clang.check.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
247 > $LogDir/llvm.unittests.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
251 function configure_llvm_gcc
() {
259 if [ "$do_objc" = "yes" ]; then
260 languages
="$languages,objc,obj-c++"
262 if [ "$do_fortran" = "yes" ]; then
263 languages
="$languages,fortran"
265 if [ "$do_ada" = "yes" ]; then
266 languages
="$languages,ada"
270 echo "# Configuring llvm-gcc $Release-rc$RC $Flavor"
271 echo "# $llvmgcc42_srcdir/configure --prefix=$InstallDir \
272 --program-prefix=llvm- --enable-llvm=$llvmObjDir \
273 --enable-languages=$languages"
274 $llvmgcc42_srcdir/configure
--prefix=$InstallDir \
275 --program-prefix=llvm-
--enable-llvm=$llvmObjDir \
276 --enable-languages=$languages \
277 > $LogDir/llvm-gcc.configure.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
281 function build_llvm_gcc
() {
288 if [ "$Phase" = "2" ]; then
289 CompilerFlags
="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++"
293 echo "# Compiling llvm-gcc $Release-rc$RC $Flavor"
294 echo "# make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release"
295 make -j $NumJobs bootstrap LLVM_VERSION_INFO
=$Release $CompilerFlags \
296 > $LogDir/llvm-gcc.
make.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
298 echo "# Installing llvm-gcc $Release-rc$RC $Flavor"
299 echo "# make install"
301 > $LogDir/llvm-gcc.
install.
$Release-rc$RC-Phase$Phase-$Flavor.log
2>&1
305 if [ "$do_checkout" = "yes" ]; then
310 Flavors
="Debug Release Release+Asserts"
311 if [ "$do_64bit" = "yes" ]; then
312 Flavors
="$Flavors Release-64"
315 for Flavor
in $Flavors ; do
318 echo "********************************************************************************"
319 echo " Release: $Release-rc$RC"
320 echo " Build: $Flavor"
321 echo " System Info: "
323 echo "********************************************************************************"
326 llvmCore_phase1_objdir
=$BuildDir/Phase
1/$Flavor/llvmCore-
$Release-rc$RC.obj
327 llvmCore_phase1_installdir
=$BuildDir/Phase
1/$Flavor/llvmCore-
$Release-rc$RC.
install
329 llvmCore_phase2_objdir
=$BuildDir/Phase
2/$Flavor/llvmCore-
$Release-rc$RC.obj
330 llvmCore_phase2_installdir
=$BuildDir/Phase
2/$Flavor/llvmCore-
$Release-rc$RC.
install
332 rm -rf $llvmCore_phase1_objdir
333 rm -rf $llvmCore_phase1_installdir
334 rm -rf $llvmCore_phase2_objdir
335 rm -rf $llvmCore_phase2_installdir
337 mkdir
-p $llvmCore_phase1_objdir
338 mkdir
-p $llvmCore_phase1_installdir
339 mkdir
-p $llvmCore_phase2_objdir
340 mkdir
-p $llvmCore_phase2_installdir
342 llvmgcc42_phase1_objdir
=$BuildDir/Phase
1/$Flavor/llvmgcc42-
$Release-rc$RC.obj
343 llvmgcc42_phase1_installdir
=$BuildDir/Phase
1/$Flavor/llvmgcc42-
$Release-rc$RC.
install
345 llvmgcc42_phase2_objdir
=$BuildDir/Phase
2/$Flavor/llvmgcc42-
$Release-rc$RC.obj
346 llvmgcc42_phase2_installdir
=$BuildDir/Phase
2/$Flavor/llvmgcc42-
$Release-rc$RC.
install
348 rm -rf $llvmgcc42_phase1_objdir
349 rm -rf $llvmgcc42_phase1_installdir
350 rm -rf $llvmgcc42_phase2_objdir
351 rm -rf $llvmgcc42_phase2_installdir
353 mkdir
-p $llvmgcc42_phase1_objdir
354 mkdir
-p $llvmgcc42_phase1_installdir
355 mkdir
-p $llvmgcc42_phase2_objdir
356 mkdir
-p $llvmgcc42_phase2_installdir
358 ############################################################################
359 # Phase 1: Build llvmCore and llvmgcc42
360 echo "# Phase 1: Building llvmCore"
361 configure_llvmCore
1 $Flavor \
362 $llvmCore_phase1_objdir $llvmCore_phase1_installdir \
363 $llvmgcc42_phase1_installdir
364 build_llvmCore
1 $Flavor \
365 $llvmCore_phase1_objdir
367 echo "# Phase 1: Building llvmgcc42"
368 configure_llvm_gcc
1 $Flavor \
369 $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir \
370 $llvmCore_phase1_objdir
371 build_llvm_gcc
1 $Flavor \
372 $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir
374 ############################################################################
375 # Phase 2: Build llvmCore with newly built llvmgcc42 from phase 1.
376 echo "# Phase 2: Building llvmCore"
377 configure_llvmCore
2 $Flavor \
378 $llvmCore_phase2_objdir $llvmCore_phase2_installdir \
379 $llvmgcc42_phase1_installdir
380 build_llvmCore
2 $Flavor \
381 $llvmCore_phase2_objdir
383 echo "# Phase 2: Building llvmgcc42"
384 configure_llvm_gcc
2 $Flavor \
385 $llvmgcc42_phase2_objdir $llvmgcc42_phase2_installdir \
386 $llvmCore_phase2_objdir
387 build_llvm_gcc
2 $Flavor \
388 $llvmgcc42_phase2_objdir $llvmgcc42_phase1_installdir
390 echo "# Testing - built with llvmgcc42"
391 test_llvmCore
2 $Flavor $llvmCore_phase2_objdir
393 ) 2>&1 |
tee $LogDir/testing.
$Release-rc$RC.log
396 echo "### Testing Finished ###"
397 echo "### Logs: $LogDir"